public class KeywordOptimizerModel extends java.lang.Object implements LanguageModel
Modifier and Type | Field and Description |
---|---|
java.util.HashMap<java.lang.String,java.lang.Float> |
keywordProbs |
static java.lang.String |
PROP_PARENT
The property that defines the parent language model.
|
PROP_DICTIONARY, PROP_LOCATION, PROP_MAX_DEPTH, PROP_UNIGRAM_WEIGHT
Constructor and Description |
---|
KeywordOptimizerModel() |
KeywordOptimizerModel(LanguageModel parent) |
Modifier and Type | Method and Description |
---|---|
void |
allocate()
Create the language model
|
void |
deallocate()
Deallocate resources allocated to this language model
|
int |
getMaxDepth()
Returns the maximum depth of the language model
|
float |
getProbability(WordSequence wordSequence)
Gets the ngram probability of the word sequence represented by the word
list
|
float |
getSmear(WordSequence wordSequence)
Gets the smear term for the given wordSequence
|
java.util.Set<java.lang.String> |
getVocabulary()
Returns the set of words in the language model.
|
void |
newProperties(PropertySheet ps)
This method is called when this configurable component needs to be reconfigured.
|
void |
onUtteranceEnd()
Called on utterance end to clear cache if needed
|
@S4Component(type=LanguageModel.class) public static final java.lang.String PROP_PARENT
public java.util.HashMap<java.lang.String,java.lang.Float> keywordProbs
public KeywordOptimizerModel(LanguageModel parent)
public KeywordOptimizerModel()
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 void allocate() throws java.io.IOException
LanguageModel
allocate
in interface LanguageModel
java.io.IOException
- if error occurrspublic void deallocate() throws java.io.IOException
LanguageModel
deallocate
in interface LanguageModel
java.io.IOException
- if error occurrspublic float getProbability(WordSequence wordSequence)
getProbability
in interface LanguageModel
wordSequence
- the word sequencepublic float getSmear(WordSequence wordSequence)
getSmear
in interface LanguageModel
wordSequence
- the word sequencepublic int getMaxDepth()
getMaxDepth
in interface LanguageModel
public java.util.Set<java.lang.String> getVocabulary()
getVocabulary
in interface LanguageModel
public void onUtteranceEnd()
LanguageModel
onUtteranceEnd
in interface LanguageModel