fasttext-langdetect
80x faster and 95% accurate language identification with fastText
What it is and what it does
fasttext-langdetect wraps Facebook's pretrained fastText language identification model (lid.176) in a simple Python API. It detects which of 176 languages a given UTF-8 string is written in, returning a language code and confidence score. The package handles multi-line input and whitespace normalization automatically, and offers a low-memory mode using a compressed model variant for memory-constrained environments.
The core use case is rapid, accurate language detection for text processing pipelines—content routing, multilingual NLP preprocessing, or user-generated content classification. It depends on fasttext-predict and requests, both of which install without compilation. Models are cached locally on first download and can be overridden via the FTLANG_CACHE environment variable.
Use it for:
- Route user-submitted text to language-specific NLP pipelines or translation services
- Identify the language of social media posts or forum content for moderation or analysis
- Detect bilingual or code-switched text by requesting top-k candidate languages
- Preprocess multilingual datasets by filtering or grouping documents by detected language
- Build a language-aware search or recommendation system that respects user language preference
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Identifies the language of UTF-8 text using Facebook's pretrained fastText lid.176 model, supporting 176 languages with optional memory-efficient compressed mode.
Yes. Active maintenance, permissive MIT license, low install friction, no known vulnerabilities, and strong benchmark performance make this a solid choice for production language detection. The API is straightforward, and prebuilt wheels eliminate compilation overhead. Install it if you need fast, accurate language identification across 176 languages without external service calls.
Install
fasttext-langdetect on PyPI
pip
pip install fasttext-langdetectuv
uv add fasttext-langdetectpoetry
poetry add fasttext-langdetectInstalling fasttext-langdetect
Before you install
Low friction install with prebuilt wheels for all major platforms and Python versions 3.9–3.13; active maintenance with recent release 80 days ago and no compilation required.
License in practice
MIT license permits unrestricted use, modification, and distribution with minimal restrictions—suitable for commercial and open-source projects.
Quickstart
pip install fasttext-langdetect
from fasttext-langdetect import detect
result = detect(text="Bugün hava çok güzel", low_memory=False)
print(result)
Requires Python 3.9 or newer; models download and cache on first use (network access required).
Verify before relying
- Accuracy on code-switched or mixed-script text beyond the bilingual examples shown
- Performance characteristics on very long documents or streaming scenarios
- Behavior on text with heavy emoji, URLs, or special formatting
- Whether the module import name differs from the package name
Package facts
| License | MIT License Copyright (c) 2021 Zafer Çavdar Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal… (full text in the JSON record) (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — fasttext-predict, requests |
| Maintenance | actively maintained — 80 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 194,294/month — #9,839 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: fasttext_langdetect-1.1.1-py3-none-any.whl
Keywords: fasttext, langdetect, language-detection, language-identification, nlp
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
fast-langdetectDetects the language of text using FastText…
permissive · top 5,000 on PyPI
langdetectDetects the language of text input, supporting…
permissive · top 5,000 on PyPI
fasttext-predictLoads and runs fastText language identification…
permissive · top 5,000 on PyPI
langidIdentifies the language of text input across 97…
permissive · top 15,000 on PyPI
py3langidIdentifies the language of text in one of 97…
permissive · top 15,000 on PyPI
pycld2Detects the language of text using Google's…
permissive · top 15,000 on PyPI
lingua-language-detectorDetects which language a text is written in,…
permissive · top 5,000 on PyPI
gcld3Identifies the language of input text using a…
unclear · top 15,000 on PyPI
fasttextfastText is a library for learning word…
permissive · top 5,000 on PyPI
minisbdDetects sentence boundaries in text across many…
agpl · top 15,000 on PyPI