public class NGramLanguageModel extends NGramModel implements LanguageModel
LanguageModel based on a NGramModel
using Stupid Backoff to get the probabilities of the ngrams.| Constructor and Description |
|---|
NGramLanguageModel() |
NGramLanguageModel(InputStream in) |
NGramLanguageModel(InputStream in,
int n) |
NGramLanguageModel(int n) |
| Modifier and Type | Method and Description |
|---|---|
double |
calculateProbability(StringList sample)
Calculate the probability of a series of tokens (e.g.
|
StringList |
predictNextTokens(StringList tokens)
Predict the most probable output sequence of tokens, given an input sequence of tokens
|
add, add, add, contains, cutoff, equals, getCount, hashCode, iterator, numberOfGrams, remove, serialize, setCount, size, toDictionary, toDictionary, toStringforEach, spliteratorpublic NGramLanguageModel()
public NGramLanguageModel(int n)
public NGramLanguageModel(InputStream in) throws IOException
IOExceptionpublic NGramLanguageModel(InputStream in, int n) throws IOException
IOExceptionpublic double calculateProbability(StringList sample)
LanguageModelcalculateProbability in interface LanguageModelsample - the text tokens to calculate the probability forpublic StringList predictNextTokens(StringList tokens)
LanguageModelpredictNextTokens in interface LanguageModeltokens - a sequence of tokensCopyright © 2017 The Apache Software Foundation. All rights reserved.