edu.cmu.sphinx.linguist.flat
Class FlatLinguist

java.lang.Object
  extended byedu.cmu.sphinx.linguist.flat.FlatLinguist
All Implemented Interfaces:
Configurable, Linguist
Direct Known Subclasses:
ParallelSimpleLinguist

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

A simple form of the linguist. The flat linguist takes a Grammar graph (as returned by the underlying, configurable grammar), and generates a search graph for this grammar. It makes the following simplifying assumptions:

Note that all probabilties are maintained in the log math domain


Field Summary
static java.lang.String PROP_ACOUSTIC_MODEL
          A sphinx property used to define the acoustic model to use when building the search graph
static java.lang.String PROP_ADD_OUT_OF_GRAMMAR_BRANCH
          Sphinx property that specifies whether to add a branch for detecting out-of-grammar utterances.
static boolean PROP_ADD_OUT_OF_GRAMMAR_BRANCH_DEFAULT
          Default value of PROP_ADD_OUT_OF_GRAMMAR_BRANCH.
static java.lang.String PROP_DUMP_GSTATES
          Sphinx property used to determine whether or not the gstates are dumped.
static boolean PROP_DUMP_GSTATES_DEFAULT
          The default value for the PROP_DUMP_GSTATES property
static java.lang.String PROP_GRAMMAR
          A sphinx property used to define the grammar to use when building the search graph
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 PROP_OUT_OF_GRAMMAR_PROBABILITY
          Sphinx property for the probability of entering the out-of-grammar branch.
static double PROP_OUT_OF_GRAMMAR_PROBABILITY_DEFAULT
          The default value for PROP_OUT_OF_GRAMMAR_PROBABILITY.
static java.lang.String PROP_PHONE_INSERTION_PROBABILITY
          Sphinx property for the probability of inserting a CI phone in the out-of-grammar ci phone loop
static double PROP_PHONE_INSERTION_PROBABILITY_DEFAULT
          Default value for PROP_PHONE_INSERTION_PROBABILITY
static java.lang.String PROP_PHONE_LOOP_ACOUSTIC_MODEL
          Sphinx property for the acoustic model used for the CI phone loop.
static java.lang.String PROP_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_ADD_FILLER_WORDS, PROP_ADD_FILLER_WORDS_DEFAULT, PROP_COMPOSITE_THRESHOLD, PROP_COMPOSITE_THRESHOLD_DEFAULT, PROP_FILLER_INSERTION_PROBABILITY, PROP_FILLER_INSERTION_PROBABILITY_DEFAULT, PROP_GENERATE_UNIT_STATES, PROP_GENERATE_UNIT_STATES_DEFAULT, PROP_LANGUAGE_WEIGHT, PROP_LANGUAGE_WEIGHT_DEFAULT, PROP_SHOW_COMPILATION_PROGRESS, PROP_SHOW_COMPILATION_PROGRESS_DEFAULT, PROP_SHOW_SEARCH_SPACE, PROP_SHOW_SEARCH_SPACE_DEFAULT, PROP_SILENCE_INSERTION_PROBABILITY, PROP_SILENCE_INSERTION_PROBABILITY_DEFAULT, PROP_SPREAD_WORD_PROBABILITIES_ACROSS_PRONUNCIATIONS, PROP_SPREAD_WORD_PROBABILITIES_ACROSS_PRONUNCIATIONS_DEFAULT, PROP_UNIGRAM_SMEAR_WEIGHT, PROP_UNIGRAM_SMEAR_WEIGHT_DEFAULT, PROP_UNIT_INSERTION_PROBABILITY, PROP_UNIT_INSERTION_PROBABILITY_DEFAULT, PROP_VALIDATE_SEARCH_SPACE, PROP_VALIDATE_SEARCH_SPACE_DEFAULT, PROP_WANT_UNIGRAM_SMEAR, PROP_WANT_UNIGRAM_SMEAR_DEFAULT, PROP_WORD_INSERTION_PROBABILITY, PROP_WORD_INSERTION_PROBABILITY_DEFAULT
 
Constructor Summary
FlatLinguist()
           
 
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.
 java.lang.String getName()
          Retrieves the name for this configurable component
 SearchGraph getSearchGraph()
          Returns the search graph
 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.
 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

PROP_GRAMMAR

public static final java.lang.String PROP_GRAMMAR
A sphinx property used to define the grammar to use when building the search graph

See Also:
Constant Field Values

PROP_UNIT_MANAGER

public static final java.lang.String PROP_UNIT_MANAGER
A sphinx property used to define the unit manager to use when building the search graph

See Also:
Constant Field Values

PROP_ACOUSTIC_MODEL

public static final java.lang.String PROP_ACOUSTIC_MODEL
A sphinx property used to define the acoustic model to use when building the search graph

See Also:
Constant Field Values

PROP_LOG_MATH

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

PROP_DUMP_GSTATES

public static final java.lang.String PROP_DUMP_GSTATES
Sphinx property used to determine whether or not the gstates are dumped.

See Also:
Constant Field Values

PROP_DUMP_GSTATES_DEFAULT

public static final boolean PROP_DUMP_GSTATES_DEFAULT
The default value for the PROP_DUMP_GSTATES property

See Also:
Constant Field Values

PROP_ADD_OUT_OF_GRAMMAR_BRANCH

public static final java.lang.String PROP_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

PROP_ADD_OUT_OF_GRAMMAR_BRANCH_DEFAULT

public static final boolean PROP_ADD_OUT_OF_GRAMMAR_BRANCH_DEFAULT
Default value of PROP_ADD_OUT_OF_GRAMMAR_BRANCH.

See Also:
Constant Field Values

PROP_OUT_OF_GRAMMAR_PROBABILITY

public static final java.lang.String PROP_OUT_OF_GRAMMAR_PROBABILITY
Sphinx property for the probability of entering the out-of-grammar branch.

See Also:
Constant Field Values

PROP_PHONE_LOOP_ACOUSTIC_MODEL

public static final java.lang.String PROP_PHONE_LOOP_ACOUSTIC_MODEL
Sphinx property for the acoustic model used for the CI phone loop.

See Also:
Constant Field Values

PROP_PHONE_INSERTION_PROBABILITY

public static final java.lang.String PROP_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

PROP_PHONE_INSERTION_PROBABILITY_DEFAULT

public static final double PROP_PHONE_INSERTION_PROBABILITY_DEFAULT
Default value for PROP_PHONE_INSERTION_PROBABILITY

See Also:
Constant Field Values

PROP_OUT_OF_GRAMMAR_PROBABILITY_DEFAULT

public static final double PROP_OUT_OF_GRAMMAR_PROBABILITY_DEFAULT
The default value for PROP_OUT_OF_GRAMMAR_PROBABILITY.

See Also:
Constant Field Values
Constructor Detail

FlatLinguist

public FlatLinguist()
Method Detail

getSearchGraph

public SearchGraph getSearchGraph()
Returns the search graph

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

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.

getName

public java.lang.String getName()
Description copied from interface: Configurable
Retrieves the name for this configurable component

Specified by:
getName in interface Configurable
Returns:
the name

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.