edu.cmu.sphinx.linguist.acoustic.trivial
Class TrivialAcousticModel

java.lang.Object
  extended byedu.cmu.sphinx.linguist.acoustic.trivial.TrivialAcousticModel
All Implemented Interfaces:
AcousticModel

public class TrivialAcousticModel
extends java.lang.Object
implements AcousticModel

Represents the generic interface to the Acoustic Model for sphinx4


Field Summary
static java.lang.String PROP_LEFT_CONTEXT_SIZE
          Sphinx property that defines the left context size
static int PROP_LEFT_CONTEXT_SIZE_DEFAULT
          The default value for PROP_LEFT_CONTEXT_SIZE
static java.lang.String PROP_RIGHT_CONTEXT_SIZE
          Sphinx property that defines the right context size
static int PROP_RIGHT_CONTEXT_SIZE_DEFAULT
          The default value for PROP_RIGHT_CONTEXT_SIZE
 
Fields inherited from interface edu.cmu.sphinx.linguist.acoustic.AcousticModel
PROP_LOCATION, PROP_LOCATION_DEFAULT
 
Constructor Summary
TrivialAcousticModel()
           
 
Method Summary
 void allocate()
          Gets this acoustic model ready to use, allocating all necessary resources.
 void deallocate()
          Deallocates previously allcoated resources
 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
 void initialize(java.lang.String name, java.lang.String context)
          Initializes this acoustic model
 HMM lookupNearestHMM(Unit unit, HMMPosition position, boolean exactMatch)
          Given a unit, returns the HMM that best matches the given unit.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROP_LEFT_CONTEXT_SIZE

public static final java.lang.String PROP_LEFT_CONTEXT_SIZE
Sphinx property that defines the left context size

See Also:
Constant Field Values

PROP_LEFT_CONTEXT_SIZE_DEFAULT

public static final int PROP_LEFT_CONTEXT_SIZE_DEFAULT
The default value for PROP_LEFT_CONTEXT_SIZE

See Also:
Constant Field Values

PROP_RIGHT_CONTEXT_SIZE

public static final java.lang.String PROP_RIGHT_CONTEXT_SIZE
Sphinx property that defines the right context size

See Also:
Constant Field Values

PROP_RIGHT_CONTEXT_SIZE_DEFAULT

public static final int PROP_RIGHT_CONTEXT_SIZE_DEFAULT
The default value for PROP_RIGHT_CONTEXT_SIZE

See Also:
Constant Field Values
Constructor Detail

TrivialAcousticModel

public TrivialAcousticModel()
Method Detail

initialize

public void initialize(java.lang.String name,
                       java.lang.String context)
                throws java.io.IOException
Initializes this acoustic model

Parameters:
name - the name of this acoustic model
context - the context for this acoustic model
Throws:
java.io.IOException - if the model could not be loaded

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

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

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

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

allocate

public void allocate()
              throws java.io.IOException
Description copied from interface: AcousticModel
Gets this acoustic model ready to use, allocating all necessary resources.

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