Registry / ai-ml / gcld3
library3.0.13pypypi✓ verified 90d ago

Python binding for Google's Compact Language Detector v3 (CLD3), a neural network model for language identification. Version 3.0.13 is the current release; the library is stable but no longer actively developed by Google. It is typically used as a drop-in replacement for the deprecated `cld2-cffi`.

pip install gcld3
INSTALL
IMPORT
SIG · GCLD3
G
gcld3
ai-mlpythonv3.0.13
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

gcld3
✓ import gcld3
✗ from gcld3 import gcld3
gcld3 is a module; the module itself is the class factory. The typical pattern is `import gcld3; detector = gcld3.NNetLanguageIdentifier(min_num_bytes, max_num_bytes)`.

Minimal example: instantiate a language identifier and call FindLanguage on a text string.

import gcld3 detector = gcld3.NNetLanguageIdentifier(min_num_bytes=0, max_num_bytes=1000) text = "This is an example sentence in English." result = detector.FindLanguage(text) print(result.language, result.probability, result.is_reliable, result.proportion) # Output: en 0.9999 True 1.0
Debug
Known issues
deprecatedThe underlying CLD3 model from Google is no longer updated. It may perform poorly on short texts or mixed-language inputs.
fix
Consider using `fasttext-langdetect` or `langdetect` as alternatives if accuracy is critical.
affects: all
gotchaThe `gcld3` package on PyPI (version 3.0.13) is a community-maintained fork. The official Google code lives in the `cld3` repository but the pip package `cld3` is different (a different binding). Do not confuse `gcld3` with `cld3`.
fix
Always use `pip install gcld3` for this binding.
affects: all
gotcha`FindLanguage` returns a namedtuple with fields: language, probability, is_reliable, proportion. Access them as attributes, not by index.
fix
Use `result.language` and `result.probability` instead of `result[0]` and `result[1]`.
affects: all
Errors
Common errors & fixes
ImportError: cannot import name 'gcld3' from 'gcld3' (unknown location)
Incorrect import statement: trying to import a submodule that doesn't exist.
fix
Use `import gcld3` and then call `gcld3.NNetLanguageIdentifier(...)`.
AttributeError: module 'gcld3' has no attribute 'NNetLanguageIdentifier'
The shared library may not have been compiled correctly, or a very old version is installed.
fix
Upgrade to the latest version: `pip install --upgrade gcld3`. If issues persist, report to the package maintainers.
Upgrade
Version history
3.0.13latest on PyPI · released Aug 19, 2020
Audit
Dependencies

No dependency data recorded yet.

Agent activity
20 hits · last 30 days
node
18
OpenAI (training)
1
Resources
gcld3 — pip install gcld3 · libregistry