public GramSplitterIterator split(String input, int n) {
        if (input == null) throw new NullPointerException("input cannot be null");
        if (n < 1) throw new IllegalArgumentException("n (gram size) cannot be smaller than 1, was " + n);
        return new GramSplitterIterator(input, n, characterClasses);
    }
Splits the input into grams of size n and returns an iterator over grams represented as [start index,length]
pairs into the input string.
<p>
The iterator is implemented as a sliding view over the input string rather than being backed by a
list, which makes this space efficient for large strings.

@param input the input string to be split, cannot be null
@param n     the gram size, a positive integer
@return a read only iterator over the resulting grams
@throws NullPointerException     if input==null
@throws IllegalArgumentException if n is less than 1
linguistics/src/main/java/com/yahoo/language/process/GramSplitter.java