public class Sphinx3Saver extends java.lang.Object implements Saver
Mixture weights and transition probabilities are saved in linear scale.
Modifier and Type | Field and Description |
---|---|
protected static int |
BYTE_ORDER_MAGIC |
protected static int |
CONTEXT_SIZE |
static java.lang.String |
DATA_LOCATION |
static java.lang.String |
DEF_FILE |
protected static java.lang.String |
DENSITY_FILE_VERSION |
protected static java.lang.String |
FILLER |
static java.lang.String |
LOADER |
protected java.util.logging.Logger |
logger |
protected LogMath |
logMath |
protected static java.lang.String |
MIXW_FILE_VERSION |
static java.lang.String |
MODEL_VERSION |
static java.lang.String |
PROP_MC_FLOOR |
static java.lang.String |
PROP_SPARSE_FORM
The property 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_USE_CD_UNITS |
static java.lang.String |
PROP_VECTOR_LENGTH |
static java.lang.String |
SAVE_LOCATION |
protected static java.lang.String |
SILENCE_CIPHONE |
protected boolean |
sparseForm |
protected static java.lang.String |
TMAT_FILE_VERSION |
boolean |
useCDUnits |
PROP_MW_FLOOR, PROP_VARIANCE_FLOOR
Constructor and Description |
---|
Sphinx3Saver() |
Modifier and Type | Method and Description |
---|---|
protected java.lang.String |
getCheckSum()
Return the checksum string.
|
java.util.Map<java.lang.String,Unit> |
getContextIndependentUnits()
Returns the map of context indepent units.
|
protected boolean |
getDoCheckSum()
Return whether to do the dochecksum.
|
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 pool of means transformation matrices for this loader.
|
Pool<float[]> |
getMeansTransformationVectorPool()
Gets the pool of means transformation vectors for this loader.
|
int |
getRightContextSize()
Returns the size of the right context for context dependent units.
|
Pool<Senone> |
getSenonePool()
Gets the senone pool for this loader.
|
Pool<float[]> |
getVariancePool()
Gets the variance pool.
|
Pool<float[][]> |
getVarianceTransformationMatrixPool()
Gets the variance transformation matrix pool.
|
Pool<float[]> |
getVarianceTransformationVectorPool()
Gets the variance transformation vectorpool.
|
void |
logInfo()
logs information about this loader
|
void |
newProperties(PropertySheet ps)
This method is called when this configurable component needs to be reconfigured.
|
void |
save(java.lang.String modelName,
boolean b)
Saves the AcousticModel from a directory in the file system.
|
protected void |
saveTransitionMatricesAscii(Pool<float[][]> pool,
java.lang.String path,
boolean append)
Saves the transition matrices
|
protected void |
saveTransitionMatricesBinary(Pool<float[][]> pool,
java.lang.String path,
boolean append)
Saves the transition matrices (Binary)
|
protected void |
writeFloat(java.io.DataOutputStream dos,
float val)
Writes a float to the output stream, byte-swapping as necessary
|
protected void |
writeFloatArray(java.io.DataOutputStream dos,
float[] data)
Writes the given number of floats from an array of floats to a stream.
|
protected void |
writeInt(java.io.DataOutputStream dos,
int val)
Writes an integer to the output stream, byte-swapping as necessary
|
protected java.io.DataOutputStream |
writeS3BinaryHeader(java.lang.String location,
java.lang.String path,
java.util.Properties props,
boolean append)
Writes the S3 binary header to the given location+path.
|
@S4Boolean(defaultValue=true) public static final java.lang.String PROP_SPARSE_FORM
protected boolean sparseForm
@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
@S4Component(type=Loader.class) public static final java.lang.String LOADER
@S4Integer(defaultValue=39) public static final java.lang.String PROP_VECTOR_LENGTH
protected java.util.logging.Logger logger
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 LogMath logMath
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
@S4String(defaultValue=".") public static final java.lang.String SAVE_LOCATION
@S4String(mandatory=false, defaultValue="") public static final java.lang.String DATA_LOCATION
@S4String(mandatory=false, defaultValue="") public static final java.lang.String DEF_FILE
public boolean useCDUnits
public void newProperties(PropertySheet ps) throws PropertyException
Configurable
newProperties
in interface Configurable
ps
- a property sheet holding the new dataPropertyException
- if there is a problem with the properties.protected java.lang.String getCheckSum()
protected boolean getDoCheckSum()
protected java.lang.String getLocation()
public void save(java.lang.String modelName, boolean b) throws java.io.IOException
public java.util.Map<java.lang.String,Unit> getContextIndependentUnits()
Saver
getContextIndependentUnits
in interface Saver
protected java.io.DataOutputStream writeS3BinaryHeader(java.lang.String location, java.lang.String path, java.util.Properties props, boolean append) throws java.io.IOException
location
- the location of the filepath
- the name of the fileprops
- the propertiesappend
- is true, the file will be appended, useful if saving to a ZIP or JAR filejava.io.IOException
- on errorprotected void writeInt(java.io.DataOutputStream dos, int val) throws java.io.IOException
dos
- the output streamval
- an integer valuejava.io.IOException
- on errorprotected void writeFloat(java.io.DataOutputStream dos, float val) throws java.io.IOException
dos
- the input streamval
- a float valuejava.io.IOException
- on errorprotected void writeFloatArray(java.io.DataOutputStream dos, float[] data) throws java.io.IOException
dos
- the stream to write the data todata
- the array of floats to write to the streamjava.io.IOException
- if an exception occursprotected void saveTransitionMatricesAscii(Pool<float[][]> pool, java.lang.String path, boolean append) throws java.io.FileNotFoundException, java.io.IOException
pool
- the transition matrices poolpath
- the path to the transitions matricesappend
- is true, the file will be appended, useful if saving to a ZIP or JAR filejava.io.FileNotFoundException
- if a file cannot be foundjava.io.IOException
- if an error occurs while saving the dataprotected void saveTransitionMatricesBinary(Pool<float[][]> pool, java.lang.String path, boolean append) throws java.io.IOException
pool
- the transition matrices poolpath
- the path to the transitions matricesappend
- is true, the file will be appended, useful if saving to a ZIP or JAR filejava.io.IOException
- if an error occurs while saving the datapublic Pool<float[]> getMeansPool()
Saver
getMeansPool
in interface Saver
public Pool<float[][]> getMeansTransformationMatrixPool()
Saver
getMeansTransformationMatrixPool
in interface Saver
public Pool<float[]> getMeansTransformationVectorPool()
Saver
getMeansTransformationVectorPool
in interface Saver
public Pool<float[]> getVariancePool()
Saver
getVariancePool
in interface Saver
public Pool<float[][]> getVarianceTransformationMatrixPool()
Saver
getVarianceTransformationMatrixPool
in interface Saver
public Pool<float[]> getVarianceTransformationVectorPool()
Saver
getVarianceTransformationVectorPool
in interface Saver
public Pool<Senone> getSenonePool()
Saver
getSenonePool
in interface Saver
public int getLeftContextSize()
Saver
getLeftContextSize
in interface Saver
public int getRightContextSize()
Saver
getRightContextSize
in interface Saver
public HMMManager getHMMManager()
Saver
getHMMManager
in interface Saver