public class HTKLoader extends java.lang.Object implements Loader
| Modifier and Type | Field and Description |
|---|---|
protected static int |
BYTE_ORDER_MAGIC |
protected static int |
CONTEXT_SIZE |
protected static java.lang.String |
DENSITY_FILE_VERSION |
protected static java.lang.String |
FILLER |
protected static java.lang.String |
MIXW_FILE_VERSION |
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_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 property 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 property for the length of feature vectors.
|
protected static java.lang.String |
SILENCE_CIPHONE |
protected static java.lang.String |
TMAT_FILE_VERSION |
| Constructor and Description |
|---|
HTKLoader() |
HTKLoader(java.lang.String propsFile,
UnitManager unitManager,
boolean isBinary,
int vectorLength,
java.lang.String model,
boolean tie1ph,
float distFloor,
float mixtureWeightFloor,
float varianceFloor) |
| Modifier and Type | Method and Description |
|---|---|
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.
|
protected java.lang.String |
getLocation()
Return the location.
|
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.
|
GaussianWeights |
getMixtureWeights()
Gets the mixture weight pool.
|
java.lang.String |
getName() |
java.util.Properties |
getProperties()
Return the acoustic model properties.
|
int |
getRightContextSize()
Returns the size of the right context for context dependent units.
|
Pool<Senone> |
getSenonePool()
Gets the senone pool for this loader.
|
protected SenoneSequence |
getSenoneSequence(int[] stateId)
Gets the senone sequence representing the given senones.
|
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.
|
protected void |
loadHMMPool(boolean useCDUnits,
edu.cmu.sphinx.linguist.acoustic.tiedstate.HTKLoader.HTKStruct htkModels,
java.lang.String path)
Loads the model file.
|
void |
logInfo()
logs information about this loader
|
void |
newProperties(PropertySheet ps)
This method is called when this configurable component needs to be reconfigured.
|
protected float |
readFloat(java.io.DataInputStream dis)
Read a float from the input stream, byte-swapping as necessary. the input
stream
|
protected float[] |
readFloatArray(java.io.DataInputStream dis,
int size)
Reads the given number of floats from the stream and returns them in an
array of floats.
|
protected int |
readInt(java.io.DataInputStream dis)
Read an integer from the input stream, byte-swapping as necessary.
|
protected boolean |
sameSenoneSequence(int[] ssid1,
int[] ssid2)
Returns true if the given senone sequence IDs are the same.
|
void |
update(Transform transform,
ClusteredDensityFileData clusters)
Apply the transform
|
@S4Component(type=UnitManager.class) public static final java.lang.String PROP_UNIT_MANAGER
@S4Boolean(defaultValue=true) public static final java.lang.String PROP_IS_BINARY
@S4String(mandatory=true, defaultValue="hmmdefs") public static final java.lang.String PROP_MODEL
@S4Boolean(defaultValue=true) public static final java.lang.String PROP_TIE_1PH
@S4String(defaultValue="model.props") public static final java.lang.String PROP_PROPERTIES_FILE
@S4Integer(defaultValue=39) public static final java.lang.String PROP_VECTOR_LENGTH
@S4Double(defaultValue=0.0) public static final java.lang.String PROP_MC_FLOOR
@S4Double(defaultValue=9.999999747378752E-5) public static final java.lang.String PROP_VARIANCE_FLOOR
@S4Double(defaultValue=1.0000000116860974E-7) public static final java.lang.String PROP_MW_FLOOR
protected static final java.lang.String FILLER
protected static final java.lang.String SILENCE_CIPHONE
protected static final int BYTE_ORDER_MAGIC
public static final java.lang.String MODEL_VERSION
protected static final int CONTEXT_SIZE
protected static final java.lang.String DENSITY_FILE_VERSION
protected static final java.lang.String MIXW_FILE_VERSION
protected static final java.lang.String TMAT_FILE_VERSION
public HTKLoader(java.lang.String propsFile,
UnitManager unitManager,
boolean isBinary,
int vectorLength,
java.lang.String model,
boolean tie1ph,
float distFloor,
float mixtureWeightFloor,
float varianceFloor)
public HTKLoader()
public void newProperties(PropertySheet ps) throws PropertyException
ConfigurablenewProperties in interface Configurableps - a property sheet holding the new dataPropertyException - if there is a problem with the properties.public void load()
throws java.io.IOException
Loaderpublic java.lang.String getName()
public java.util.Properties getProperties()
getProperties in interface Loaderprotected java.lang.String getLocation()
public java.util.Map<java.lang.String,Unit> getContextIndependentUnits()
LoadergetContextIndependentUnits in interface Loaderprotected int readInt(java.io.DataInputStream dis)
throws java.io.IOException
dis - the input streamjava.io.IOException - on errorprotected float readFloat(java.io.DataInputStream dis)
throws java.io.IOException
dis - the input streamjava.io.IOException - on errorprotected float[] readFloatArray(java.io.DataInputStream dis,
int size)
throws java.io.IOException
dis - the stream to read data from the number of floats to readsize - size of the arrayjava.io.IOException - if an exception occursprotected void loadHMMPool(boolean useCDUnits,
edu.cmu.sphinx.linguist.acoustic.tiedstate.HTKLoader.HTKStruct htkModels,
java.lang.String path)
throws java.io.IOException
useCDUnits - if true, loads also the context dependent unitshtkModels - the set of HTK modelspath - the path to a density filejava.io.IOException - if an error occurs while loading the dataprotected boolean sameSenoneSequence(int[] ssid1,
int[] ssid2)
ssid1 - first sequence of senonesssid2 - second sequence of senonesprotected SenoneSequence getSenoneSequence(int[] stateId)
stateId - is the array of senone state idspublic Pool<float[]> getMeansPool()
LoadergetMeansPool in interface Loaderpublic Pool<float[][]> getMeansTransformationMatrixPool()
LoadergetMeansTransformationMatrixPool in interface Loaderpublic Pool<float[]> getMeansTransformationVectorPool()
LoadergetMeansTransformationVectorPool in interface Loaderpublic Pool<float[]> getVariancePool()
LoadergetVariancePool in interface Loaderpublic Pool<float[][]> getVarianceTransformationMatrixPool()
LoadergetVarianceTransformationMatrixPool in interface Loaderpublic Pool<float[]> getVarianceTransformationVectorPool()
LoadergetVarianceTransformationVectorPool in interface Loaderpublic GaussianWeights getMixtureWeights()
LoadergetMixtureWeights in interface Loaderpublic Pool<float[][]> getTransitionMatrixPool()
LoadergetTransitionMatrixPool in interface Loaderpublic float[][] getTransformMatrix()
LoadergetTransformMatrix in interface Loaderpublic Pool<Senone> getSenonePool()
LoadergetSenonePool in interface Loaderpublic int getLeftContextSize()
LoadergetLeftContextSize in interface Loaderpublic int getRightContextSize()
LoadergetRightContextSize in interface Loaderpublic HMMManager getHMMManager()
LoadergetHMMManager in interface Loaderpublic void logInfo()
Loaderpublic void update(Transform transform, ClusteredDensityFileData clusters)
Loader