edu.cmu.sphinx.model.acoustic.TIDIGITS_8gau_13dCep_16k_40mel_130Hz_6800Hz
Class Model

java.lang.Object
  extended byedu.cmu.sphinx.model.acoustic.TIDIGITS_8gau_13dCep_16k_40mel_130Hz_6800Hz.Model
All Implemented Interfaces:
AcousticModel, Configurable

public class Model
extends java.lang.Object
implements AcousticModel, Configurable

Loads a tied-state acoustic model generated by the Sphinx-3 trainer.

It is not the goal of this documentation to provide an explanation about the concept of HMMs. The explanation below is superficial, and provided only in a way that the files in the acoustic model package make sense.

An HMM models a process using a sequence of states. Associated with each state, there is a probability density function. A popular choice for this function is a Gaussian mixture, that is, a summation of Gaussians. As you may recall, a single Gaussian is defined by a mean and a variance, or, in the case of a multidimensional Gaussian, by a mean vector and a covariance matrix, or, under some simplifying assumptions, a variance vector. The "means" and "variances" files in the "continuous" directory contain exactly this: a table in which each line contains a mean vector or a variance vector respectively. The dimension of these vectors is the same as the incoming data, the encoded speech signal. The Gaussian mixture is a summation of Gaussians, with different weights for different Gaussians. The "mixture_weights" file contains this: each line contains the weights for a combination of Gaussians.

The HMM is a model with a set of states. The transitions between states have an associated probability. These probabilities make up the transition matrices stored in the "transition_matrices" file.

The files in the "continuous" directory are, therefore, tables, or pools, of means, variances, mixture weights, and transition probabilities.

The dictionary is a file that maps words to their phonetic transcriptions, that is, it maps words to sequences of phonemes.

The language model contains information about probabilities of words in a language. These probabilities could be for individual words or for sequences of two or three words.

The model definition file in a way ties everything together. If the recognition system models phonemes, there is an HMM for each phoneme. The model definition file has one line for each phoneme. The phoneme could be in a context dependent or independent. Each line, therefore, identifies a unique HMM. This line has the phoneme identification, the non-required left or right context, the index of a transition matrix, and, for each state, the index of a mean vector, a variance vector, and a set of mixture weights.


Field Summary
static java.lang.String PROP_LOADER
          The property that defines the component used to load the acoustic model
static java.lang.String PROP_UNIT_MANAGER
          The property that defines the unit manager
static java.lang.String PROP_USE_COMPOSITES
          Controls whether we generate composites or CI units when no context is given during a lookup.
static boolean PROP_USE_COMPOSITES_DEFAULT
          The default value of PROP_USE_COMPOSITES.
 
Fields inherited from interface edu.cmu.sphinx.linguist.acoustic.AcousticModel
PROP_LOCATION, PROP_LOCATION_DEFAULT
 
Constructor Summary
Model()
           
 
Method Summary
 void allocate()
          initialize this acoustic model with the given name and context.
 void deallocate()
          Deallocates previously allcoated resources
 SenoneSequence getCompositeSenoneSequence(Unit unit, HMMPosition position)
          Get a composite senone sequence given the unit The unit should have a LeftRightContext, where one or two of 'left' or 'right' may be null to indicate that the match should succeed on any context.
 java.util.Iterator getContextIndependentUnitIterator()
          Returns an iterator that can be used to iterate through all the CI units in the acoustic model
 java.util.Iterator getHMMIterator()
          Returns an iterator that can be used to iterate through all the HMMs of the acoustic model
 int getLeftContextSize()
          Returns the size of the left context for context dependent units
 java.lang.String getName()
          Returns the name of this AcousticModel, or null if it has no name.
 java.util.Properties getProperties()
          Returns the properties of this acoustic model.
 int getRightContextSize()
          Returns the size of the right context for context dependent units
 HMM lookupNearestHMM(Unit unit, HMMPosition position, boolean exactMatch)
          Given a unit, returns the HMM that best matches the given unit.
 void newProperties(PropertySheet ps)
          This method is called when this configurable component has new data.
 void register(java.lang.String name, Registry registry)
          Register my properties.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROP_LOADER

public static final java.lang.String PROP_LOADER
The property that defines the component used to load the acoustic model

See Also:
Constant Field Values

PROP_UNIT_MANAGER

public static final java.lang.String PROP_UNIT_MANAGER
The property that defines the unit manager

See Also:
Constant Field Values

PROP_USE_COMPOSITES

public static final java.lang.String PROP_USE_COMPOSITES
Controls whether we generate composites or CI units when no context is given during a lookup.

See Also:
Constant Field Values

PROP_USE_COMPOSITES_DEFAULT

public static final boolean PROP_USE_COMPOSITES_DEFAULT
The default value of PROP_USE_COMPOSITES.

See Also:
Constant Field Values
Constructor Detail

Model

public Model()
Method Detail

register

public void register(java.lang.String name,
                     Registry registry)
              throws PropertyException
Description copied from interface: Configurable
Register my properties. This method is called once early in the time of the component, shortly after the component is constructed. This component should register any configuration properties that it needs to register. If this configurable extends another configurable, super.register should also be called

Specified by:
register in interface Configurable
Parameters:
name - the name of the component
registry - the registry for this component
Throws:
PropertyException

newProperties

public void newProperties(PropertySheet ps)
                   throws PropertyException
Description copied from interface: Configurable
This method is called when this configurable component has new data. The component should first validate the data. If it is bad the component should return false. If the data is good, the component should record the the data internally and return true.

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.

allocate

public void allocate()
              throws java.io.IOException
initialize this acoustic model with the given name and context.

Specified by:
allocate in interface AcousticModel
Throws:
java.io.IOException - if the model could not be loaded

deallocate

public void deallocate()
Description copied from interface: AcousticModel
Deallocates previously allcoated resources

Specified by:
deallocate in interface AcousticModel

getName

public java.lang.String getName()
Returns the name of this AcousticModel, or null if it has no name.

Specified by:
getName in interface AcousticModel
Returns:
the name of this AcousticModel, or null if it has no name

lookupNearestHMM

public HMM lookupNearestHMM(Unit unit,
                            HMMPosition position,
                            boolean exactMatch)
Given a unit, returns the HMM that best matches the given unit. If exactMatch is false and an exact match is not found, then different word positions are used. If any of the contexts are non-silence filler units. a silence filler unit is tried instead.

Specified by:
lookupNearestHMM in interface AcousticModel
Parameters:
unit - the unit of interest
position - the position of the unit of interest
exactMatch - if true, only an exact match is acceptable.
Returns:
the HMM that best matches, or null if no match could be found.

getHMMIterator

public java.util.Iterator getHMMIterator()
Returns an iterator that can be used to iterate through all the HMMs of the acoustic model

Specified by:
getHMMIterator in interface AcousticModel
Returns:
an iterator that can be used to iterate through all HMMs in the model. The iterator returns objects of type HMM.

getContextIndependentUnitIterator

public java.util.Iterator getContextIndependentUnitIterator()
Returns an iterator that can be used to iterate through all the CI units in the acoustic model

Specified by:
getContextIndependentUnitIterator in interface AcousticModel
Returns:
an iterator that can be used to iterate through all CI units. The iterator returns objects of type Unit

getCompositeSenoneSequence

public SenoneSequence getCompositeSenoneSequence(Unit unit,
                                                 HMMPosition position)
Get a composite senone sequence given the unit The unit should have a LeftRightContext, where one or two of 'left' or 'right' may be null to indicate that the match should succeed on any context.

Parameters:
unit - the unit

getLeftContextSize

public int getLeftContextSize()
Returns the size of the left context for context dependent units

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

getRightContextSize

public int getRightContextSize()
Returns the size of the right context for context dependent units

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

getProperties

public java.util.Properties getProperties()
Returns the properties of this acoustic model.

Specified by:
getProperties in interface AcousticModel
Returns:
the properties of this acoustic model