Registry / ai-ml / pycld3

pycld3

JSON →
library0.22pypypiunverified

Python CFFI bindings for Google's Compact Language Detector v3 (CLD3). Provides language detection with a compact neural network. Current version is 0.22. Releases are infrequent; no active development since 2020.

pip install pycld3
INSTALL
IMPORT
SIG · PYCLD3
P
pycld3
ai-mlpythonv0.22
Install
2.3s avg
Import
Disk
59MB
Pass rate
1/ 10
Env Coverage1 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.22 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✕ build_error
✕ build_error
py 3.11
✕ build_error
✕ build_error
py 3.12
✕ build_error
✕ build_error
py 3.13
✕ build_error
✕ build_error
py 3.9
✕ build_error
✓ 2.3s
59MB installed
● package 59MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

pycld3
import pycld3
import cld3
The package name on PyPI is pycld3, but the module is imported as pycld3. A common mistake is to import cld3 (which matches the Google library name).

Basic usage of pycld3 to detect language of a string and get top N languages.

import pycld3 # Detect language of a text result = pycld3.classify('This is a test') print(result) # LanguageResult(language='en', probability=0.9999, reliable=True) # Get top N languages results = pycld3.top_n('This is a test', 3) print(results) # [LanguageResult(language='en', ...), ...] # Language identification for multiple texts for text in ['Bonjour', 'Hola', 'Hello']: result = pycld3.classify(text) print(f"{text} -> {result.language}")
Debug
Known issues
breakingPython 3.6+ only: pycld3 0.22 drops support for Python 3.5 and earlier. Import error on older versions.
fix
Use Python 3.6 or newer.
affects: >=0.22
gotchaCheck for reliable flag: The language detection may return a low probability result. Always check the `reliable` boolean attribute before trusting the output.
fix
if not result.reliable: handle uncertain detection.
affects: all
gotchaThread safety: The underlying C library is not thread-safe. Do not call classify or top_n concurrently from multiple threads without locking.
fix
Use locks or single-threaded access.
affects: all
deprecatedThe `cld3` import alias (import cld3) was removed in version 0.22. Use `import pycld3`.
fix
Change import from cld3 to pycld3.
affects: >=0.22
Upgrade
Version history
0.22latest on PyPI · released Mar 9, 2021
Audit
Dependencies

No dependency data recorded yet.

Agent activity
27 hits · last 30 days
node
24
OpenAI (training)
1
Resources
pycld3 — pip install pycld3 · libregistry