|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Linguist
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_FILLER_INSERTION_PROBABILITY
Filler insertion probability property |
static java.lang.String |
PROP_LANGUAGE_WEIGHT
Sphinx property that defines the language weight for the search |
static java.lang.String |
PROP_SILENCE_INSERTION_PROBABILITY
Silence insertion probability property |
static java.lang.String |
PROP_UNIT_INSERTION_PROBABILITY
Unit insertion probability property |
static java.lang.String |
PROP_WORD_INSERTION_PROBABILITY
Word insertion probability property |
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 |
---|
newProperties |
Field Detail |
---|
@S4Double(defaultValue=1.0) static final java.lang.String PROP_WORD_INSERTION_PROBABILITY
@S4Double(defaultValue=1.0) static final java.lang.String PROP_UNIT_INSERTION_PROBABILITY
@S4Double(defaultValue=1.0) static final java.lang.String PROP_SILENCE_INSERTION_PROBABILITY
@S4Double(defaultValue=1.0) static final java.lang.String PROP_FILLER_INSERTION_PROBABILITY
@S4Double(defaultValue=1.0) static final java.lang.String PROP_LANGUAGE_WEIGHT
Method Detail |
---|
SearchGraph getSearchGraph()
void startRecognition()
void stopRecognition()
void allocate() throws java.io.IOException
java.io.IOException
- if an IO error occursvoid deallocate()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |