class Tokenizer {

    public static List<String> computeStartingWordNGrams(String string, int n1, int n2) {
        ArrayList<String> ngrams = new ArrayList<>();

        String[] split = string.split(" ");
        n2 = Math.min(n2, split.length);
        for (int i = 0; i < Math.min(split.length, n2 - n1 + 1); i++) {
            String ngram = "";
            for (int j = 0; j < n2 - i; j++) {
                ngram += split[j] + " ";
            }
            ngram = ngram.trim();

            if (!ngram.isEmpty()) {
                ngrams.add(ngram);
            }
        }

        return ngrams;
    }

    private  Tokenizer();

}