edu.cmu.sphinx.linguist.language.ngram
Interface LanguageModel

All Superinterfaces:
Configurable
All Known Implementing Classes:
LargeTrigramModel, SimpleNGramModel

public interface LanguageModel
extends Configurable

Represents the generic interface to an N-Gram language model.

Note that all probabilities are in LogMath log base, except as otherwise noted.


Field Summary
static java.lang.String PROP_DICTIONARY
          The Sphinx Property specifying the dictionary to use
static java.lang.String PROP_FORMAT
          The SphinxProperty specifying the format of the language model.
static java.lang.String PROP_FORMAT_DEFAULT
          The default value of PROP_FORMAT.
static java.lang.String PROP_LOCATION
          The Sphinx Property specifying the location of the language model.
static java.lang.String PROP_LOCATION_DEFAULT
          The default value of PROP_LOCATION.
static java.lang.String PROP_MAX_DEPTH
          The Sphinx Property specifying the maximum depth reported by the language model (from a getMaxDepth()) call.
static int PROP_MAX_DEPTH_DEFAULT
          The default value for PROP_MAX_DEPTH.
static java.lang.String PROP_UNIGRAM_WEIGHT
          The Sphinx Property specifying the unigram weight
static float PROP_UNIGRAM_WEIGHT_DEFAULT
          The default value for PROP_UNIGRAM_WEIGHT
 
Method Summary
 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 getVocabulary()
          Returns the set of words in the lanaguage model.
 void start()
          Called before a recognition
 void stop()
          Called after a recognition
 
Methods inherited from interface edu.cmu.sphinx.util.props.Configurable
getName, newProperties, register
 

Field Detail

PROP_FORMAT

public static final java.lang.String PROP_FORMAT
The SphinxProperty specifying the format of the language model.

See Also:
Constant Field Values

PROP_FORMAT_DEFAULT

public static final java.lang.String PROP_FORMAT_DEFAULT
The default value of PROP_FORMAT.

See Also:
Constant Field Values

PROP_LOCATION

public static final java.lang.String PROP_LOCATION
The Sphinx Property specifying the location of the language model.

See Also:
Constant Field Values

PROP_LOCATION_DEFAULT

public static final java.lang.String PROP_LOCATION_DEFAULT
The default value of PROP_LOCATION.

See Also:
Constant Field Values

PROP_UNIGRAM_WEIGHT

public static final java.lang.String PROP_UNIGRAM_WEIGHT
The Sphinx Property specifying the unigram weight

See Also:
Constant Field Values

PROP_UNIGRAM_WEIGHT_DEFAULT

public static final float PROP_UNIGRAM_WEIGHT_DEFAULT
The default value for PROP_UNIGRAM_WEIGHT

See Also:
Constant Field Values

PROP_MAX_DEPTH

public static final java.lang.String PROP_MAX_DEPTH
The Sphinx Property specifying the maximum depth reported by the language model (from a getMaxDepth()) call. If this property is set to (-1) (the default) the language model reports the implicit depth of the model. This property allows a deeper language model to be used. For instance, a trigram language model could be used as a bigram model by setting this property to 2. Note if this property is set to a value greater than the implicit depth, the implicit depth is used. Legal values for this property are 1..N and -1.

See Also:
Constant Field Values

PROP_MAX_DEPTH_DEFAULT

public static final int PROP_MAX_DEPTH_DEFAULT
The default value for PROP_MAX_DEPTH.

See Also:
Constant Field Values

PROP_DICTIONARY

public static final java.lang.String PROP_DICTIONARY
The Sphinx Property specifying the dictionary to use

See Also:
Constant Field Values
Method Detail

allocate

public void allocate()
              throws java.io.IOException
Create the language model

Throws:
java.io.IOException

deallocate

public void deallocate()
Deallocate resources allocated to this language model


start

public void start()
Called before a recognition


stop

public void stop()
Called after a recognition


getProbability

public float getProbability(WordSequence wordSequence)
Gets the ngram probability of the word sequence represented by the word list

Parameters:
wordSequence - the wordSequence
Returns:
the probability of the word sequence in LogMath log base

getSmear

public float getSmear(WordSequence wordSequence)
Gets the smear term for the given wordSequence

Parameters:
wordSequence - the word sequence
Returns:
the smear term associated with this word sequence

getVocabulary

public java.util.Set getVocabulary()
Returns the set of words in the lanaguage model. The set is unmodifiable.

Returns:
the unmodifiable set of words

getMaxDepth

public int getMaxDepth()
Returns the maximum depth of the language model

Returns:
the maximum depth of the language mdoel