Skip to main content

langdetect

[![Build Status](https://travis-ci.org/Mimino666/langdetect.svg?branch=master)](https://travis-ci.org/Mimino666/langdetect)

Port of [language-detection](https://code.google.com/p/language-detection/) (version from 03/03/2014) library to Python.

Installation

$ pip install langdetect

Supported Python versions 2.6, 2.7, 3.x.

Basic usage

To detect the language of the text:

`python >>> from langdetect import detect >>> detect("War doesn't show who's right, just who's left.") 'en' >>> detect("Ein, zwei, drei, vier") 'de' `

To find out the probabilities for the top languages:

`python >>> from langdetect import detect_langs >>> detect_langs("Otec matka syn.") [sk:0.572770823327, pl:0.292872522702, cs:0.134356653968] `

IMPORTANT

Language detection algorithm is non-deterministic, which means that if you try to run it on a text which is either too short or too ambiguous, you might get different results everytime you run it.

To enforce consistent results, call following code before the first language detection:

`python from langdetect import DetectorFactory DetectorFactory.seed = 0 `

More information

This library is a direct port of [language-detection](https://code.google.com/p/language-detection/) from Java to Python. All the classes and methods (even unit tests) are unchanged, so for more information see the project’s website or wiki.

Metadata

Release files for langdetect-py 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for langdetect-py 1.1.1
File Size Uploaded
langdetect-py-1.1.1.tar.gz 989.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for langdetect-py 1.1.1
File Interpreter ABI Platform
langdetect_py-1.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 2.0 MB

Release files / langdetect-py-1.1.1.tar.gz

Download URL langdetect-py-1.1.1.tar.gz
Size 989.9 kB
Tags Source
SHA-256 checksum
How to use checksums
12647e1a3f9d4e719e7f3e4a5c3464198436b6713a6bdd2973ad9ae08c98f8af
BLAKE2b-256 checksum
How to use checksums
096afb44ea19ea63b2f476900c700af56d05d6a8171f8317744f6a52935f61fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.19

Release files / langdetect_py-1.1.1-py3-none-any.whl

Download URL langdetect_py-1.1.1-py3-none-any.whl
Size 1.0 MB
Tags Python 3
SHA-256 checksum
How to use checksums
f31023136acc964992b9257d83af04f13116b89f026139d52da3567e462e38ee
BLAKE2b-256 checksum
How to use checksums
338598532c24110055b5f7601e1bae17e894c5205f9c22e4845346e232a7f121
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.19

Release history Release notifications | RSS feed

This release

1.1.1 This release

2 release files

1.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page