edu.cmu.sphinx.linguist.dflat
Class DynamicFlatLinguist

java.lang.Object
  extended by edu.cmu.sphinx.linguist.dflat.DynamicFlatLinguist
All Implemented Interfaces:
Linguist, Configurable

public class DynamicFlatLinguist
extends java.lang.Object
implements Linguist, Configurable

A simple form of the linguist. It makes the following simplifying assumptions: 1) Zero or one word per grammar node 2) No fan-in allowed ever 3) No composites (yet) 4) Only Unit, HMMState, and pronunciation states (and the initial/final grammar state are in the graph (no word, alternative or grammar states attached). 5) Only valid tranisitions (matching contexts) are allowed 6) No tree organization of units 7) Branching grammar states are allowed

This is a dynamic version of the flat linguist that is more efficient in terms of startup time and overall footprint

Note that all probabilties are maintained in the log math domain


Field Summary
static java.lang.String ACOUSTIC_MODEL
          A sphinx property used to define the acoustic model to use when building the search graph
static java.lang.String ADD_OUT_OF_GRAMMAR_BRANCH
          Sphinx property that specifies whether to add a branch for detecting out-of-grammar utterances.
static java.lang.String GRAMMAR
          A sphinx property used to define the grammar to use when building the search graph
static java.lang.String OUT_OF_GRAMMAR_PROBABILITY
          Sphinx property for the probability of entering the out-of-grammar branch.
static java.lang.String PHONE_INSERTION_PROBABILITY
          Sphinx property for the probability of inserting a CI phone in the out-of-grammar ci phone loop
static java.lang.String PHONE_LOOP_ACOUSTIC_MODEL
          Sphinx property for the acoustic model to use to build the phone loop that detects out of grammar utterances.
static java.lang.String PROP_LOG_MATH
          Sphinx property that defines the name of the logmath to be used by this search manager.
static java.lang.String UNIT_MANAGER
          A sphinx property used to define the unit manager to use when building the search graph
 
Fields inherited from interface edu.cmu.sphinx.linguist.Linguist
PROP_FILLER_INSERTION_PROBABILITY, PROP_LANGUAGE_WEIGHT, PROP_SILENCE_INSERTION_PROBABILITY, PROP_UNIT_INSERTION_PROBABILITY, PROP_WORD_INSERTION_PROBABILITY
 
Constructor Summary
DynamicFlatLinguist()
           
 
Method Summary
 void allocate()
          Allocates the linguist.
 void deallocate()
          Deallocates the linguist.
 LogMath getLogMath()
          Returns the LogMath used.
 float getLogSilenceInsertionProbability()
          Returns the log silence insertion probability.
 SearchGraph getSearchGraph()
          Returns the search graph
 void newProperties(PropertySheet ps)
          This method is called when this configurable component needs to be reconfigured.
 void startRecognition()
          Called before a recognition
 void stopRecognition()
          Called after a recognition
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GRAMMAR

@S4Component(type=Grammar.class)
public static final java.lang.String GRAMMAR
A sphinx property used to define the grammar to use when building the search graph

See Also:
Constant Field Values

UNIT_MANAGER

@S4Component(type=UnitManager.class)
public static final java.lang.String UNIT_MANAGER
A sphinx property used to define the unit manager to use when building the search graph

See Also:
Constant Field Values

ACOUSTIC_MODEL

@S4Component(type=AcousticModel.class)
public static final java.lang.String ACOUSTIC_MODEL
A sphinx property used to define the acoustic model to use when building the search graph

See Also:
Constant Field Values

ADD_OUT_OF_GRAMMAR_BRANCH

@S4Boolean(defaultValue=false)
public static final java.lang.String ADD_OUT_OF_GRAMMAR_BRANCH
Sphinx property that specifies whether to add a branch for detecting out-of-grammar utterances.

See Also:
Constant Field Values

OUT_OF_GRAMMAR_PROBABILITY

@S4Double(defaultValue=1.0)
public static final java.lang.String OUT_OF_GRAMMAR_PROBABILITY
Sphinx property for the probability of entering the out-of-grammar branch.

See Also:
Constant Field Values

PHONE_INSERTION_PROBABILITY

@S4Double(defaultValue=1.0)
public static final java.lang.String PHONE_INSERTION_PROBABILITY
Sphinx property for the probability of inserting a CI phone in the out-of-grammar ci phone loop

See Also:
Constant Field Values

PHONE_LOOP_ACOUSTIC_MODEL

@S4Component(type=AcousticModel.class)
public static final java.lang.String PHONE_LOOP_ACOUSTIC_MODEL
Sphinx property for the acoustic model to use to build the phone loop that detects out of grammar utterances.

See Also:
Constant Field Values

PROP_LOG_MATH

@S4Component(type=LogMath.class)
public static final java.lang.String PROP_LOG_MATH
Sphinx property that defines the name of the logmath to be used by this search manager.

See Also:
Constant Field Values
Constructor Detail

DynamicFlatLinguist

public DynamicFlatLinguist()
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.

getSearchGraph

public SearchGraph getSearchGraph()
Returns the search graph

Specified by:
getSearchGraph in interface Linguist
Returns:
the search graph

allocate

public void allocate()
              throws java.io.IOException
Description copied from interface: Linguist
Allocates the linguist. Resources allocated by the linguist are allocated here. This method may take many seconds to complete depending upon the linguist.

Implementor's Note - A well written linguist will allow allocate to be called multiple times without harm. This will allow a linguist to be shared by multiple search managers.

Specified by:
allocate in interface Linguist
Throws:
java.io.IOException - if an IO error occurs

deallocate

public void deallocate()
Description copied from interface: Linguist
Deallocates the linguist. Any resources allocated by this linguist are released.

Implementor's Note - if the linguist is being shared by multiple searches, the deallocate should only actually deallocate things when the last call to deallocate is made. Two approaches for dealing with this:

(1) Keep an allocation counter that is incremented during allocate and decremented during deallocate. Only when the counter reaches zero should the actually deallocation be performed.

(2) Do nothing in dellocate - just the the GC take care of things

Specified by:
deallocate in interface Linguist

startRecognition

public void startRecognition()
Called before a recognition

Specified by:
startRecognition in interface Linguist

stopRecognition

public void stopRecognition()
Called after a recognition

Specified by:
stopRecognition in interface Linguist

getLogMath

public LogMath getLogMath()
Returns the LogMath used.

Returns:
the logMath used

getLogSilenceInsertionProbability

public float getLogSilenceInsertionProbability()
Returns the log silence insertion probability.

Returns:
the log silence insertion probability.