fast-langdetect
Quickly detect text language and segment language
Decision gist · record as of 2026-08-14
Yes. The package is actively maintained, has no known vulnerabilities, installs with low friction, and offers both offline and high-accuracy modes. Use it if you need fast, offline-capable language detection without heavy dependencies. The lite model is practical for memory-constrained environments; the full model is appropriate when accuracy matters more than footprint. MIT licensing poses no restrictions.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Models download to system temp by default; set FTLANG_CACHE environment variable or use LangDetectConfig(cache_dir=...) to customize storage location.
- Lite model (~45–60 MB) runs offline; full model (~170–210 MB) requires download.
- Low friction: pure Python wheel with three runtime dependencies (robust-downloader, requests, fasttext-predict).
License · maintenance · safety
MIT (permissive) — MIT license is permissive; you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.
last release 2026-05-06 (100 days)
0 known vulnerabilities (OSV.dev, 2026-08-14) · 4,349,178 downloads/mo, #2,324 on PyPI
Alternatives
Verify before relying
pip install fast-langdetect
from fast_langdetect import detect
result = detect("Hello, world!", model="auto", k=1)
print(result)- Whether the 80x speed improvement and 95% accuracy claims are independently verified or measured against specific baselines.
- How accuracy varies across the 176 supported languages and whether performance degrades on short or mixed-script text.
- Whether robust-downloader, requests, and fasttext-predict have known security issues or maintenance concerns not visible in OSV.
What it is and what it does
fast-langdetect is a language detection library built on FastText that identifies the language of input text and returns a ranked list of language codes with confidence scores. It offers two model modes: a lite model (~45–60 MB) that works entirely offline, and a full model (~170–210 MB) that downloads on first use and provides higher accuracy. The library handles text normalization automatically (replacing newlines with spaces), truncates input to 80 characters by default to optimize accuracy, and falls back from the full model to the lite model only if memory runs out when using model='auto'.
The package is designed for low-friction integration: it requires no NumPy, installs as a pure Python wheel, and caches loaded models in memory within each detector instance to avoid reloading. You can use the global detect() function for simple cases or create a LangDetector instance with custom configuration (cache directory, input length limits, proxy settings) for more control. Language codes follow BCP-47 style (e.g., en, zh-cn, pt-br, yue), and the library provides examples for mapping codes to display names using langcodes or pycountry.
Use it for
- Detect the language of user-submitted text in a web form or API to route it to the correct processing pipeline.
- Identify languages in multilingual documents to split or segment content by language before translation or analysis.
- Filter or categorize incoming messages by language in a chat or support system without external API calls.
- Validate that text input matches an expected language in a localized application.
- Build a language-aware search index that tags documents with their detected language for filtering or ranking.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
The package is actively maintained, has no known vulnerabilities, installs with low friction, and offers both offline and high-accuracy modes. Use it if you need fast, offline-capable language detection without heavy dependencies. The lite model is practical for memory-constrained environments; the full model is appropriate when accuracy matters more than footprint. MIT licensing poses no restrictions.
Install
fast-langdetect on PyPI
Before you install
Low friction: pure Python wheel with three runtime dependencies (robust-downloader, requests, fasttext-predict). Active maintenance with a release 100 days ago. Supports Python 3.9 through 3.14.
Models download to system temp by default; set FTLANG_CACHE environment variable or use LangDetectConfig(cache_dir=...) to customize storage location. Lite model (~45–60 MB) runs offline; full model (~170–210 MB) requires download.
License in practice
MIT license is permissive; you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.
Quickstart
pip install fast-langdetect
from fast_langdetect import detect
result = detect("Hello, world!", model="auto", k=1)
print(result)
Verify before relying
- Whether the 80x speed improvement and 95% accuracy claims are independently verified or measured against specific baselines.
- How accuracy varies across the 176 supported languages and whether performance degrades on short or mixed-script text.
- Whether robust-downloader, requests, and fasttext-predict have known security issues or maintenance concerns not visible in OSV.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 3 packagesrobust-downloaderrequestsfasttext-predict |
| Maintenance | Actively maintained 100 days since the last release |
| First released | |
| Downloads | 4,349,178 / month, #2,324 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9 |
Evidence: fast_langdetect-1.0.1-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
An agent finds packages by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language. Give your agent the search over MCP.
More Linguistic packages
Detects and normalizes text encoding from unknown or ambiguous sources, supporting all IANA character sets that Python's core library provides codecs for, with the ability to register custom codecs.
tiktoken is a fast BPE tokenizer that converts text into token sequences compatible with OpenAI models, supporting multiple encoding schemes including o200k_base and model-specific encodings.
Install it if you work with OpenAI APIs or need to understand token boundaries in GPT-family models.
Detects character encoding and language in byte sequences with high accuracy, supporting 99 encodings and returning confidence scores, language tags, and MIME types.
Install it if you need to detect character encoding or language in byte data; the rewrite makes it substantially faster and more accurate than its predecessors.
Converts Unicode text to ASCII by transliterating non-ASCII characters into their closest ASCII equivalents, with no runtime dependencies.
However, if transliteration quality or ongoing maintenance matters, consider unidecode instead despite its GPL-only license.
Lark is a parsing library that builds abstract syntax trees from context-free grammars, supporting multiple parsing algorithms (Earley, LALR(1), CYK) with automatic line and column tracking.
Python bindings to the tree-sitter parsing library, enabling incremental parsing and syntax tree analysis for source code.
See also fasttext-langdetect · fasttext-predict · fasttext · fasttext-numpy2 · fasttext-wheel · langdetect · langcodes · py3langid · floret · cnocr