Class NGramLanguageModel

    • Method Detail

      • add

        public void add​(String... tokens)
      • calculateProbability

        public double calculateProbability​(StringList tokens)
        Description copied from interface: LanguageModel
        Calculate the probability of a series of tokens (e.g. a sentence), given a vocabulary.
        Specified by:
        calculateProbability in interface LanguageModel
        Parameters:
        tokens - the text tokens to calculate the probability for
        Returns:
        the probability of the given text tokens in the vocabulary
      • calculateProbability

        public double calculateProbability​(String... tokens)
        Description copied from interface: LanguageModel
        Calculate the probability of a series of tokens (e.g. a sentence), given a vocabulary.
        Specified by:
        calculateProbability in interface LanguageModel
        Parameters:
        tokens - the text tokens to calculate the probability for
        Returns:
        the probability of the given text tokens in the vocabulary
      • predictNextTokens

        public StringList predictNextTokens​(StringList tokens)
        Description copied from interface: LanguageModel
        Predict the most probable output sequence of tokens, given an input sequence of tokens.
        Specified by:
        predictNextTokens in interface LanguageModel
        Parameters:
        tokens - a sequence of tokens
        Returns:
        the most probable subsequent token sequence
      • predictNextTokens

        public String[] predictNextTokens​(String... tokens)
        Description copied from interface: LanguageModel
        Predict the most probable output sequence of tokens, given an input sequence of tokens.
        Specified by:
        predictNextTokens in interface LanguageModel
        Parameters:
        tokens - a sequence of tokens
        Returns:
        the most probable subsequent token sequence