@Override
    public LanguageDetector loadModels() {
        // FUTURE when the "language-detector" project supports short profiles, check if
        // isShortText() returns true and switch to those.

        languages = DEFAULT_LANGUAGES;

        if (languageProbabilities != null) {
            detector = createDetector(DEFAULT_LANGUAGE_PROFILES, languageProbabilities);
        } else {
            detector = DEFAULT_DETECTOR;
        }

        return this;

    }
Implementation of the LanguageDetector API that uses
https://github.com/optimaize/language-detector
tika-langdetect/tika-langdetect-optimaize/src/main/java/org/apache/tika/langdetect/optimaize/OptimaizeLangDetector.java