rjieba is a high-performance Python binding for the `jieba-rs` Rust library, offering efficient Chinese word segmentation. It aims to provide faster processing speeds compared to pure Python implementations by leveraging Rust's performance. The current version is 0.2.0. Releases are infrequent and typically driven by significant updates to the underlying `jieba-rs` library or `pyo3` binding infrastructure.
pip install rjiebaVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates basic Chinese word segmentation and part-of-speech tagging using `rjieba.cut` and `rjieba.tag` functions. No explicit dictionary initialization is required as dictionaries are embedded by default.
Simply import `rjieba` and use its functions directly. Do not look for an `initialize` method.
Ensure your environment is supported by available wheels. If not, install Rust (via `rustup`) and related build tools before attempting `pip install rjieba`.
Refer to the `jieba-rs` GitHub repository (https://github.com/messense/jieba-rs) for changes in the core Rust library when updating `rjieba`.
Run `pip install rjieba` again. If it fails with compilation errors, ensure you have Rust and a C compiler installed, or check if your platform is supported by pre-built wheels.
Explicitly ensure all input text is handled as UTF-8. When reading files, specify `encoding='utf-8'` (e.g., `open('file.txt', 'r', encoding='utf-8')`). If dealing with external data, convert it to UTF-8 before passing to `rjieba`.