edu.cmu.sphinx.linguist.acoustic.tiedstate
Class HTKLoader

java.lang.Object
  extended by edu.cmu.sphinx.linguist.acoustic.tiedstate.HTKLoader
All Implemented Interfaces:
Loader, Configurable

public class HTKLoader
extends java.lang.Object
implements Loader

Remark1: S4 does not use HMM tying: the HTK "tiedlist" is not loaded nor user for now Remark2: HTK does nearly never backoff to monophones, whereas S4 might do it. Hence, all 1ph must be present, which is not always the case in HTK models. In this file, we have simply tied all 1phs to the first 3ph found with the same base phone. This is clearly not the best option, this may impact the performances. A better alternative should be proposed. Remark3: HTK is case-sensitive, while S4 requires upper-case names. A good option would be to modify S4 to make it case-sensitive, but in this version, I have rather built a class "NamesConversion" to transform the models, lexicons and grammar. Remark4: HTK does not have separate filler file. It should be quite easy to define the fillers in the configuration of HTKLoader, but I have not yet done it. For now, a separate filler file must be built. Remark5: The HTK/Julius lexicon has different fields for the word name and the printed output. We simply delete and don't use this field ("[...]") in this version. This modify the way scoring must be done. WARNING ! Remark6: Diphones are not allowed in S4 (?), and when they occur in the HTK MMF, the 2ph is transformed into a 3ph with "SIL" context. When both the transformed 2ph and the 3ph coexists in the MMF file, only the first one is kept (!) Remark7: HTKloader does not support yet all the HTK format. However it should work for standard 3ph models (it supports state/transition tying).


Field Summary
static java.lang.String MODEL_VERSION
          Supports this version of the acoustic model
static java.lang.String PROP_IS_BINARY
          Specifies whether the model to be loaded is in ASCII or binary format
static java.lang.String PROP_LOG_MATH
          The log math component for the system.
static java.lang.String PROP_MC_FLOOR
          Mixture component score floor.
static java.lang.String PROP_MODEL
          The name of the model definition file (contains the HMM data)
static java.lang.String PROP_MW_FLOOR
          Mixture weight floor.
static java.lang.String PROP_PROPERTIES_FILE
          The SphinxProperty for the name of the acoustic properties file.
static java.lang.String PROP_TIE_1PH
          Shall we use the real 1ph or tie them from the 3ph ?
static java.lang.String PROP_UNIT_MANAGER
          The unit manager
static java.lang.String PROP_VARIANCE_FLOOR
          Variance floor.
static java.lang.String PROP_VECTOR_LENGTH
          The SphinxProperty for the length of feature vectors.
 
Constructor Summary
HTKLoader()
           
HTKLoader(java.lang.String propsFile, LogMath logMath, UnitManager unitManager, boolean isBinary, int vectorLength, java.lang.String model, boolean tie1ph, float distFloor, float mixtureWeightFloor, float varianceFloor)
           
 
Method Summary
 java.util.Map<java.lang.String,Unit> getContextIndependentUnits()
          Returns the map of context indepent units.
 HMMManager getHMMManager()
          Returns the HMM Manager for this loader.
 int getLeftContextSize()
          Returns the size of the left context for context dependent units.
 Pool<float[]> getMeansPool()
          Gets the pool of means for this loader.
 Pool<float[][]> getMeansTransformationMatrixPool()
          Gets the means transformation matrix pool.
 Pool<float[]> getMeansTransformationVectorPool()
          Gets the means transformation vectors pool.
 Pool<float[]> getMixtureWeightPool()
          Gets the mixture weight pool.
 java.lang.String getName()
           
 int getRightContextSize()
          Returns the size of the right context for context dependent units.
 Pool<Senone> getSenonePool()
          Gets the senone pool for this loader.
 float[][] getTransformMatrix()
          Gets the transformation matrix.
 Pool<float[][]> getTransitionMatrixPool()
          Gets the transition matrix pool.
 Pool<float[]> getVariancePool()
          Gets the variance pool.
 Pool<float[][]> getVarianceTransformationMatrixPool()
          Gets the variance transformation matrix pool.
 Pool<float[]> getVarianceTransformationVectorPool()
          Gets the variance transformation vectors pool.
 void load()
          Loads the acoustic model.
 void logInfo()
          logs information about this loader
 void newProperties(PropertySheet ps)
          This method is called when this configurable component needs to be reconfigured.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROP_LOG_MATH

@S4Component(type=LogMath.class)
public static final java.lang.String PROP_LOG_MATH
The log math component for the system.

See Also:
Constant Field Values

PROP_UNIT_MANAGER

@S4Component(type=UnitManager.class)
public static final java.lang.String PROP_UNIT_MANAGER
The unit manager

See Also:
Constant Field Values

PROP_IS_BINARY

@S4Boolean(defaultValue=true)
public static final java.lang.String PROP_IS_BINARY
Specifies whether the model to be loaded is in ASCII or binary format

See Also:
Constant Field Values

PROP_MODEL

@S4String(mandatory=true,
          defaultValue="hmmdefs")
public static final java.lang.String PROP_MODEL
The name of the model definition file (contains the HMM data)

See Also:
Constant Field Values

PROP_TIE_1PH

@S4Boolean(defaultValue=true)
public static final java.lang.String PROP_TIE_1PH
Shall we use the real 1ph or tie them from the 3ph ?

See Also:
Constant Field Values

PROP_PROPERTIES_FILE

@S4String(defaultValue="model.props")
public static final java.lang.String PROP_PROPERTIES_FILE
The SphinxProperty for the name of the acoustic properties file.

See Also:
Constant Field Values

PROP_VECTOR_LENGTH

@S4Integer(defaultValue=39)
public static final java.lang.String PROP_VECTOR_LENGTH
The SphinxProperty for the length of feature vectors.

See Also:
Constant Field Values

PROP_MC_FLOOR

@S4Double(defaultValue=0.0)
public static final java.lang.String PROP_MC_FLOOR
Mixture component score floor.

See Also:
Constant Field Values

PROP_VARIANCE_FLOOR

@S4Double(defaultValue=9.999999747378752E-5)
public static final java.lang.String PROP_VARIANCE_FLOOR
Variance floor.

See Also:
Constant Field Values

PROP_MW_FLOOR

@S4Double(defaultValue=1.0000000116860974E-7)
public static final java.lang.String PROP_MW_FLOOR
Mixture weight floor.

See Also:
Constant Field Values

MODEL_VERSION

public static final java.lang.String MODEL_VERSION
Supports this version of the acoustic model

See Also:
Constant Field Values
Constructor Detail

HTKLoader

public HTKLoader(java.lang.String propsFile,
                 LogMath logMath,
                 UnitManager unitManager,
                 boolean isBinary,
                 int vectorLength,
                 java.lang.String model,
                 boolean tie1ph,
                 float distFloor,
                 float mixtureWeightFloor,
                 float varianceFloor)

HTKLoader

public HTKLoader()
Method Detail

newProperties

public void newProperties(PropertySheet ps)
                   throws PropertyException
Description copied from interface: Configurable
This method is called when this configurable component needs to be reconfigured.

Specified by:
newProperties in interface Configurable
Parameters:
ps - a property sheet holding the new data
Throws:
PropertyException - if there is a problem with the properties.

load

public void load()
          throws java.io.IOException
Description copied from interface: Loader
Loads the acoustic model.

Specified by:
load in interface Loader
Throws:
java.io.IOException - if an error occurs while loading the model

getName

public java.lang.String getName()

getContextIndependentUnits

public java.util.Map<java.lang.String,Unit> getContextIndependentUnits()
Description copied from interface: Loader
Returns the map of context indepent units. The map can be accessed by unit name.

Specified by:
getContextIndependentUnits in interface Loader
Returns:
the map of context independent units

getMeansPool

public Pool<float[]> getMeansPool()
Description copied from interface: Loader
Gets the pool of means for this loader.

Specified by:
getMeansPool in interface Loader
Returns:
the pool

getMeansTransformationMatrixPool

public Pool<float[][]> getMeansTransformationMatrixPool()
Description copied from interface: Loader
Gets the means transformation matrix pool.

Specified by:
getMeansTransformationMatrixPool in interface Loader
Returns:
the pool

getMeansTransformationVectorPool

public Pool<float[]> getMeansTransformationVectorPool()
Description copied from interface: Loader
Gets the means transformation vectors pool.

Specified by:
getMeansTransformationVectorPool in interface Loader
Returns:
the pool

getVariancePool

public Pool<float[]> getVariancePool()
Description copied from interface: Loader
Gets the variance pool.

Specified by:
getVariancePool in interface Loader
Returns:
the pool

getVarianceTransformationMatrixPool

public Pool<float[][]> getVarianceTransformationMatrixPool()
Description copied from interface: Loader
Gets the variance transformation matrix pool.

Specified by:
getVarianceTransformationMatrixPool in interface Loader
Returns:
the pool

getVarianceTransformationVectorPool

public Pool<float[]> getVarianceTransformationVectorPool()
Description copied from interface: Loader
Gets the variance transformation vectors pool.

Specified by:
getVarianceTransformationVectorPool in interface Loader
Returns:
the pool

getMixtureWeightPool

public Pool<float[]> getMixtureWeightPool()
Description copied from interface: Loader
Gets the mixture weight pool.

Specified by:
getMixtureWeightPool in interface Loader
Returns:
the pool

getTransitionMatrixPool

public Pool<float[][]> getTransitionMatrixPool()
Description copied from interface: Loader
Gets the transition matrix pool.

Specified by:
getTransitionMatrixPool in interface Loader
Returns:
the pool

getTransformMatrix

public float[][] getTransformMatrix()
Description copied from interface: Loader
Gets the transformation matrix.

Specified by:
getTransformMatrix in interface Loader
Returns:
the matrix

getSenonePool

public Pool<Senone> getSenonePool()
Description copied from interface: Loader
Gets the senone pool for this loader.

Specified by:
getSenonePool in interface Loader
Returns:
the pool

getLeftContextSize

public int getLeftContextSize()
Description copied from interface: Loader
Returns the size of the left context for context dependent units.

Specified by:
getLeftContextSize in interface Loader
Returns:
the left context size

getRightContextSize

public int getRightContextSize()
Description copied from interface: Loader
Returns the size of the right context for context dependent units.

Specified by:
getRightContextSize in interface Loader
Returns:
the left context size

getHMMManager

public HMMManager getHMMManager()
Description copied from interface: Loader
Returns the HMM Manager for this loader.

Specified by:
getHMMManager in interface Loader
Returns:
the HMM Manager

logInfo

public void logInfo()
Description copied from interface: Loader
logs information about this loader

Specified by:
logInfo in interface Loader