1 unstable release

0.7.1 Dec 25, 2024

#2352 in Text processing

Download history 706/week @ 2024-12-25 358/week @ 2025-01-01 1242/week @ 2025-01-08 1226/week @ 2025-01-15 1203/week @ 2025-01-22 658/week @ 2025-01-29 1051/week @ 2025-02-05 892/week @ 2025-02-12 1275/week @ 2025-02-19 1945/week @ 2025-02-26 1680/week @ 2025-03-05 1435/week @ 2025-03-12 2184/week @ 2025-03-19 2557/week @ 2025-03-26 2524/week @ 2025-04-02 1682/week @ 2025-04-09

9,204 downloads per month
Used in 11 crates (via jieba-rs)

MIT license

205KB

jieba-rs

GitHub Actions codecov Crates.io docs.rs

🚀 Help me to become a full-time open-source developer by sponsoring me on GitHub

The Jieba Chinese Word Segmentation Implemented in Rust

Installation

Add it to your Cargo.toml:

[dependencies]
jieba-rs = "0.7"

then you are good to go. If you are using Rust 2015 you have to extern crate jieba_rs to your crate root as well.

Example

use jieba_rs::Jieba;

fn main() {
    let jieba = Jieba::new();
    let words = jieba.cut("我们中出了一个叛徒", false);
    assert_eq!(words, vec!["我们", "", "", "", "一个", "叛徒"]);
}

Enabling Additional Features

  • default-dict feature enables embedded dictionary, this features is enabled by default
  • tfidf feature enables TF-IDF keywords extractor
  • textrank feature enables TextRank keywords extractor
[dependencies]
jieba-rs = { version = "0.7", features = ["tfidf", "textrank"] }

Run benchmark

cargo bench --all-features

Benchmark: Compare with cppjieba

jieba-rs bindings

License

This work is released under the MIT license. A copy of the license is provided in the LICENSE file.

Dependencies

~430KB