Skip to main content

Text language identifier

This package serves as a wrapper for the most performant text language identifier.

Currently it wraps fasttext (NLLB version).

Before detecting the language, it preprocesses the text to improve results.

Usage

%pip install textlangid

import textlangid

lang = textlangid.detect("This is some text.")

top_languages = TextLanguageIdentifier.detect(text, top_k=3)

top_languages_with_confidence = TextLanguageIdentifier.detect(
        text, top_k=3, return_confidence=True
    )

top_languages_with_threshold = TextLanguageIdentifier.detect(
        text, top_k=3, return_confidence=True, confidence_threshold=0.2
    )

The language is returned in a FLORES-200 language code. Full list available here.

Metadata

Release files for textlangid 0.0.7

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

Source distribution (sdist)

Source distribution for textlangid 0.0.7
File Size Uploaded
textlangid-0.0.7.tar.gz 2.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for textlangid 0.0.7
File Interpreter ABI Platform
textlangid-0.0.7-py3-none-any.whl Python 3 none any Details

Total release size: 6.0 kB

Release files / textlangid-0.0.7.tar.gz

Download URL textlangid-0.0.7.tar.gz
Size 2.9 kB
Tags Source
SHA-256 checksum
How to use checksums
8ae0a84532bb5b1027fa4d2ca263d6e0cbcd00a94d39338a3d1a90672ac554cd
BLAKE2b-256 checksum
How to use checksums
1d5abe0c24cc44f1218b5e41fce45c00c5b23c92d0942246516144e90c91a6e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.20

Release files / textlangid-0.0.7-py3-none-any.whl

Download URL textlangid-0.0.7-py3-none-any.whl
Size 3.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7ff35369cdbe95bbc7d8e46ad7df00de75a1bff6e2f363041701e9b96ef38dea
BLAKE2b-256 checksum
How to use checksums
264ca39fc77d359481297d04d565dd4b8952a7bdee23d3c429538ffcf965bd28
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.20

Release history Release notifications | RSS feed

This release

0.0.7 This release

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.1

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