rjieba

jieba-rs Python binding

MIT 15 个版本
messense <messense@icloud.com> <messense <messense@icloud.com>>
安装
pip install rjieba
poetry add rjieba
pipenv install rjieba
conda install rjieba
描述

rjieba-py

CI PyPI

jieba-rs Python binding.

Installation

pip install rjieba

Usage

import rjieba


print(rjieba.cut('我们中出了一个叛徒'))
print(rjieba.tag('我们中出了一个叛徒'))

Performance

Running on MacBook Pro (15-inch, 2018) 2.2 GHz 6-Core Intel Core i7

In [1]: import jieba

In [2]: import cjieba

In [3]: import rjieba

In [4]: jieba.initialize()
Building prefix dict from the default dictionary ...
Loading model from cache /var/folders/8d/h3lyjgz14296j_lw7chgf5hc0000gp/T/jieba.cache
Loading model cost 0.695 seconds.
Prefix dict has been built successfully.

In [5]: cjieba.initialize()

In [6]: with open('../jieba-rs/examples/weicheng/src/weicheng.txt') as f:
   ...:     txt = f.read()
   ...:

In [7]: %timeit list(jieba.cut(txt))
1.1 s ± 10.6 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)

In [8]: %timeit cjieba.cut(txt)
225 ms ± 3.95 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)

In [9]: %timeit rjieba.cut(txt)
106 ms ± 2.01 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)

License

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

版本列表
0.2.1 2026-04-25
0.2.0 2026-02-02
0.1.13 2025-01-13
0.1.11 2022-02-12
0.1.10 2021-07-04
0.1.9 2021-05-30
0.1.8 2021-05-09
0.1.7 2021-02-22
0.1.6 2021-02-21
0.1.5 2021-02-19
0.1.4 2021-02-15
0.1.3 2021-01-10
0.1.2 2020-11-17
0.1.1 2020-09-15
0.1.0 2020-09-15