W
- public interface ContextEncodedNgramLanguageModel<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 |
ContextEncodedNgramLanguageModel.DefaultImplementations |
static class |
ContextEncodedNgramLanguageModel.LmContextInfo
Simple class for returning context offsets
|
NgramLanguageModel.StaticMethods
Modifier and Type | Method and Description |
---|---|
float |
getLogProb(long contextOffset,
int contextOrder,
int word,
ContextEncodedNgramLanguageModel.LmContextInfo outputContext)
Get the score for an n-gram, and also get the context offset of the
n-gram's suffix.
|
int[] |
getNgramForOffset(long contextOffset,
int contextOrder,
int word)
Gets the n-gram referred to by a context-encoding.
|
ContextEncodedNgramLanguageModel.LmContextInfo |
getOffsetForNgram(int[] ngram,
int startPos,
int endPos)
Gets the offset which refers to an n-gram.
|
getLmOrder, getLogProb, getWordIndexer, scoreSentence, setOovWordLogProb
float getLogProb(long contextOffset, int contextOrder, int word, ContextEncodedNgramLanguageModel.LmContextInfo outputContext)
contextOffset
- Offset of context (prefix) of an n-gramcontextOrder
- The (0-based) length of context
(i.e.
order == 0
iff context
refers to a
unigram).word
- Last word of the n-gramoutputContext
- Offset of the suffix of the input n-gram. If the parameter is
null
it will be ignored. This can be passed to
future queries for efficient access.ContextEncodedNgramLanguageModel.LmContextInfo getOffsetForNgram(int[] ngram, int startPos, int endPos)
int[] getNgramForOffset(long contextOffset, int contextOrder, int word)