W - public abstract class AbstractArrayEncodedNgramLanguageModel<W> extends AbstractNgramLanguageModel<W> implements ArrayEncodedNgramLanguageModel<W>, java.io.Serializable
getLogProb(int[], int, int).ArrayEncodedNgramLanguageModel.DefaultImplementationsNgramLanguageModel.StaticMethodslmOrder, oovWordLogProb| Constructor and Description |
|---|
AbstractArrayEncodedNgramLanguageModel(int lmOrder,
WordIndexer<W> wordIndexer,
float oovWordLogProb) |
| Modifier and Type | Method and Description |
|---|---|
float |
getLogProb(int[] ngram)
Equivalent to
getLogProb(ngram, 0, ngram.length) |
abstract float |
getLogProb(int[] ngram,
int startPos,
int endPos)
Calculate language model score of an n-gram.
|
float |
getLogProb(java.util.List<W> phrase)
Scores an n-gram.
|
float |
scoreSentence(java.util.List<W> sentence)
Scores a complete sentence, taking appropriate care with the start- and
end-of-sentence symbols.
|
getLmOrder, getWordIndexer, setOovWordLogProbclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetLmOrder, getWordIndexer, setOovWordLogProbpublic AbstractArrayEncodedNgramLanguageModel(int lmOrder,
WordIndexer<W> wordIndexer,
float oovWordLogProb)
public float scoreSentence(java.util.List<W> sentence)
NgramLanguageModelscoreSentence in interface NgramLanguageModel<W>public float getLogProb(java.util.List<W> phrase)
NgramLanguageModelArrayEncodedNgramLanguageModel.getLogProb(int[], int, int) and
ContextEncodedNgramLanguageModel.getLogProb(long, int, int, edu.berkeley.nlp.lm.ContextEncodedNgramLanguageModel.LmContextInfo)
.getLogProb in interface NgramLanguageModel<W>public float getLogProb(int[] ngram)
ArrayEncodedNgramLanguageModelgetLogProb(ngram, 0, ngram.length)getLogProb in interface ArrayEncodedNgramLanguageModel<W>ArrayEncodedNgramLanguageModel.getLogProb(int[], int, int)public abstract 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>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.