private opennlp.tools.langdetect.Language[] predict(Map<String, MutableInt> ngramCounts) {
        String[] allGrams = new String[ngramCounts.size()];
        float[] counts = new float[ngramCounts.size()];
        int i = 0;
        for (Map.Entry<String, MutableInt> e : ngramCounts.entrySet()) {
            allGrams[i] = e.getKey();
            // TODO -- once OPENNLP-1261 is fixed,
            // change this to e.getValue().getValue().
            counts[i] = 1;
            i++;
        }
        double[] eval = model.getMaxentModel().eval(allGrams, counts);
        opennlp.tools.langdetect.Language[] arr =
                new opennlp.tools.langdetect.Language[eval.length];
        for (int j = 0; j < eval.length; j++) {
            arr[j] = new opennlp.tools.langdetect.Language(model.getMaxentModel().getOutcome(j),
                    eval[j]);
        }

        Arrays.sort(arr, (o1, o2) -> Double.compare(o2.getConfidence(), o1.getConfidence()));
        return arr;
    }
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