public interface LanguageModel extends Configurable
Note that all probabilities are in LogMath log base, except as otherwise noted.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
PROP_DICTIONARY
The property specifying the dictionary to use
|
static java.lang.String |
PROP_LOCATION
The property specifying the location of the language model.
|
static java.lang.String |
PROP_MAX_DEPTH
The property specifying the maximum depth reported by the language model
(from a getMaxDepth()) call.
|
static java.lang.String |
PROP_UNIGRAM_WEIGHT
The property specifying the unigram weight
|
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 n-gram 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 |
onUtteranceEnd()
Called on utterance end to clear cache if needed
|
newProperties
@S4String(defaultValue=".") static final java.lang.String PROP_LOCATION
@S4Double(defaultValue=1.0) static final java.lang.String PROP_UNIGRAM_WEIGHT
@S4Integer(defaultValue=-1) static final java.lang.String PROP_MAX_DEPTH
@S4Component(type=Dictionary.class) static final java.lang.String PROP_DICTIONARY
void allocate() throws java.io.IOException
java.io.IOException
- if error occurrsvoid deallocate() throws java.io.IOException
java.io.IOException
- if error occurrsfloat getProbability(WordSequence wordSequence)
wordSequence
- the wordSequencefloat getSmear(WordSequence wordSequence)
LexTreeLinguist
. See
LexTreeLinguist.PROP_WANT_UNIGRAM_SMEAR
for details.wordSequence
- the word sequencejava.util.Set<java.lang.String> getVocabulary()
int getMaxDepth()
void onUtteranceEnd()