W - public class ArrayEncodedProbBackoffLm<W> extends AbstractArrayEncodedNgramLanguageModel<W> implements ArrayEncodedNgramLanguageModel<W>, java.io.Serializable
ContextEncodedProbBackoffLm,
which stores a trie for which the last word points to its suffix. This was
done because it simplifies the code significantly, without significantly
changing speed or memory usage.ArrayEncodedNgramLanguageModel.DefaultImplementationsNgramLanguageModel.StaticMethodslmOrder, oovWordLogProb| Constructor and Description |
|---|
ArrayEncodedProbBackoffLm(int lmOrder,
WordIndexer<W> wordIndexer,
NgramMap<ProbBackoffPair> map,
ConfigOptions opts) |
| 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.
|
float |
getLogProb(java.util.List<W> ngram)
Scores an n-gram.
|
NgramMap<ProbBackoffPair> |
getNgramMap() |
scoreSentencegetLmOrder, getWordIndexer, setOovWordLogProbclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetLmOrder, getWordIndexer, scoreSentence, setOovWordLogProbpublic ArrayEncodedProbBackoffLm(int lmOrder,
WordIndexer<W> wordIndexer,
NgramMap<ProbBackoffPair> map,
ConfigOptions opts)
public float getLogProb(int[] ngram,
int startPos,
int endPos)
ArrayEncodedNgramLanguageModelgetLmOrder(),
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.getLogProb in interface ArrayEncodedNgramLanguageModel<W>getLogProb in class AbstractArrayEncodedNgramLanguageModel<W>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.public float getLogProb(int[] ngram)
ArrayEncodedNgramLanguageModelgetLogProb(ngram, 0, ngram.length)getLogProb in interface ArrayEncodedNgramLanguageModel<W>getLogProb in class AbstractArrayEncodedNgramLanguageModel<W>ArrayEncodedNgramLanguageModel.getLogProb(int[], int, int)public float getLogProb(java.util.List<W> ngram)
NgramLanguageModelArrayEncodedNgramLanguageModel.getLogProb(int[], int, int) and
ContextEncodedNgramLanguageModel.getLogProb(long, int, int, edu.berkeley.nlp.lm.ContextEncodedNgramLanguageModel.LmContextInfo)
.getLogProb in interface NgramLanguageModel<W>getLogProb in class AbstractArrayEncodedNgramLanguageModel<W>public NgramMap<ProbBackoffPair> getNgramMap()