edu.cmu.sphinx.linguist.language.ngram
Class InterpolatedLanguageModel

java.lang.Object
  extended by edu.cmu.sphinx.linguist.language.ngram.InterpolatedLanguageModel
All Implemented Interfaces:
LanguageModel, Configurable

public class InterpolatedLanguageModel
extends java.lang.Object
implements LanguageModel

Simple interpolated LM implementation.

Author:
Tanel Alumae

Field Summary
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.
static java.lang.String PROP_LOG_MATH
          The property that defines the logMath component.
 
Fields inherited from interface edu.cmu.sphinx.linguist.language.ngram.LanguageModel
PROP_DICTIONARY, PROP_FORMAT, PROP_LOCATION, PROP_MAX_DEPTH, 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)
          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 start()
          Called before a recognition
 void stop()
          Called after a recognition
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROP_LOG_MATH

@S4Component(type=LogMath.class)
public static final java.lang.String PROP_LOG_MATH
The property that defines the logMath component.

See Also:
Constant Field Values

PROP_LANGUAGE_MODELS

@S4ComponentList(type=LanguageModel.class)
public static final java.lang.String PROP_LANGUAGE_MODELS
The property that defines the language models to be interpolated.

See Also:
Constant Field Values

PROP_LANGUAGE_MODEL_WEIGHTS

@S4StringList
public static final java.lang.String PROP_LANGUAGE_MODEL_WEIGHTS
The property that defines the language models weights

See Also:
Constant Field Values
Method Detail

newProperties

public void newProperties(PropertySheet ps)
                   throws PropertyException
Description copied from interface: Configurable
This method is called when this configurable component needs to be reconfigured.

Specified by:
newProperties in interface Configurable
Parameters:
ps - a property sheet holding the new data
Throws:
PropertyException - if there is a problem with the properties.

allocate

public void allocate()
              throws java.io.IOException
Description copied from interface: LanguageModel
Create the language model

Specified by:
allocate in interface LanguageModel
Throws:
java.io.IOException

deallocate

public void deallocate()
Description copied from interface: LanguageModel
Deallocate resources allocated to this language model

Specified by:
deallocate in interface LanguageModel

start

public void start()
Called before a recognition

Specified by:
start in interface LanguageModel

stop

public void stop()
Called after a recognition

Specified by:
stop in interface LanguageModel

getProbability

public float getProbability(WordSequence wordSequence)
Calculates probability p = w[1]*p[1] + w[2]*p[2] + ... (in log domain)

Specified by:
getProbability in interface LanguageModel
Parameters:
wordSequence - the wordSequence
Returns:
the probability of the word sequence in LogMath log base
See Also:
LanguageModel.getProbability(edu.cmu.sphinx.linguist.WordSequence)

getSmear

public float getSmear(WordSequence wordSequence)
Description copied from interface: LanguageModel
Gets the smear term for the given wordSequence

Specified by:
getSmear in interface LanguageModel
Parameters:
wordSequence - the word sequence
Returns:
the smear term associated with this word sequence

getVocabulary

public java.util.Set<java.lang.String> getVocabulary()
Description copied from interface: LanguageModel
Returns the set of words in the language model. The set is unmodifiable.

Specified by:
getVocabulary in interface LanguageModel
Returns:
the unmodifiable set of words

getMaxDepth

public int getMaxDepth()
Description copied from interface: LanguageModel
Returns the maximum depth of the language model

Specified by:
getMaxDepth in interface LanguageModel
Returns:
the maximum depth of the language model