skillfed

langdetect

Language detection library ported from Google's language-detection.

langdetect v1.0.9 11.1M downloads/30d#1,417 on PyPI1,900
Permissive license MIT AGING released

What it is and what it does

langdetect is a Python port of Google's language-detection library, ported from Java. It identifies the language of input text and returns either a single language code (ISO 639-1 format) or a ranked list of candidate languages with confidence scores. The library supports 55 languages out of the box, including common European, Asian, and other language families.

The package depends only on six for Python 2/3 compatibility. Its core limitation is that the detection algorithm is non-deterministic—short or ambiguous text may produce different results across runs unless you seed the detector factory. It's designed for straightforward language identification tasks where you need quick results without external API calls or heavy dependencies.

Use it for:

  • Automatically categorize user-generated content by language for multilingual applications or content moderation systems.
  • Route text to language-specific processing pipelines (spell-checkers, NLP models, translation services) based on detected language.
  • Identify the language of incoming support tickets or messages to assign them to appropriate language teams.
  • Filter or segment documents in mixed-language datasets during data preprocessing for machine learning.
  • Build language-aware search or recommendation features that adapt results based on detected user input language.

Worth the install?

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

Detects the language of text input, supporting 55 languages and returning either a language code or probability scores for candidate languages.

Yes, if you need lightweight, dependency-minimal language detection without external API calls. The library is stable and permissively licensed, but consider it aging—last release was 2021. It's suitable for production use in applications where non-determinism on ambiguous text is acceptable and you don't require state-of-the-art accuracy. For modern alternatives or higher accuracy, evaluate current options.

Install

langdetect on PyPI

pip

pip install langdetect

uv

uv add langdetect

poetry

poetry add langdetect

Installing langdetect

Before you install

Low install friction with a single lightweight dependency (six). Maintenance is aging—last release was in 2021 and the last commit was 2025-03-03, but the repository remains active and unarchived with stable production status.

License in practice

Licensed under MIT (permissive), allowing free use, modification, and distribution with minimal restrictions.

Quickstart

pip install langdetect

from langdetect import detect, detect_langs
detect("War doesn't show who's right, just who's left.")
detect_langs("Otec matka syn.")

Language detection is non-deterministic; for consistent results, set DetectorFactory.seed = 0 before first detection.

Verify before relying

  • Current accuracy and performance characteristics compared to modern language detection libraries.
  • Whether the library is actively maintained or in maintenance-only mode given the 2021 latest release date.

Package facts

License MIT (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies 1 — six
Maintenance aging — 1,925 days since the last release
Last repo commit
First released
Downloads 11,081,342/month — #1,417 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: langdetect-1.0.9-py2-none-any.whl

Keywords: language, detection, library

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseOperating System :: OS IndependentProgramming Language :: Python :: 2Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8

Tags

language detectiondetect text languagelanguage identificationmultilingual text classifierlanguage code from textlanguage probability detectionidentify document language
language-identificationnlp-preprocessing

More Linguistic packages

Further reading