py3langid is an actively maintained fork of the original `langid.py` library, specializing in fast and accurate language identification. It is optimized for Python 3 environments, featuring a modernized codebase and improved execution speeds. The library's current version is 0.3.0, with a release cadence that reflects ongoing enhancements and bug fixes.
pip install py3langidVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates basic language classification using `py3langid.classify()`. It also shows how to use `LanguageIdentifier` for more control, such as enabling probability normalization to get scores between 0 and 1.
Upgrade Python to 3.8 or newer, or pin `py3langid<0.3.0` in your project dependencies.
If inconsistent results are observed or specific `uint32` typing is required, pass `datatype='uint32'` to the `classify()` method or `LanguageIdentifier` constructor (e.g., `langid.classify(text, datatype='uint32')`).
For training new models, refer to the original `langid.py` project's documentation and Python 2 environment setup. `py3langid` primarily focuses on the classification aspect in Python 3.