edu.cmu.sphinx.linguist.flat
Class FlatLinguist

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

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_SHOW_COMPILATION_PROGRESS
          Property to control whether compilation progress is displayed on stdout.
static java.lang.String PROP_SPREAD_WORD_PROBABILITIES_ACROSS_PRONUNCIATIONS
          Property that controls whether word probabilities are spread across all pronunciations.
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_FILLER_INSERTION_PROBABILITY, PROP_LANGUAGE_WEIGHT, PROP_SILENCE_INSERTION_PROBABILITY, PROP_UNIT_INSERTION_PROBABILITY, PROP_WORD_INSERTION_PROBABILITY
 
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()
           
 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

PROP_GRAMMAR

@S4Component(type=Grammar.class)
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

@S4Component(type=UnitManager.class)
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

@S4Component(type=AcousticModel.class)
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

@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

PROP_DUMP_GSTATES

@S4Boolean(defaultValue=false)
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

@S4Boolean(defaultValue=false)
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

@S4Double(defaultValue=1.0)
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

@S4Component(type=AcousticModel.class)
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

@S4Double(defaultValue=1.0)
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_SHOW_COMPILATION_PROGRESS

@S4Boolean(defaultValue=false)
public static final java.lang.String PROP_SHOW_COMPILATION_PROGRESS
Property to control whether compilation progress is displayed on stdout. If this property is true, a 'dot' is displayed for every 1000 search states added to the search space

See Also:
Constant Field Values

PROP_SPREAD_WORD_PROBABILITIES_ACROSS_PRONUNCIATIONS

@S4Boolean(defaultValue=false)
public static final java.lang.String PROP_SPREAD_WORD_PROBABILITIES_ACROSS_PRONUNCIATIONS
Property that controls whether word probabilities are spread across all pronunciations.

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

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()

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.