Practical overview
When it fits
Use Lingua when a Kotlin or Java/JVM application needs an in-process language-identification step before routing or further text processing.
Who it is for
- Kotlin and Java/JVM developers adding language detection to software.
- Developers building NLP workflows that need language identification before classification, spell checking or other language-specific processing.
Documented uses
- Identify the language of supplied text, including short snippets or longer passages.
- Route incoming email according to its language.
- Choose language-specific processing before text classification or spell checking.
Requirements & limits
The repository declares an Apache-2.0 license and links to Maven Central and Java documentation.
- Lingua supports 75 listed languages and lets developers build a detector for selected languages or all supported languages.
- The library uses rule-based and statistical methods and does not use word dictionaries, according to its README.
- It does not require an external API connection and can be used offline after download.
- Shared words can be ambiguous; the minimum-relative-distance setting can return Language.UNKNOWN when the input is short and the threshold is too high.
- The public API is documented as not returning null, including for use from Java.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Detect a text language in Kotlin or Java
Build a detector for selected languages and ask it to identify the language of supplied text.
Before you start
- A Kotlin or Java/JVM application using Lingua.
- A text input to classify.
- The Lingua library available to the application.
Steps
Import Lingua's API and language identifiers.
Build a LanguageDetector for the languages to examine.
Pass the text to the detector's detectLanguageOf method and receive a Language result.
Expected outcome
The application receives the detected language for the supplied text.
Guide limitations
- The example selects English, French, German and Spanish; it does not describe dependency installation.
- For ambiguous text, the most likely result may not be reliable; the README documents a minimum-relative-distance option, which can yield Language.UNKNOWN for short text if set too high.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 15 October 2026
- Original website title
- pemistahl/lingua · Official homepage title · retained in its source language

