skillfed

lingua-language-detector

An accurate natural language detection library, suitable for short text and mixed-language text

lingua-language-detector v2.2.0 2.7M downloads/30d#2,908 on PyPI1,118
Permissive license Active released

What it is and what it does

Lingua is a language detection library that identifies which of 75 supported languages a given text is written in. It uses compiled Rust bindings for performance and combines rule-based and statistical Naive Bayes methods without relying on neural networks, dictionaries, or external APIs. The library is designed to work well on both long documents and short text fragments like tweets or single words, addressing a gap left by heavier NLP frameworks that often struggle with brief inputs.

The package started as pure Python but was rewritten with Rust bindings from version 2.0.0 onward to balance speed and memory efficiency. It requires Python 3.12 or later and has no runtime dependencies, making it straightforward to integrate into preprocessing pipelines for text classification, spell checking, email routing, and other NLP tasks where language identification is a preliminary step.

Use it for:

  • Preprocess multilingual datasets for NLP tasks by filtering or routing text based on detected language
  • Route customer support emails to geographically appropriate teams based on message language
  • Identify language in social media posts or user-generated content for content moderation or analysis
  • Validate or correct language metadata in text corpora before training machine learning models
  • Detect language in short queries or snippets where heavier frameworks perform poorly

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Detects which language a text is written in, supporting 75 languages with high accuracy on both short snippets and full sentences using compiled Rust bindings.

Yes. The package is actively maintained, has no known vulnerabilities, supports current Python versions, and fills a genuine need for accurate short-text language detection without external dependencies. Medium install friction is acceptable given the performance gains from compiled bindings. Suitable for production NLP pipelines and preprocessing workflows.

Install

lingua-language-detector on PyPI

pip

pip install lingua-language-detector

uv

uv add lingua-language-detector

poetry

poetry add lingua-language-detector

Installing lingua-language-detector

Before you install

Medium install friction due to compiled wheels; the package provides prebuilt binaries for Python 3.12, 3.13, and 3.14 across macOS, Linux, and Windows architectures. Actively maintained with recent releases and no known vulnerabilities.

License in practice

Licensed under Apache Software License (permissive), allowing commercial and private use with minimal restrictions.

Quickstart

pip install lingua-language-detector

from lingua import Language, LanguageDetectorBuilder

detector = LanguageDetectorBuilder.from_all_languages().build()
result = detector.detect_language("This is an English sentence")
print(result)  # Language.ENGLISH

Requires Python 3.12 or later; compiled wheels available for common platforms but may require compilation on unsupported architectures.

Verify before relying

  • Whether the library can be used offline after installation (description claims offline capability but runtime behavior unspecified)
  • Memory footprint and performance characteristics in production deployments
  • Accuracy on code-mixed or transliterated text not covered in the fact sheet

Package facts

License not declared (permissive)
Python support supports the current Python release (>=3.12)
Install friction medium — platform-specific wheel
Runtime dependencies none
Maintenance actively maintained — 158 days since the last release
Last repo commit
First released
Downloads 2,747,868/month — #2,908 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: lingua_language_detector-2.2.0-cp312-cp312-macosx_10_12_x86_64.whl; lingua_language_detector-2.2.0-cp312-cp312-macosx_11_0_arm64.whl; lingua_language_detector-2.2.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; lingua_language_detector-2.2.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; lingua_language_detector-2.2.0-cp312-cp312-musllinux_1_2_aarch64.whl; lingua_language_detector-2.2.0-cp312-cp312-musllinux_1_2_x86_64.whl; lingua_language_detector-2.2.0-cp312-cp312-win_amd64.whl; lingua_language_detector-2.2.0-cp312-cp312-win_arm64.whl; lingua_language_detector-2.2.0-cp313-cp313-macosx_10_12_x86_64.whl; lingua_language_detector-2.2.0-cp313-cp313-macosx_11_0_arm64.whl; lingua_language_detector-2.2.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; lingua_language_detector-2.2.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; lingua_language_detector-2.2.0-cp313-cp313-musllinux_1_2_aarch64.whl; lingua_language_detector-2.2.0-cp313-cp313-musllinux_1_2_x86_64.whl; lingua_language_detector-2.2.0-cp313-cp313-win_amd64.whl; lingua_language_detector-2.2.0-cp313-cp313-win_arm64.whl; lingua_language_detector-2.2.0-cp314-cp314-macosx_10_12_x86_64.whl; lingua_language_detector-2.2.0-cp314-cp314-macosx_11_0_arm64.whl; lingua_language_detector-2.2.0-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; lingua_language_detector-2.2.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Keywords: language-processing, language-detection, language-recognition, nlp

Development Status :: 5 - Production/StableIntended Audience :: DevelopersIntended Audience :: Information TechnologyIntended Audience :: Science/ResearchLicense :: OSI Approved :: Apache Software LicenseNatural Language :: AfrikaansNatural Language :: ArabicNatural Language :: BasqueNatural Language :: BengaliNatural Language :: BosnianNatural Language :: BulgarianNatural Language :: CatalanNatural Language :: Chinese (Simplified)Natural Language :: Chinese (Traditional)Natural Language :: CroatianNatural Language :: CzechNatural Language :: DanishNatural Language :: DutchNatural Language :: EnglishNatural Language :: EsperantoNatural Language :: FinnishNatural Language :: FrenchNatural Language :: GermanNatural Language :: GreekNatural Language :: HebrewNatural Language :: HindiNatural Language :: HungarianNatural Language :: IcelandicNatural Language :: IndonesianNatural Language :: IrishNatural Language :: ItalianNatural Language :: JapaneseNatural Language :: KoreanNatural Language :: LatinNatural Language :: LatvianNatural Language :: LithuanianNatural Language :: MacedonianNatural Language :: MalayNatural Language :: MarathiNatural Language :: NorwegianNatural Language :: PanjabiNatural Language :: PersianNatural Language :: PolishNatural Language :: PortugueseNatural Language :: RomanianNatural Language :: RussianNatural Language :: SerbianNatural Language :: SlovakNatural Language :: SlovenianNatural Language :: SpanishNatural Language :: SwedishNatural Language :: TamilNatural Language :: TeluguNatural Language :: ThaiNatural Language :: TurkishNatural Language :: UkrainianNatural Language :: UrduNatural Language :: VietnameseOperating System :: OS IndependentProgramming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: RustTopic :: Scientific/Engineering :: Information AnalysisTopic :: Software Development :: InternationalizationTopic :: Software Development :: Libraries :: Python ModulesTopic :: Software Development :: LocalizationTopic :: Text Processing :: LinguisticTyping :: Typed

Tags

language detectionidentify text languagelanguage recognitionshort text language detectionmultilingual text classifierNLP language identifierlanguage detection library
language-detectionnlp-preprocessingrust-bindings

More Python Modules packages

Further reading