skillfed

fasttext-langdetect

80x faster and 95% accurate language identification with fastText

fasttext-langdetect v1.1.1 194.3K downloads/30d#9,839 on PyPI172
Permissive 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) Active released

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-langdetect

uv

uv add fasttext-langdetect

poetry

poetry add fasttext-langdetect

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Topic :: Scientific/Engineering :: Artificial IntelligenceTopic :: Scientific/Engineering :: Information AnalysisTopic :: Text Processing :: LinguisticTyping :: Typed

Tags

language detectionlanguage identificationfasttext languagemultilingual text classificationdetect text languagelanguage recognitionnlp language detection
language-detectionfasttextmultilingual

More Artificial Intelligence packages

Further reading