private Language detectLanguage(String input) {
        var prediction = detector.probingPredictLanguages(input, config).languages()[0];
        // getConfidence() is typically from 0.01 (very low) to 0.10 (very high).
        // let the configured threshold have reasonable values from 1 to 10:
        double confidence = 100.0 * prediction.getConfidence();
        Language result = null;
        if (confidence > confidenceThreshold) {
            result = languagesByISO3.get(prediction.getLang());
        }
        if (result == null) {
            result = simple.guessLanguage(input.substring(0, Math.min(input.length(), 256)));
        }
        return result;
    }
Detects text language using patched OpenNLP, with fallback to {@link SimpleDetector} for undetected CJK input.

@author jonmv
opennlp-linguistics/src/main/java/com/yahoo/language/opennlp/OpenNlpDetector.java