--- id: lingua-language-detector version: "2.2.0" license: unclear license_treatment: permissive maintenance: active --- # lingua-language-detector — An accurate natural language detection library, suitable for short text and mixed-language text License: permissive · Maintenance: active · Downloads: 2.7M/mo ## 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 above — 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 pip install lingua-language-detector uv add lingua-language-detector 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_current - Install friction: medium - Maintenance: active - Downloads: 2.7M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags language detection, identify text language, language recognition, short text language detection, multilingual text classifier, NLP language identifier, language detection library, language-detection, nlp-preprocessing, rust-bindings [View on SkillFed](https://skillfed.io/packages/lingua-language-detector) · [View on PyPI](https://pypi.org/project/lingua-language-detector/)