@Override
    public opennlp.tools.langdetect.Language[] predictLanguages(CharSequence content) {
        //list of the languages that received the highest
        //confidence over the last n chunk detections
        LinkedList<opennlp.tools.langdetect.Language[]> predictions = new LinkedList();
        int start = 0;//where to start the next chunk in codepoints
        opennlp.tools.langdetect.Language[] currPredictions = null;
        //cache ngram counts across chunks
        Map<String, MutableInt> ngramCounts = new HashMap<>();
        CharIntNGrammer ngrammer = new CharIntNGrammer(1, 3);
        int nGrams = 0;
        while (true) {
            int actualChunkSize = (start + chunkSize > maxLength) ? maxLength - start : chunkSize;

            CSAndLength csAndLength = chunk(content, start, actualChunkSize);
            int[] chunk = csAndLength.normed.codePoints().toArray();
            if (csAndLength.originalLength == 0) {
                if (currPredictions == null) {
                    return predict(ngramCounts);
                } else {
                    return currPredictions;
                }
            }
            start += csAndLength.originalLength;
            ngrammer.reset(chunk);

            while (ngrammer.hasNext()) {
                String nGram = ngrammer.next();
                if (nGram.equals(SPACE)) {
                    continue;
                }
                MutableInt cnt = ngramCounts.get(nGram);
                if (cnt == null) {
                    ngramCounts.put(nGram, new MutableInt(1));
                } else {
                    cnt.increment();
                }
                if (++nGrams % 110 == 0) {
                    currPredictions = predict(ngramCounts);
                    if (seenEnough(predictions, currPredictions, ngramCounts)) {
                        return currPredictions;
                    }
                }
            }
        }
    }
Initializes the current instance with a language detector model. Default feature
generation is used.

@param model the language detector model
tika-langdetect/tika-langdetect-opennlp/src/main/java/org/apache/tika/langdetect/opennlp/ProbingLanguageDetector.java