Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Description: # langua
A faster port of https://code.google.com/archive/p/language-detection/ in Python
Installation
============
$ pip install langua
Supported Python versions 2.7, 3.4+.
Languages
=========
``langua`` supports 55 languages out of the box ([ISO 639-1 codes](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes)):
af, ar, bg, bn, ca, cs, cy, da, de, el, en, es, et, fa, fi, fr, gu, he,
hi, hr, hu, id, it, ja, kn, ko, lt, lv, mk, ml, mr, ne, nl, no, pa, pl,
pt, ro, ru, sk, sl, so, sq, sv, sw, ta, te, th, tl, tr, uk, ur, vi, zh-cn, zh-tw
Basic usage
===========
To detect the language of the text:
```python
>>> from langua import Predict
>>> p = Predict()
>>> p.get_lang("Mother")
'en'
>>> p.get_lang(u"தாய்")
'ta'
>>> p.get_lang(u"അമ്മ")
'ml'
```
Benchmark Results
==================
```python
>>> from langua import Predict
>>> p = Predict()
>>> %%timeit
...: p.get_lang(u"ഇംഗ്ലീഷ്")
...:
1000 loops, best of 3: 721 µs per loop
>>> from langdetect import detect
>>> %%timeit
...: detect(u"ഇംഗ്ലീഷ്")
1000 loops, best of 3: 1.07 ms per loop
```
How to add new language?
========================
You need to create a new language profile. The easiest way to do it is to use the [langdetect.jar](https://github.com/shuyo/language-detection/raw/master/lib/langdetect.jar) tool, which can generate language profiles from Wikipedia abstract database files or plain text.
Wikipedia abstract database files can be retrieved from "Wikipedia Downloads" ([http://download.wikimedia.org/](http://download.wikimedia.org/)). They form '(language code)wiki-(version)-abstract.xml' (e.g. 'enwiki-20101004-abstract.xml' ).
usage: ``java -jar langdetect.jar --genprofile -d [directory path] [language codes]``
- Specify the directory which has abstract databases by -d option.
- This tool can handle gzip compressed file.
Remark: The database filename in Chinese is like 'zhwiki-(version)-abstract-zh-cn.xml' or zhwiki-(version)-abstract-zh-tw.xml', so that it must be modified 'zh-cnwiki-(version)-abstract.xml' or 'zh-twwiki-(version)-abstract.xml'.
To generate language profile from a plain text, use the genprofile-text command.
usage: ``java -jar langdetect.jar --genprofile-text -l [language code] [text file path]``
For more details see [language-detection Wiki](https://code.google.com/archive/p/language-detection/wikis/Tools.wiki).
Original project
================
This is a vectorized modification of [Langdetect](https://github.com/Mimino666/langdetect) . There are some numpy optimizations and other tweaks
which have improved the performance of predicting the language class.
LangDetect was a port of another project called [language-detection](https://code.google.com/p/language-detection/)
Pushing to PyPi
=================
Refer [this](https://packaging.python.org/tutorials/distributing-packages/)
Keywords: language detection library
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Metadata
Release files for langua 1.0.12
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 |
|---|---|---|---|---|
| langua-1.0.12.tar.gz | 980.5 kB | Without provenance | Details for langua-1.0.12.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| langua-1.0.12-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for langua-1.0.12-py2.py3-none-any.whl |
Total release size: 2.0 MB
Release files / langua-1.0.12.tar.gz
| Download URL | langua-1.0.12.tar.gz |
|---|---|
| Size | 980.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fb427fbb0f3ef2964f896827f1d2e8e598d7dc85a957428388fad20b2f471d2f
|
|
BLAKE2b-256 checksum How to use checksums |
4072ff0c66aa136aa97e2659cbe479d7ad302b165b3654a3faaa8f872e755aae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / langua-1.0.12-py2.py3-none-any.whl
| Download URL | langua-1.0.12-py2.py3-none-any.whl |
|---|---|
| Size | 993.5 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
afbfe391bb1b57c481a91315daa4ba0385d2220dfdc45bc104b3260fc90732ee
|
|
BLAKE2b-256 checksum How to use checksums |
083130677026b1f65b69ace8d0de546b08f3c94373921779f17f512840c6cc38
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for langua 1.0.12
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.