|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.cmu.sphinx.linguist.acoustic.tiedstate.Sphinx3Loader
public class Sphinx3Loader
Loads a tied-state acoustic model generated by the Sphinx-3 trainer.
The acoustic model should be packaged in a JAR file or should be unpacked on disk. The dictionary and language model files are not required to be in the package. You can specify their locations separately. Properties of the model should be either configure in a config file or stored with the model in "model.props" text file. The "model.props" has the priority over the config file. It is a file of key-value pairs, loadable as a Java Properties file. It should minimally contain the following properties:
As an example, lets look at the Wall Street Journal acoustic model JAR file,
which is located at the sphinx4/lib directory. If you run
"jar tvf lib/WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz.jar", you
will find that its internal structure looks roughly like:
WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz.jar
|
+- edu
|
+- cmu
|
+- sphinx
|
+- model
|
+ acoustic
|
+- model.props
|
+- WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz.class
|
+- WSJLoader.class
|
+- cd_continuous_8gau
| |
| +- means
| +- variances
| +- mixture_weights
| +- transition_matrices
|
+- dict
| |
| +- alpha.dict
| +- cmudict.0.6d
| +- digits.dict
| +- fillerdict
|
+- etc
|
+- WSJ_clean_13dCep_16k_40mel_130Hz_6800Hz.4000.mdef
+- WSJ_clean_13dCep_16k_40mel_130Hz_6800Hz.ci.mdef
+- variables.def
The model.props file looks like (note how the 'dataLocation' and
'modelDefinition' properties are defined relative to the
WSJ_clean_13dCep_16k_40mel_130Hz_6800Hz.class):
description = Wall Street Journal acoustic models isBinary = true featureType = cepstra_delta_doubledelta vectorLength = 39 sparseForm = false <p/> numberFftPoints = 512 filters = 40 gaussians = 8 maxFreq = 6800 minFreq. = 130 sampleRate = 16000 dataLocation = cd_continuous_8gau modelDefinition = etc/WSJ_clean_13dCep_16k_40mel_130Hz_6800Hz.4000.mdef
Note that although most of the properties of this class are already defined in the model.props file, it is still possible (but not recommended) to override those values by specifying them in the configuration file.
| Field Summary | |
|---|---|
static java.lang.String |
MODEL_VERSION
Supports this version of the acoustic model |
static java.lang.String |
PROP_DATA_LOCATION
Subfolder where the acoustic model can be found |
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_SPARSE_FORM
The SphinxProperty specifying whether the transition matrices of the acoustic model is in sparse form, i.e., omitting the zeros of the non-transitioning states. |
static java.lang.String |
PROP_UNIT_MANAGER
The unit manager |
static java.lang.String |
PROP_USE_CD_UNITS
The SphinxProperty specifying whether context-dependent units should be used. |
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 | |
|---|---|
Sphinx3Loader()
|
|
Sphinx3Loader(java.lang.String propsFile,
LogMath logMath,
UnitManager unitManager,
boolean isBinary,
boolean sparseForm,
int vectorLength,
java.lang.String model,
java.lang.String dataDir,
float distFloor,
float mixtureWeightFloor,
float varianceFloor,
boolean useCDUnits)
|
|
| 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. |
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 |
|---|
@S4Component(type=LogMath.class) public static final java.lang.String PROP_LOG_MATH
@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=false,
defaultValue="mdef")
public static final java.lang.String PROP_MODEL
@S4String(mandatory=false,
defaultValue="data")
public static final java.lang.String PROP_DATA_LOCATION
@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
@S4Boolean(defaultValue=true) public static final java.lang.String PROP_SPARSE_FORM
@S4Boolean(defaultValue=true) public static final java.lang.String PROP_USE_CD_UNITS
@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
public static final java.lang.String MODEL_VERSION
| Constructor Detail |
|---|
public Sphinx3Loader(java.lang.String propsFile,
LogMath logMath,
UnitManager unitManager,
boolean isBinary,
boolean sparseForm,
int vectorLength,
java.lang.String model,
java.lang.String dataDir,
float distFloor,
float mixtureWeightFloor,
float varianceFloor,
boolean useCDUnits)
public Sphinx3Loader()
| Method Detail |
|---|
public void newProperties(PropertySheet ps)
throws PropertyException
Configurable
newProperties in interface Configurableps - a property sheet holding the new data
PropertyException - if there is a problem with the properties.
public void load()
throws java.io.IOException
Loader
load in interface Loaderjava.io.IOException - if an error occurs while loading the modelpublic java.util.Map<java.lang.String,Unit> getContextIndependentUnits()
Loader
getContextIndependentUnits in interface Loaderpublic Pool<float[]> getMeansPool()
Loader
getMeansPool in interface Loaderpublic Pool<float[][]> getMeansTransformationMatrixPool()
Loader
getMeansTransformationMatrixPool in interface Loaderpublic Pool<float[]> getMeansTransformationVectorPool()
Loader
getMeansTransformationVectorPool in interface Loaderpublic Pool<float[]> getVariancePool()
Loader
getVariancePool in interface Loaderpublic Pool<float[][]> getVarianceTransformationMatrixPool()
Loader
getVarianceTransformationMatrixPool in interface Loaderpublic Pool<float[]> getVarianceTransformationVectorPool()
Loader
getVarianceTransformationVectorPool in interface Loaderpublic Pool<float[]> getMixtureWeightPool()
Loader
getMixtureWeightPool in interface Loaderpublic Pool<float[][]> getTransitionMatrixPool()
Loader
getTransitionMatrixPool in interface Loaderpublic float[][] getTransformMatrix()
Loader
getTransformMatrix in interface Loaderpublic Pool<Senone> getSenonePool()
Loader
getSenonePool in interface Loaderpublic int getLeftContextSize()
Loader
getLeftContextSize in interface Loaderpublic int getRightContextSize()
Loader
getRightContextSize in interface Loaderpublic HMMManager getHMMManager()
Loader
getHMMManager in interface Loaderpublic void logInfo()
Loader
logInfo in interface Loader
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||