W
- public class ContextEncodedProbBackoffLm<W> extends AbstractContextEncodedNgramLanguageModel<W> implements ContextEncodedNgramLanguageModel<W>, java.io.Serializable
ContextEncodedNgramLanguageModel.DefaultImplementations, ContextEncodedNgramLanguageModel.LmContextInfo
NgramLanguageModel.StaticMethods
lmOrder, oovWordLogProb
Constructor and Description |
---|
ContextEncodedProbBackoffLm(int lmOrder,
WordIndexer<W> wordIndexer,
ContextEncodedNgramMap<ProbBackoffPair> map,
ConfigOptions opts) |
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.
|
NgramMap<ProbBackoffPair> |
getNgramMap() |
ContextEncodedNgramLanguageModel.LmContextInfo |
getOffsetForNgram(int[] ngram,
int startPos,
int endPos)
Gets the offset which refers to an n-gram.
|
getLogProb, scoreSentence
getLmOrder, getWordIndexer, setOovWordLogProb
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getLmOrder, getLogProb, getWordIndexer, scoreSentence, setOovWordLogProb
public ContextEncodedProbBackoffLm(int lmOrder, WordIndexer<W> wordIndexer, ContextEncodedNgramMap<ProbBackoffPair> map, ConfigOptions opts)
public float getLogProb(long contextOffset, int contextOrder, int word, ContextEncodedNgramLanguageModel.LmContextInfo outputContext)
ContextEncodedNgramLanguageModel
getLogProb
in interface ContextEncodedNgramLanguageModel<W>
getLogProb
in class AbstractContextEncodedNgramLanguageModel<W>
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.public ContextEncodedNgramLanguageModel.LmContextInfo getOffsetForNgram(int[] ngram, int startPos, int endPos)
ContextEncodedNgramLanguageModel
getOffsetForNgram
in interface ContextEncodedNgramLanguageModel<W>
getOffsetForNgram
in class AbstractContextEncodedNgramLanguageModel<W>
public int[] getNgramForOffset(long contextOffset, int contextOrder, int word)
ContextEncodedNgramLanguageModel
getNgramForOffset
in interface ContextEncodedNgramLanguageModel<W>
getNgramForOffset
in class AbstractContextEncodedNgramLanguageModel<W>
public NgramMap<ProbBackoffPair> getNgramMap()