Lingua

Language detection library covering 75 languages that stays accurate on single words and short phrases.

Open SourceSelf HostedOffline Capable
0.0 (0)

About

Short strings are where most language detectors fall apart, and Lingua was built specifically to fix that. The library identifies 75 languages and publishes per-language accuracy tables for single words, word pairs, and full sentences, where it leads langdetect, CLD3, and langid; for German it reports 74.2 percent on single words, 93.9 percent on word pairs, and 99.7 percent on sentences. Under the hood it combines n-gram models of lengths one through five with a rule-based filtering engine, no neural networks and no external API calls, so detection runs completely offline. Since version 2.0.0 the Python package is a set of bindings over a native Rust core, keeping runtime memory to a few dozen megabytes with model data stored in finite-state transducers, and a multi-threaded mode classifies 3,000 texts across all 75 languages in roughly 21 seconds in high accuracy mode. Install with pip install lingua-language-detector; version 2.2.0 is current, the license is Apache-2.0, and the repository has about 1,800 stars. Data engineers use it to route, filter, and label multilingual text before downstream NLP.

Should you use Lingua?

Pick it when

Pick Lingua when you route or filter multilingual text that includes short strings such as chat messages, search queries, or titles, need it fully offline, and want published per-language accuracy to justify the choice.

Look elsewhere when

Skip it when inputs are long, clean sentences and short-text accuracy buys you little, where OpenNLP's detector fits a Java stack, or when you also want classification and word vectors from one CPU tool, which fastText covers.

Alternatives to Lingua

  • fastText

    Language ID plus text classification and embeddings in one fast C++ tool, but its repository has been archived since March 2024.

  • OpenNLP

    Its 103-language detector suits Java stacks already on OpenNLP, but Apache says the model works best on texts of two or more sentences, the short-string case Lingua is built for.

  • Stanza

    Its character-level Bi-LSTM language ID can route text into Stanza's neural pipelines, but it covers 61 languages and needs PyTorch, far heavier than Lingua's Rust core.

Reviews (0)

Leave a Review

No reviews yet. Be the first to review!

Details

Price
Free
Platform
Local/Desktop
Difficulty
Easy (2/5)
License
Apache-2.0
Added
Jul 29, 2026

Tags