Detects the language of text
Project description
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.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file textlangid-0.0.7.tar.gz.
File metadata
- Download URL: textlangid-0.0.7.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ae0a84532bb5b1027fa4d2ca263d6e0cbcd00a94d39338a3d1a90672ac554cd
|
|
| MD5 |
8e47b3c7d1c424df543c426a3430f06f
|
|
| BLAKE2b-256 |
1d5abe0c24cc44f1218b5e41fce45c00c5b23c92d0942246516144e90c91a6e8
|
File details
Details for the file textlangid-0.0.7-py3-none-any.whl.
File metadata
- Download URL: textlangid-0.0.7-py3-none-any.whl
- Upload date:
- Size: 3.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ff35369cdbe95bbc7d8e46ad7df00de75a1bff6e2f363041701e9b96ef38dea
|
|
| MD5 |
40a2b7c1d0a8232d85f7057ebc70144b
|
|
| BLAKE2b-256 |
264ca39fc77d359481297d04d565dd4b8952a7bdee23d3c429538ffcf965bd28
|