CLD3 Python bindings
Project description
pycld3
Python bindings to the Compact Language Detector v3 (CLD3).
This package contains Python bindings (via Cython) to Google's CLD3 library.
To build this extension, you will need:
Building the extension does not require the Chromium repository.
Usage
cld3 exports two module-level functions, get_language() and get_frequent_languages():
>>> import cld3
>>> cld3.get_language("影響包含對氣候的變化以及自然資源的枯竭程度")
LanguagePrediction(language='zh', probability=0.999969482421875, is_reliable=True, proportion=1.0)
>>> cld3.get_language("This is a test")
LanguagePrediction(language='en', probability=0.9999980926513672, is_reliable=True, proportion=1.0)
>>> for lang in cld3.get_frequent_languages(
... "This piece of text is in English. Този текст е на Български.",
... num_langs=3
... ):
... print(lang)
...
LanguagePrediction(language='bg', probability=0.9173890948295593, is_reliable=True, proportion=0.5853658318519592)
LanguagePrediction(language='en', probability=0.9999790191650391, is_reliable=True, proportion=0.4146341383457184)
LanguagePrediction(language='und', probability=0.0, is_reliable=False, proportion=0.0)
FAQ
cld3 incorrectly detects my input, how can I fix this?
In some cases, you cannot. Language detection algorithms in general may perform poorly with very short inputs.
Rarely should you trust the output of something like detect("hi"). Keep this limitation in mind regardless
of what library you are using.
How do I fix an error telling me "The Protobuf compiler, protoc, could not be found"?
The Protobuf compiler, protoc, is required for installing this package.
Below are some quick install commands, but please consult the official protobuf repository for information on installing Protobuf.
Ubuntu Linux:
$ sudo apt-get update
$ sudo apt-get install protobuf-compiler
Mac OSX:
$ brew update && brew install protobuf
Authors
This repository contains a fork of google/cld3 at commit 06f695f. The license for google/cld3 can be found at
LICENSES/CLD3_LICENSE.
This repository is a combination of changes introduced by various forks of google/cld3 by the following people:
- Johannes Baiter (@jbaiter)
- Elizabeth Myers (@Elizafox)
- Witold Bołt (@houp)
- Alfredo Luque (@iamthebot)
- WISESIGHT (@ThothMedia)
- RNogales (@RNogales94)
- Brad Solomon (@bsolomon1124)
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 pycld3-0.3.tar.gz.
File metadata
- Download URL: pycld3-0.3.tar.gz
- Upload date:
- Size: 715.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe2a4e72473020a4c1eaa996e265ae181dd73a52902d11e8a464746876683c91
|
|
| MD5 |
995fbb2df40a60e37c03aed740590875
|
|
| BLAKE2b-256 |
f102c301433cb8115908f57ff4a7877ca8a23fdeac78ce9d19e0bc09da70787d
|
File details
Details for the file pycld3-0.3-cp37-cp37m-macosx_10_14_x86_64.whl.
File metadata
- Download URL: pycld3-0.3-cp37-cp37m-macosx_10_14_x86_64.whl
- Upload date:
- Size: 513.4 kB
- Tags: CPython 3.7m, macOS 10.14+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dad150e0580e7be13121c6332e77a600a5f0239d3ad456731b40704a940c55c5
|
|
| MD5 |
3a884c3dad2075362f0c6d3004e313d9
|
|
| BLAKE2b-256 |
31d7421a6ce6d03d9620dbd763cf8ae7288511602a15f45e622807e7f747ec5a
|