public class AFlatLinguist extends java.lang.Object implements Linguist, Configurable
This is a dynamic version of the flat linguist that is more efficient in terms of startup time and overall footprint
Note that all probabilities are maintained in the log math domain
Modifier and Type | Class and Description |
---|---|
class |
AFlatLinguist.GrammarState
Represents a grammar node in the search graph.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ACOUSTIC_MODEL
The property used to define the acoustic model to use when building the
search graph
|
static java.lang.String |
ADD_OUT_OF_GRAMMAR_BRANCH
The property that specifies whether to add a branch for detecting
out-of-grammar utterances.
|
static java.lang.String |
GRAMMAR
The property used to define the grammar to use when building the search
graph
|
static java.lang.String |
OUT_OF_GRAMMAR_PROBABILITY
The property for the probability of entering the out-of-grammar branch.
|
static java.lang.String |
PHONE_INSERTION_PROBABILITY
The 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
The property for the acoustic model to use to build the phone loop that
detects out of grammar utterances.
|
java.lang.Runtime |
runtime |
static java.lang.String |
UNIT_MANAGER
The property used to define the unit manager to use when building the
search graph
|
PROP_FILLER_INSERTION_PROBABILITY, PROP_LANGUAGE_WEIGHT, PROP_SILENCE_INSERTION_PROBABILITY, PROP_UNIT_INSERTION_PROBABILITY, PROP_WORD_INSERTION_PROBABILITY
Constructor and Description |
---|
AFlatLinguist() |
AFlatLinguist(AcousticModel acousticModel,
Grammar grammar,
UnitManager unitManager,
double wordInsertionProbability,
double silenceInsertionProbability,
double unitInsertionProbability,
double fillerInsertionProbability,
float languageWeight,
boolean addOutOfGrammarBranch,
double outOfGrammarBranchProbability,
double phoneInsertionProbability,
AcousticModel phoneLoopAcousticModel) |
Modifier and Type | Method and Description |
---|---|
void |
allocate()
Allocates the linguist.
|
protected void |
allocateAcousticModel()
Allocates the acoustic model.
|
void |
deallocate()
Deallocates the linguist.
|
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.
|
protected void |
setupAcousticModel(PropertySheet ps)
Sets up the acoustic model.
|
void |
startRecognition()
Called before a recognition.
|
void |
stopRecognition()
Called after a recognition.
|
@S4Component(type=Grammar.class) public static final java.lang.String GRAMMAR
@S4Component(type=UnitManager.class) public static final java.lang.String UNIT_MANAGER
@S4Component(type=AcousticModel.class) public static final java.lang.String ACOUSTIC_MODEL
@S4Boolean(defaultValue=false) public static final java.lang.String ADD_OUT_OF_GRAMMAR_BRANCH
@S4Double(defaultValue=1.0) public static final java.lang.String OUT_OF_GRAMMAR_PROBABILITY
@S4Double(defaultValue=1.0) public static final java.lang.String PHONE_INSERTION_PROBABILITY
@S4Component(type=AcousticModel.class) public static final java.lang.String PHONE_LOOP_ACOUSTIC_MODEL
public java.lang.Runtime runtime
public AFlatLinguist(AcousticModel acousticModel, Grammar grammar, UnitManager unitManager, double wordInsertionProbability, double silenceInsertionProbability, double unitInsertionProbability, double fillerInsertionProbability, float languageWeight, boolean addOutOfGrammarBranch, double outOfGrammarBranchProbability, double phoneInsertionProbability, AcousticModel phoneLoopAcousticModel)
public AFlatLinguist()
public void newProperties(PropertySheet ps) throws PropertyException
Configurable
newProperties
in interface Configurable
ps
- a property sheet holding the new dataPropertyException
- if there is a problem with the properties.public SearchGraph getSearchGraph()
getSearchGraph
in interface Linguist
protected void setupAcousticModel(PropertySheet ps) throws PropertyException
ps
- the PropertySheet from which to obtain the acoustic modelPropertyException
- something went wrongpublic void allocate() throws java.io.IOException
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.
protected void allocateAcousticModel() throws java.io.IOException
java.io.IOException
- loading failedpublic void deallocate()
Linguist
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
deallocate
in interface Linguist
public float getLogSilenceInsertionProbability()
public void startRecognition()
Linguist
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.
startRecognition
in interface Linguist
public void stopRecognition()
Linguist
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.
stopRecognition
in interface Linguist