Class NGramLanguageModel

    • Method Detail

      • add

        public void add​(String... tokens)
        Adds further tokens.
        Parameters:
        tokens - Text elements to add to the NGramLanguageModel.
      • 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

        @Deprecated
        public StringList predictNextTokens​(StringList tokens)
        Deprecated.
        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