Lingua-py is an Python wrapper for the Rust lingua crate with PyO3/Maturin. This project is informal. It is expected that Python-binding will be developed officially in the future.
Lingua is a NIF-based bridge for the lingua Rust language detection library.
In imitation of Upstream, introduce basic usage.
Alternatively please see tests
section.
10.1 Basic usage
languages: list[Language] = [Language.English, Language.Japanese]
detector: LanguageDetector = LanguageDetectorBuilder.from_languages(
languages
).build()
expected: Language = Language.Japanese
actual: Language = detector.detect_language_of("これは何語ですか?")
assert actual == expected
pytest command
rye sync --no-lock
rye run python -m pytest -s -vv python/tests/small_usage/test_basic.py::test_basic
Apache License v2, and lingua-rs is also Apache License v2.