private int asInteger(String s) {
        try {
            return Integer.parseInt(s);
        }
        catch (NumberFormatException e) {
            throw new IllegalArgumentException("Expected a chunk length integer argument to " +
                                               "the fixed-length chunker, got '" + s + "'");
        }
    }
A chunker which splits a text into chunks at the first double non-letter/digit character after a given
target chunk length measured in characters (or precisely at that length, for CJK languages).

If there are no double non-letter/digit characters within 5% above the target length,
the chunk split will be at the first single non-letter/digit character.

If there are no double non-letter/digit characters within 10% above the target length,
the chunk split will be at that position, so the absolute max chunk length will be 10% above the target
length.

The given target chunk length is adjusted down to prefer a more even chunk length distribution to account for the
fact that the text length will typically not be an integer multiple of the target chunk length.

@author bratseth
linguistics/src/main/java/ai/vespa/language/chunker/FixedLengthChunker.java