Class NGramLanguageModel

java.lang.Object
opennlp.tools.ngram.NGramModel
opennlp.tools.languagemodel.NGramLanguageModel
All Implemented Interfaces:
Iterable<StringList>, opennlp.tools.languagemodel.LanguageModel

public class NGramLanguageModel extends NGramModel implements opennlp.tools.languagemodel.LanguageModel
A LanguageModel based on a NGramModel using Stupid Backoff to get the probabilities of the ngrams.
  • Constructor Details

  • Method Details

    • add

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

      public double calculateProbability(String... tokens)
      Specified by:
      calculateProbability in interface opennlp.tools.languagemodel.LanguageModel
    • predictNextTokens

      public String[] predictNextTokens(String... tokens)
      Specified by:
      predictNextTokens in interface opennlp.tools.languagemodel.LanguageModel