LexiLang
Simple, fast dictionary-based language detector for short texts.
Installation
pip install lexilang
Usage
from lexilang.detector import detect
print(detect("bonjour")) # ('fr', 0.45)
print(detect("学中文")) # ('zh', 0.45)
print(detect("ciao mondo")) # ('it', 0.9)
print(detect("El gato doméstico")) # ('es', 0.45)
# Optionally, specify a subset of languages to consider
print(detect("ciao", languages=["de", "ro"])) # ('de', 0.45)
detect(text, languages=[]) -> tuple (iso_639_1, confidence)
Supported Languages
- Afrikaans
- Albanian
- Arabic
- Basque
- Bengali
- Bulgarian
- Catalan
- Chinese
- Czech
- Danish
- Dutch
- English
- Esperanto
- Estonian
- Finnish
- French
- German
- Greek
- Hebrew
- Hindi
- Hungarian
- Indonesian
- Italian
- Japanese
- Kabyle
- Kazakh
- Korean
- Latvian
- Lithuanian
- Macedonian
- Norwegian
- Occitan
- Polish
- Portuguese
- Romanian
- Russian
- Serbian
- Slovak
- Slovenian
- Spanish
- Swedish
- Thai
- Turkish
- Ukrainian
- Vietnamese
- Farsi
Limitations
This detector was designed for handling small texts (< 20 characters). It will probably not work reliably for longer text sequences. As it relies on dictionaries, if a word is missing or mispelled, the detection will fail.
Contributing
If you want to add a new language, or improve an existing one, add more words to the respective dictionary in the dictionaries folder.
License
AGPLv3
Metadata
Release files for LexiLang 1.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| lexilang-1.0.7.tar.gz | 1.6 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lexilang-1.0.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 3.3 MB
Release files / lexilang-1.0.7.tar.gz
| Download URL | lexilang-1.0.7.tar.gz |
|---|---|
| Size | 1.6 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
195fcc02b28366e6e71484ffba77f7dc1dcc962ecf9633322f79305b9f6605f7
|
|
BLAKE2b-256 checksum How to use checksums |
8598695b7a5c3c7e77880d0dd7684920d1cf059874b2a3873a7eb7496ab9cb45
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 5, 2026.
Transparency logRelease files / lexilang-1.0.7-py3-none-any.whl
| Download URL | lexilang-1.0.7-py3-none-any.whl |
|---|---|
| Size | 1.6 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6d406accbebd12906d884c7dfa787765e1fb86acc2fa4dc6dc688081d21f8fdd
|
|
BLAKE2b-256 checksum How to use checksums |
2c4301adb7b19a99421f7404545ed0fdc96a9603cabded06a57f539b07127cd6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 5, 2026.
Transparency log