Klasse NGramLanguageModel

java.lang.Object
opennlp.tools.ngram.NGramModel
opennlp.tools.languagemodel.NGramLanguageModel
Alle implementierten Schnittstellen:
Iterable<StringList>, LanguageModel

public class NGramLanguageModel extends NGramModel implements LanguageModel
A LanguageModel based on a NGramModel using Stupid Backoff to get the probabilities of the ngrams.
  • Konstruktordetails

  • Methodendetails

    • add

      public void add(String... tokens)
      Adds further tokens.
      Parameter:
      tokens - Text elements to add to the NGramLanguageModel.
    • calculateProbability

      public double calculateProbability(String... tokens)
      Beschreibung aus Schnittstelle kopiert: LanguageModel
      Calculate the probability of a series of tokens (e.g. a sentence), given a vocabulary.
      Angegeben von:
      calculateProbability in Schnittstelle LanguageModel
      Parameter:
      tokens - the text tokens to calculate the probability for.
      Gibt zurück:
      the probability of the given text tokens in the vocabulary
    • predictNextTokens

      public String[] predictNextTokens(String... tokens)
      Beschreibung aus Schnittstelle kopiert: LanguageModel
      Predict the most probable output sequence of tokens, given an input sequence of tokens.
      Angegeben von:
      predictNextTokens in Schnittstelle LanguageModel
      Parameter:
      tokens - a sequence of tokens
      Gibt zurück:
      the most probable subsequent token sequence