Package opennlp.tools.languagemodel
Interface LanguageModel
- All Known Implementing Classes:
NGramLanguageModel
public interface LanguageModel
A language model can calculate the probability p (between 0 and 1) of a
certain
sequence of tokens
, given its underlying vocabulary.-
Method Summary
Modifier and TypeMethodDescriptiondouble
calculateProbability
(String... tokens) Calculate the probability of a series of tokens (e.g. a sentence), given a vocabulary.String[]
predictNextTokens
(String... tokens) Predict the most probable output sequence of tokens, given an input sequence oftokens
.predictNextTokens
(StringList tokens) Deprecated.
-
Method Details
-
calculateProbability
Calculate the probability of a series of tokens (e.g. a sentence), given a vocabulary.- Parameters:
tokens
- the text tokens to calculate theprobability
for.- Returns:
- the probability of the given text tokens in the vocabulary
-
predictNextTokens
Deprecated.Predict the most probable output sequence of tokens, given an input sequence oftokens
.- Parameters:
tokens
- a sequence of tokens.- Returns:
- the most probable subsequent token sequence
-
predictNextTokens
Predict the most probable output sequence of tokens, given an input sequence oftokens
.- Parameters:
tokens
- a sequence of tokens- Returns:
- the most probable subsequent token sequence
-
predictNextTokens(String...)