|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The linguist is responsible for representing and managing the search space
for the decoder. The role of the linguist is to provide, upon request,
the search graph that is to be used by the decoder. The linguist is a
generic interface that provides language model services.
The main role of any linguist is to
represent the search space for the decoder. The search
space can be retrieved by a SearchManager via a call to
getSearchGraph
.
This method returns a SearchGraph. The initial state in the search
graph can be retrieved via a call to getInitialState
Successor states can be retrieved via
calls to SearchState.getSuccessors().
. There are a number of
search state subinterfaces that are used to indicate different types of
states in the search space:
SearchGraph.getNumStateOrder()
can be used to
retrieve the number of state types that will be returned by the
linguist. The method SearchState.getOrder()
returns
the ranking for a particular state.
Depending on the vocabulary size and topology, the search space represented
by the linguist may include a very large number of states. Some linguists
will generate the search states dynamically, that is, the object
representing a particular state in the search space is not created until it
is needed by the SearchManager. SearchManagers often need to be able to
determine if a particular state has been entered before by comparing states.
Because SearchStates may be generated dynamically, the SearchState.equals()
call (as opposed to the reference equals '==' method) should be used to
determine if states are equal. The states returned by the linguist will
generally provide very efficient implementations of equals
and hashCode
. This will allow a SearchManager to maintain
collections of states in HashMaps efficiently.
The lifecycle of a linguist is as follows:
register
method.
newProperties
call. A well written linguist should be
prepared to respond to newProperties
call at any time.
allocate
method is called. During this call
the linguist generally allocates resources such as acoustic and
language models. This can often take a significant amount of time.
A well-written linguist will be able to deal with multiple calls to
allocate
. This can happen if a linguist is shared by
multiple search managers.
getSearchGraph
method is called by the search
to retrieve the search graph that is used to guide the
decoding/search. This method is typically called at the beginning
of each recognition. The linguist should endeavor to return the
search graph as quickly as possible to reduce any recognition
latency. Some linguists will pre-generate the search graph in the
allocate
method, and only need to return a reference
to the search graph, while other linguists may dynamically generate
the search graph on each call. Also note that some linguists may
change the search graph between calls so a search manager should
always get a new search graph before the start of each recognition.
startRecognition
method is called just before
recognition starts. This gives the linguist the opportunity to
prepare for the recognition task. Some linguists may keep caches
of search states that need to be primed or flushed. Note however
that if a linguist depends on startRecognition
or
stopRecognition
it is likely to not be a reentrant
linguist which could limit its usefulness in some multi-threaded
environments.
stopRecognition
method is called just after
recognition completes. This gives the linguist the opportunity to
cleanup after the recognition task. Some linguists may keep caches
of search states that need to be primed or flushed. Note however
that if a linguist depends on startRecognition
or
stopRecognition
it is likely to not be a reentrant
linguist which could limit its usefulness in some multi-threaded
environments.
Field Summary | |
static java.lang.String |
PROP_ADD_FILLER_WORDS
Property that controls whether filler words are automatically added to the vocabulary |
static boolean |
PROP_ADD_FILLER_WORDS_DEFAULT
The default value for PROP_ADD_FILLER_WORDS. |
static java.lang.String |
PROP_COMPOSITE_THRESHOLD
Property to control the maximum number of right contexts to consider before switching over to using composite hmms |
static int |
PROP_COMPOSITE_THRESHOLD_DEFAULT
The default value for PROP_COMPOSITE_THRESHOLD. |
static java.lang.String |
PROP_FILLER_INSERTION_PROBABILITY
Filler insertion probability property |
static double |
PROP_FILLER_INSERTION_PROBABILITY_DEFAULT
The default value for PROP_FILLER_INSERTION_PROBABILITY. |
static java.lang.String |
PROP_GENERATE_UNIT_STATES
Property to control whether or not the linguist will generate unit states. |
static boolean |
PROP_GENERATE_UNIT_STATES_DEFAULT
The default value for PROP_GENERATE_UNIT_STATES |
static java.lang.String |
PROP_LANGUAGE_WEIGHT
Sphinx property that defines the language weight for the search |
static float |
PROP_LANGUAGE_WEIGHT_DEFAULT
The default value for the PROP_LANGUAGE_WEIGHT property |
static java.lang.String |
PROP_SHOW_COMPILATION_PROGRESS
Property to control whether compilation progress is displayed on stdout. |
static boolean |
PROP_SHOW_COMPILATION_PROGRESS_DEFAULT
The default value for PROP_SHOW_COMPILATION_PROGRESS. |
static java.lang.String |
PROP_SHOW_SEARCH_SPACE
Property to control the the dumping of the search space |
static boolean |
PROP_SHOW_SEARCH_SPACE_DEFAULT
The default value for PROP_SHOW_SEARCH_SPACE. |
static java.lang.String |
PROP_SILENCE_INSERTION_PROBABILITY
Silence insertion probability property |
static double |
PROP_SILENCE_INSERTION_PROBABILITY_DEFAULT
The default value for PROP_SILENCE_INSERTION_PROBABILITY. |
static java.lang.String |
PROP_SPREAD_WORD_PROBABILITIES_ACROSS_PRONUNCIATIONS
Property that controls whether word probabilities are spread across all pronunciations. |
static boolean |
PROP_SPREAD_WORD_PROBABILITIES_ACROSS_PRONUNCIATIONS_DEFAULT
The default value for PROP_SPREAD_WORD_PROBABILTIES_ACROSS_PRONUNCIATIONS. |
static java.lang.String |
PROP_UNIGRAM_SMEAR_WEIGHT
A sphinx property that determines the weight of the smear |
static float |
PROP_UNIGRAM_SMEAR_WEIGHT_DEFAULT
The default value for PROP_UNIGRAM_SMEAR_WEIGHT |
static java.lang.String |
PROP_UNIT_INSERTION_PROBABILITY
Unit insertion probability property |
static double |
PROP_UNIT_INSERTION_PROBABILITY_DEFAULT
The default value for PROP_UNIT_INSERTION_PROBABILITY. |
static java.lang.String |
PROP_VALIDATE_SEARCH_SPACE
Property to control the the validating of the search space |
static boolean |
PROP_VALIDATE_SEARCH_SPACE_DEFAULT
The default value for PROP_VALIDATE_SEARCH_SPACE. |
static java.lang.String |
PROP_WANT_UNIGRAM_SMEAR
A sphinx property that determines whether or not unigram probabilities are smeared through the lex tree |
static boolean |
PROP_WANT_UNIGRAM_SMEAR_DEFAULT
The default value for PROP_WANT_UNIGRAM_SMEAR |
static java.lang.String |
PROP_WORD_INSERTION_PROBABILITY
Word insertion probability property |
static double |
PROP_WORD_INSERTION_PROBABILITY_DEFAULT
The default value for PROP_WORD_INSERTION_PROBABILITY |
Method Summary | |
void |
allocate()
Allocates the linguist. |
void |
deallocate()
Deallocates the linguist. |
SearchGraph |
getSearchGraph()
Retrieves search graph. |
void |
startRecognition()
Called before a recognition. |
void |
stopRecognition()
Called after a recognition. |
Methods inherited from interface edu.cmu.sphinx.util.props.Configurable |
getName, newProperties, register |
Field Detail |
public static final java.lang.String PROP_WORD_INSERTION_PROBABILITY
public static final double PROP_WORD_INSERTION_PROBABILITY_DEFAULT
public static final java.lang.String PROP_UNIT_INSERTION_PROBABILITY
public static final double PROP_UNIT_INSERTION_PROBABILITY_DEFAULT
public static final java.lang.String PROP_SILENCE_INSERTION_PROBABILITY
public static final double PROP_SILENCE_INSERTION_PROBABILITY_DEFAULT
public static final java.lang.String PROP_FILLER_INSERTION_PROBABILITY
public static final double PROP_FILLER_INSERTION_PROBABILITY_DEFAULT
public static final java.lang.String PROP_LANGUAGE_WEIGHT
public static final float PROP_LANGUAGE_WEIGHT_DEFAULT
public static final java.lang.String PROP_COMPOSITE_THRESHOLD
public static final int PROP_COMPOSITE_THRESHOLD_DEFAULT
public static final java.lang.String PROP_SPREAD_WORD_PROBABILITIES_ACROSS_PRONUNCIATIONS
public static final boolean PROP_SPREAD_WORD_PROBABILITIES_ACROSS_PRONUNCIATIONS_DEFAULT
public static final java.lang.String PROP_ADD_FILLER_WORDS
public static final boolean PROP_ADD_FILLER_WORDS_DEFAULT
public static final java.lang.String PROP_SHOW_SEARCH_SPACE
public static final boolean PROP_SHOW_SEARCH_SPACE_DEFAULT
public static final java.lang.String PROP_VALIDATE_SEARCH_SPACE
public static final boolean PROP_VALIDATE_SEARCH_SPACE_DEFAULT
public static final java.lang.String PROP_SHOW_COMPILATION_PROGRESS
public static final boolean PROP_SHOW_COMPILATION_PROGRESS_DEFAULT
public static final java.lang.String PROP_GENERATE_UNIT_STATES
public static final boolean PROP_GENERATE_UNIT_STATES_DEFAULT
public static final java.lang.String PROP_WANT_UNIGRAM_SMEAR
public static final boolean PROP_WANT_UNIGRAM_SMEAR_DEFAULT
public static final java.lang.String PROP_UNIGRAM_SMEAR_WEIGHT
public static final float PROP_UNIGRAM_SMEAR_WEIGHT_DEFAULT
Method Detail |
public SearchGraph getSearchGraph()
Implementor's note: This method is typically called at the beginning of each recognition and therefore should be
public void startRecognition()
Implementor's Note - Some linguists (or underlying lanaguge or acoustic models) may keep caches or pools that need to be initialzed before a recognition. A linguist may implement this method to perform such initialization. Note however, that an ideal linguist will, once allocated, be state-less. This will allow the linguist to be shared by multiple simulataneous searches. Reliance on a 'startRecognition' may prevent a linguist from being used in a multi-threaded search.
public void stopRecognition()
Implementor's Note - Some linguists (or underlying lanaguge or acoustic models) may keep caches or pools that need to be flushed after a recognition. A linguist may implement this method to perform such flushing. Note however, that an ideal linguist will once allocated, be state-less. This will allow the linguist to be shared by multiple simulataneous searches. Reliance on a 'stopRecognition' may prevent a linguist from being used in a multi-threaded search.
public void allocate() throws java.io.IOException
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.
java.io.IOException
- if an IO error occurspublic void deallocate()
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
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |