public interface ArrayEncodedNgramLanguageModel<W> extends NgramLanguageModel<W>
W
in the vocabulary, and the mapping from the vocabulary to
integers is managed by an instance of the WordIndexer
class.Modifier and Type | Interface and Description |
---|---|
static class |
ArrayEncodedNgramLanguageModel.DefaultImplementations |
NgramLanguageModel.StaticMethods
Modifier and Type | Method and Description |
---|---|
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.
|
getLmOrder, getLogProb, getWordIndexer, scoreSentence, setOovWordLogProb
float getLogProb(int[] ngram, int startPos, int endPos)
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
.ngram
- array of words in integer representationstartPos
- start of the portion of the array to be readendPos
- end of the portion of the array to be read.float getLogProb(int[] ngram)
getLogProb(ngram, 0, ngram.length)
getLogProb(int[], int, int)