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

java.lang.Object
  extended by edu.cmu.sphinx.linguist.acoustic.trivial.TrivialAcousticModel
All Implemented Interfaces:
AcousticModel, Configurable

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 LEFT_CONTEXT_SIZE
          Sphinx property that defines the left context size
static java.lang.String 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<Unit> 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 needs to be reconfigured.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LEFT_CONTEXT_SIZE

@S4Integer(defaultValue=1)
public static final java.lang.String LEFT_CONTEXT_SIZE
Sphinx property that defines the left context size

See Also:
Constant Field Values

RIGHT_CONTEXT_SIZE

@S4Integer(defaultValue=1)
public static final java.lang.String RIGHT_CONTEXT_SIZE
See Also:
Constant Field Values
Constructor Detail

TrivialAcousticModel

public TrivialAcousticModel()
Method Detail

newProperties

public void newProperties(PropertySheet ps)
                   throws PropertyException
Description copied from interface: Configurable
This method is called when this configurable component needs to be reconfigured.

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.

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<Unit> 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