private static void addProfile(String language) throws Exception {
        try {
            LanguageProfile profile = new LanguageProfile();

            try (InputStream stream = LanguageIdentifier.class
                    .getResourceAsStream(language + PROFILE_SUFFIX)) {
                BufferedReader reader = new BufferedReader(new InputStreamReader(stream, UTF_8));
                String line = reader.readLine();
                while (line != null) {
                    if (line.length() > 0 && !line.startsWith("#")) {
                        int space = line.indexOf(' ');
                        profile.add(line.substring(0, space),
                                Long.parseLong(line.substring(space + 1)));
                    }
                    line = reader.readLine();
                }
            }

            addProfile(language, profile);
        } catch (Throwable t) {
            throw new Exception(
                    "Failed trying to load language profile for language \"" + language +
                            "\". Error: " + t.getMessage());
        }
    }
Constructs a language identifier based on a String of text content

@param content the text
tika-langdetect/tika-langdetect-tika/src/main/java/org/apache/tika/langdetect/tika/LanguageIdentifier.java