boolean seenEnough(LinkedList<opennlp.tools.langdetect.Language[]> predictionsQueue,
                       opennlp.tools.langdetect.Language[] newPredictions,
                       Map<String, MutableInt> ngramCounts) {

        if (predictionsQueue.size() < minConsecImprovements) {
            predictionsQueue.add(newPredictions);
            return false;
        } else if (predictionsQueue.size() > minConsecImprovements) {
            predictionsQueue.removeFirst();
        }
        predictionsQueue.add(newPredictions);
        if (minDiff > 0.0 &&
                newPredictions[0].getConfidence() - newPredictions[1].getConfidence() < minDiff) {
            return false;
        }
        String lastLang = null;
        double lastConf = -1.0;
        //iterate through the last predictions
        //and check that the lang with the highest confidence
        //hasn't changed, and that the confidence in it
        //hasn't decreased
        for (opennlp.tools.langdetect.Language[] predictions : predictionsQueue) {
            if (lastLang == null) {
                lastLang = predictions[0].getLang();
                lastConf = predictions[0].getConfidence();
                continue;
            } else {
                if (!lastLang.equals(predictions[0].getLang())) {
                    return false;
                }
                if (lastConf > predictions[0].getConfidence()) {
                    return false;
                }
            }
            lastLang = predictions[0].getLang();
            lastConf = predictions[0].getConfidence();
        }
        return true;
    }
Override this for different behavior to determine if there is enough
confidence in the predictions to stop.

@param predictionsQueue
@param newPredictions
@param ngramCounts
@return
tika-langdetect/tika-langdetect-opennlp/src/main/java/org/apache/tika/langdetect/opennlp/ProbingLanguageDetector.java