jieba-rs

用 Rust 实现的 Jieba 汉字分词法。「The Jieba Chinese Word Segmentation Implemented in Rust」

Github stars Tracking Chart

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.

Main metrics

Overview
Name With Ownermessense/jieba-rs
Primary LanguageRust
Program languageRust (Language Count: 1)
Platform
License:MIT License
所有者活动
Created At2018-05-06 09:41:22
Pushed At2025-02-25 04:26:01
Last Commit At
Release Count42
Last Release Namev0.7.2 (Posted on 2025-01-21 20:55:13)
First Release Namev0.1.0 (Posted on )
用户参与
Stargazers Count810
Watchers Count14
Fork Count50
Commits Count327
Has Issues Enabled
Issues Count49
Issue Open Count9
Pull Requests Count62
Pull Requests Open Count2
Pull Requests Close Count5
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private