edu.berkeley.nlp.lm
Interface ArrayEncodedNgramLanguageModel<W>

All Superinterfaces:
NgramLanguageModel<W>
All Known Implementing Classes:
AbstractArrayEncodedNgramLanguageModel, ArrayEncodedCachingLmWrapper, ArrayEncodedProbBackoffLm, KneserNeyLmReaderCallback, StupidBackoffLm

public interface ArrayEncodedNgramLanguageModel<W>
extends NgramLanguageModel<W>

Top-level interface for an n-gram language model which accepts n-gram in an array-of-integers encoding. The integers represent words of type W in the vocabulary, and the mapping from the vocabulary to integers is managed by an instance of the WordIndexer class.

Author:
adampauls

Nested Class Summary
static class ArrayEncodedNgramLanguageModel.DefaultImplementations
           
 
Nested classes/interfaces inherited from interface edu.berkeley.nlp.lm.NgramLanguageModel
NgramLanguageModel.StaticMethods
 
Method Summary
 float getLogProb(int[] ngram)
          Equivalent to getLogProb(ngram, 0, ngram.length)
 float getLogProb(int[] ngram, int startPos, int endPos)
          Calculate language model score of an n-gram.
 
Methods inherited from interface edu.berkeley.nlp.lm.NgramLanguageModel
getLmOrder, getLogProb, getWordIndexer, scoreSentence, setOovWordLogProb
 

Method Detail

getLogProb

float getLogProb(int[] ngram,
                 int startPos,
                 int endPos)
Calculate language model score of an n-gram. Warning: if you pass in an n-gram of length greater than getLmOrder(), this call will silently ignore the extra words of context. In other words, if you pass in a 5-gram (endPos-startPos == 5) to a 3-gram model, it will only score the words from startPos + 2 to endPos.

Parameters:
ngram - array of words in integer representation
startPos - start of the portion of the array to be read
endPos - end of the portion of the array to be read.
Returns:

getLogProb

float getLogProb(int[] ngram)
Equivalent to getLogProb(ngram, 0, ngram.length)

See Also:
getLogProb(int[], int, int)