Simple, fast dictionary-based language detector
Project description
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
Project details
Release history Release notifications | RSS feed
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 lexilang-1.0.7.tar.gz.
File metadata
- Download URL: lexilang-1.0.7.tar.gz
- Upload date:
- Size: 1.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
195fcc02b28366e6e71484ffba77f7dc1dcc962ecf9633322f79305b9f6605f7
|
|
| MD5 |
e8262f53cccc840af37ed92eba264470
|
|
| BLAKE2b-256 |
8598695b7a5c3c7e77880d0dd7684920d1cf059874b2a3873a7eb7496ab9cb45
|
Provenance
The following attestation bundles were made for lexilang-1.0.7.tar.gz:
Publisher:
publish.yml on LibreTranslate/LexiLang
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lexilang-1.0.7.tar.gz -
Subject digest:
195fcc02b28366e6e71484ffba77f7dc1dcc962ecf9633322f79305b9f6605f7 - Sigstore transparency entry: 920020164
- Sigstore integration time:
-
Permalink:
LibreTranslate/LexiLang@2888ee73e7eccb0f692d2f7a78ea6bd0f7c8d65b -
Branch / Tag:
refs/tags/v1.0.7 - Owner: https://github.com/LibreTranslate
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2888ee73e7eccb0f692d2f7a78ea6bd0f7c8d65b -
Trigger Event:
release
-
Statement type:
File details
Details for the file lexilang-1.0.7-py3-none-any.whl.
File metadata
- Download URL: lexilang-1.0.7-py3-none-any.whl
- Upload date:
- Size: 1.6 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6d406accbebd12906d884c7dfa787765e1fb86acc2fa4dc6dc688081d21f8fdd
|
|
| MD5 |
7819376982e0b1edb522a63ca3762d2a
|
|
| BLAKE2b-256 |
2c4301adb7b19a99421f7404545ed0fdc96a9603cabded06a57f539b07127cd6
|
Provenance
The following attestation bundles were made for lexilang-1.0.7-py3-none-any.whl:
Publisher:
publish.yml on LibreTranslate/LexiLang
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lexilang-1.0.7-py3-none-any.whl -
Subject digest:
6d406accbebd12906d884c7dfa787765e1fb86acc2fa4dc6dc688081d21f8fdd - Sigstore transparency entry: 920020166
- Sigstore integration time:
-
Permalink:
LibreTranslate/LexiLang@2888ee73e7eccb0f692d2f7a78ea6bd0f7c8d65b -
Branch / Tag:
refs/tags/v1.0.7 - Owner: https://github.com/LibreTranslate
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2888ee73e7eccb0f692d2f7a78ea6bd0f7c8d65b -
Trigger Event:
release
-
Statement type: