public class InterpolatedLanguageModel extends java.lang.Object implements LanguageModel
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
PROP_LANGUAGE_MODEL_WEIGHTS
The property that defines the language models weights
|
static java.lang.String |
PROP_LANGUAGE_MODELS
The property that defines the language models to be interpolated.
|
PROP_DICTIONARY, PROP_LOCATION, PROP_MAX_DEPTH, PROP_UNIGRAM_WEIGHT| Constructor and Description |
|---|
InterpolatedLanguageModel() |
InterpolatedLanguageModel(java.util.List<LanguageModel> languageModels,
float[] floats) |
| 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)
Calculates probability p = w[1]*p[1] + w[2]*p[2] + ...
|
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
|
@S4ComponentList(type=LanguageModel.class) public static final java.lang.String PROP_LANGUAGE_MODELS
@S4StringList public static final java.lang.String PROP_LANGUAGE_MODEL_WEIGHTS
public InterpolatedLanguageModel(java.util.List<LanguageModel> languageModels, float[] floats)
public InterpolatedLanguageModel()
public void newProperties(PropertySheet ps) throws PropertyException
ConfigurablenewProperties in interface Configurableps - a property sheet holding the new dataPropertyException - if there is a problem with the properties.public void allocate()
throws java.io.IOException
LanguageModelallocate in interface LanguageModeljava.io.IOException - if error occurrspublic void deallocate()
throws java.io.IOException
LanguageModeldeallocate in interface LanguageModeljava.io.IOException - if error occurrspublic float getProbability(WordSequence wordSequence)
getProbability in interface LanguageModelwordSequence - the wordSequenceLanguageModel.getProbability(edu.cmu.sphinx.linguist.WordSequence)public float getSmear(WordSequence wordSequence)
LanguageModelLexTreeLinguist. See
LexTreeLinguist.PROP_WANT_UNIGRAM_SMEAR for details.getSmear in interface LanguageModelwordSequence - the word sequencepublic java.util.Set<java.lang.String> getVocabulary()
LanguageModelgetVocabulary in interface LanguageModelpublic int getMaxDepth()
LanguageModelgetMaxDepth in interface LanguageModelpublic void onUtteranceEnd()
LanguageModelonUtteranceEnd in interface LanguageModel