Class Utils


  • public class Utils
    extends Object
    • Constructor Detail

      • Utils

        public Utils()
    • Method Detail

      • getNGrams

        public static List<String> getNGrams​(String input,
                                             int nGramLength)
        Split the input string into n-grams of length nGramLength. The string is padded with nGramLength-1 spaces (trailing and leading). For example, the input string "Java" yields the output bigrams (n=2) " J", "Ja", "av", "va", "a ".
        Parameters:
        input - String to split into n-grams.
        nGramLength - Length of n-grams.
        Returns:
        The set of n-grams.