@Override
    public LanguageDetector loadModels(Set<String> languages) throws IOException {

        // Normalize languages.
        this.languages = new HashSet<>(languages.size());
        for (String language : languages) {
            this.languages.add(LanguageNames.normalizeName(language));
        }

        // TODO what happens if you request a language that has no profile?
        Set<LdLocale> locales = new HashSet<>();
        for (LdLocale locale : BuiltInLanguages.getLanguages()) {
            String languageName = makeLanguageName(locale);
            if (this.languages.contains(languageName)) {
                locales.add(locale);
            }
        }

        detector = createDetector(new LanguageProfileReader().readBuiltIn(locales),
                languageProbabilities);

        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