whatlangid
This project is build on top of whatthelang and langid
Why this project exist?
see issue_lang.py
Dependencies
The dependencies can be installed using the requirements.txt file:
$ pip install -r requirements.txt
Install
from github
$ pip install git+https://github.com/bung87/whatlangid
from pypi
$ pip install whatlangid
Basic Usage
Predicting Language using whatlangid
>>> from whatlangid import WhatLangId
>>> wtl = WhatLangId()
>>> wtl.predict_lang("Mother")
'en'
>>> wtl.predict_lang("தாய்")
'ta'
>>> wtl.predict_lang("അമ്മ")
'ml'
>>> wtl.predict_lang("पिता")
'hi'
>>> wtl.predict_pro(["English sentence", "അമ്മ"])
[('en', 0.8848170638084412), ('ml', 0.9535570740699768)]
Batch Prediction is also supported
>>>wtl.predict_lang(["അമ്മ","पिता","teacher"])
['ml','hi','en']
Advanced usage
wtl = WhatLangId(custom_model=abs_path)
use bin version model which is faster and slightly more accurate, but has a file size of 126MB
python -m whatlangid.use_bin
Supported Languages
Supports 176 languages . The ISO codes for the corresponding languages are as below.
af als am an ar arz as ast av az azb ba bar bcl be bg bh bn bo bpy br bs bxr ca cbk
ce ceb ckb co cs cv cy da de diq dsb dty dv el eml en eo es et eu fa fi fr frr fy ga
gd gl gn gom gu gv he hi hif hr hsb ht hu hy ia id ie ilo io is it ja jbo jv ka kk km
kn ko krc ku kv kw ky la lb lez li lmo lo lrc lt lv mai mg mhr min mk ml mn mr mrj ms
mt mwl my myv mzn nah nap nds ne new nl nn no oc or os pa pam pfl pl pms pnb ps pt qu
rm ro ru rue sa sah sc scn sco sd sh si sk sl so sq sr su sv sw ta te tg th tk tl tr
tt tyv ug uk ur uz vec vep vi vls vo wa war wuu xal xmf yi yo yue zh
Model Training Details
Quantized model built using Fasttext. More details present in the fasttext blog
Reference
WhatLangId is powered by FastText and langid
Enriching Word Vectors with Subword Information
[1] P. Bojanowski*, E. Grave*, A. Joulin, T. Mikolov, Enriching Word Vectors with Subword Information
@article{bojanowski2016enriching,
title={Enriching Word Vectors with Subword Information},
author={Bojanowski, Piotr and Grave, Edouard and Joulin, Armand and Mikolov, Tomas},
journal={arXiv preprint arXiv:1607.04606},
year={2016}
}
Bag of Tricks for Efficient Text Classification
[2] A. Joulin, E. Grave, P. Bojanowski, T. Mikolov, Bag of Tricks for Efficient Text Classification
@article{joulin2016bag,
title={Bag of Tricks for Efficient Text Classification},
author={Joulin, Armand and Grave, Edouard and Bojanowski, Piotr and Mikolov, Tomas},
journal={arXiv preprint arXiv:1607.01759},
year={2016}
}
FastText.zip: Compressing text classification models
[3] A. Joulin, E. Grave, P. Bojanowski, M. Douze, H. Jégou, T. Mikolov, FastText.zip: Compressing text classification models
@article{joulin2016fasttext,
title={FastText.zip: Compressing text classification models},
author={Joulin, Armand and Grave, Edouard and Bojanowski, Piotr and Douze, Matthijs and J{\'e}gou, H{\'e}rve and Mikolov, Tomas},
journal={arXiv preprint arXiv:1612.03651},
year={2016}
}
Metadata
Release files for whatlangid 1.0.11
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| whatlangid-1.0.11.tar.gz | 790.1 kB | Without provenance | Details for whatlangid-1.0.11.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| whatlangid-1.0.11-py3-none-any.whl | Python 3 | none | any | Details for whatlangid-1.0.11-py3-none-any.whl |
Total release size: 1.6 MB
Release files / whatlangid-1.0.11.tar.gz
| Download URL | whatlangid-1.0.11.tar.gz |
|---|---|
| Size | 790.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d09105f83fcef93185bf3b4f9a1aaf77886b2fefff818b4e3520f0181ca2ddfa
|
|
BLAKE2b-256 checksum How to use checksums |
ede0293d296e4b8b363ad3759d1d754f33f15a3ad8cd44b1baec8a6599bdcd14
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/37.0.0 requests-toolbelt/0.8.0 tqdm/4.37.0 CPython/2.7.15
|
Release files / whatlangid-1.0.11-py3-none-any.whl
| Download URL | whatlangid-1.0.11-py3-none-any.whl |
|---|---|
| Size | 786.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f852cbc68826ae123f0a6937aaba4985ff4dc75d01a57b5b90da4e4af0487709
|
|
BLAKE2b-256 checksum How to use checksums |
9dde6c7a11980850f278cc0f6c8f03b1b39731e6455896188d391f02c013858f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/37.0.0 requests-toolbelt/0.8.0 tqdm/4.37.0 CPython/2.7.15
|
Security for whatlangid 1.0.11
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.