<commit_before>
/*
 * Copyright 1999-2002 Carnegie Mellon University.  
 * Portions Copyright 2002 Sun Microsystems, Inc.  
 * Portions Copyright 2002 Mitsubishi Electronic Research Laboratories.
 * All Rights Reserved.  Use is subject to license terms.
 * 
 * See the file "license.terms" for information on usage and
 * redistribution of this file, and for a DISCLAIMER OF ALL 
 * WARRANTIES.
 *
 */

package edu.cmu.sphinx.knowledge.acoustic;

import edu.cmu.sphinx.util.SphinxProperties;
import edu.cmu.sphinx.util.StreamFactory;
import edu.cmu.sphinx.util.ExtendedStreamTokenizer;
import edu.cmu.sphinx.util.LogMath;
import edu.cmu.sphinx.util.Utilities;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.BufferedInputStream;
import java.io.DataInputStream;
import java.io.IOException;

import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.logging.Logger;
import java.util.logging.Level;
import java.util.Map;
import java.util.Properties;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import java.util.zip.ZipException;



/**
 * an acoustic model loader that loads sphinx3 ascii data
 *
 * Mixture weights and transition probabilities are maintained in logMath 
 * log base, 
 */
class Sphinx4Loader extends Sphinx3Loader {

    /**
     * The logger for this class
     */
    private static Logger logger = 
	    Logger.getLogger(AcousticModel.PROP_PREFIX + "AcousticModel");

    protected final static String TMAT_FILE_VERSION = "4.0";

    public final static String MAX_MODEL_SIZE = 
	TrainerAcousticModel.PROP_PREFIX + "maxStatePerModel";

    public final static int MAX_MODEL_SIZE_DEFAULT = 10;


    /**
     * Loads the sphinx4 ascii model.
     *
     * @param modelName  the name of the model as specified in the
     *    props file.
     * @param props  the SphinxProperties object
     * @param binary  if <code>true</code> the file is in binary
     * format
     */
    public Sphinx4Loader(String modelName, SphinxProperties props, 
            boolean binary) throws 
	FileNotFoundException, IOException, ZipException {
	super(modelName, props, binary);

    }


    /**
     * Loads the sphinx4 densityfile, a set of density arrays are
     * created and placed in the given pool.
     *
     * @param useCDUnits if true, loads also the context dependent units
     * @param inputStream the open input stream to use
     * @param path the path to a density file
     *
     * @return a pool of loaded densities<commit_msg>Changed property prefix<commit_after>
/*
 * Copyright 1999-2002 Carnegie Mellon University.  
 * Portions Copyright 2002 Sun Microsystems, Inc.  
 * Portions Copyright 2002 Mitsubishi Electronic Research Laboratories.
 * All Rights Reserved.  Use is subject to license terms.
 * 
 * See the file "license.terms" for information on usage and
 * redistribution of this file, and for a DISCLAIMER OF ALL 
 * WARRANTIES.
 *
 */

package edu.cmu.sphinx.knowledge.acoustic;

import edu.cmu.sphinx.util.SphinxProperties;
import edu.cmu.sphinx.util.StreamFactory;
import edu.cmu.sphinx.util.ExtendedStreamTokenizer;
import edu.cmu.sphinx.util.LogMath;
import edu.cmu.sphinx.util.Utilities;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.BufferedInputStream;
import java.io.DataInputStream;
import java.io.IOException;

import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.logging.Logger;
import java.util.logging.Level;
import java.util.Map;
import java.util.Properties;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import java.util.zip.ZipException;



/**
 * an acoustic model loader that loads sphinx3 ascii data
 *
 * Mixture weights and transition probabilities are maintained in logMath 
 * log base, 
 */
class Sphinx4Loader extends Sphinx3Loader {

    /**
     * The logger for this class
     */
    private static Logger logger = 
	    Logger.getLogger(AcousticModel.PROP_PREFIX + "AcousticModel");

    protected final static String TMAT_FILE_VERSION = "4.0";

    public final static String MAX_MODEL_SIZE = 
	AcousticModel.PROP_PREFIX + "maxStatePerModel";

    public final static int MAX_MODEL_SIZE_DEFAULT = 10;


    /**
     * Loads the sphinx4 ascii model.
     *
     * @param modelName  the name of the model as specified in the
     *    props file.
     * @param props  the SphinxProperties object
     * @param binary  if <code>true</code> the file is in binary
     * format
     */
    public Sphinx4Loader(String modelName, SphinxProperties props, 
            boolean binary) throws 
	FileNotFoundException, IOException, ZipException {
	super(modelName, props, binary);

    }


    /**
     * Loads the sphinx4 densityfile, a set of density arrays are
     * created and placed in the given pool.
     *
     * @param useCDUnits if true, loads also the context dependent units
     * @param inputStream the open input stream to use
     * @param path the path to a density file
     *
     * @return a pool of loaded densities
{'fraction_non_alphanumeric': 0.07998490850782872, 'fraction_numerical': 0.009809469911337484, 'mean_word_length': 3.543273350471294, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7584620', 'n_tokens_mistral': 1669, 'n_tokens_neox': 1548, 'n_words': 497}