Registry / ai-ml / rouge-chinese

rouge-chinese

JSON →
library1.0.3pypypi✓ verified 88d ago

A Python implementation of ROUGE score specifically designed for Chinese text evaluation. It supports both character-level and word-level ROUGE-1, ROUGE-2, and ROUGE-L metrics. Version 1.0.3 is the latest, with no recent updates (last release likely 2021).

pip install rouge-chinese
INSTALL
IMPORT
SIG · ROUGE-CHINESE
R
rouge-chinese
ai-mlpythonv1.0.3
Install
1.5s avg
Import
15ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v1.0.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.016s · 18MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 1.5s · import 0.014s · 19MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

rouge
✓ from rouge_chinese import Rouge
✗ import rouge
The correct import is from rouge_chinese, not the generic 'rouge' package.

Basic usage computing ROUGE scores for Chinese text.

from rouge_chinese import Rouge # Example hypotheses and references (Chinese text) hypotheses = ["这是一个测试句子"] references = ["这是一个参考句子"] rouge = Rouge() scores = rouge.get_scores(hypotheses, references) print(scores)
Debug
Known issues
breakingThe library 'rouge-chinese' is commonly confused with 'rouge' (the general ROUGE implementation). Importing from 'rouge' instead of 'rouge_chinese' will import a different library with different API.
fix
Use 'from rouge_chinese import Rouge' instead of 'import rouge'.
affects: all
gotchaThe library returns scores as a dictionary with keys like 'rouge-1', 'rouge-2', 'rouge-l', but the output format differs from the original 'rouge' library. The 'f' key is present but some users expect 'f1-score'.
fix
Access scores via scores[0]['rouge-1']['f'] and similar.
affects: all
deprecatedThe library has not been updated since 2021 and may have compatibility issues with newer Python versions (e.g., Python 3.10+). It relies on 'jieba' which may change its API.
fix
Consider pinning dependencies (jieba==0.42.1) or switching to 'rouge' library with proper Chinese tokenization.
affects: >=1.0.0
Errors
Common errors & fixes
AttributeError: module 'rouge' has no attribute 'Rouge'
Wrong import: using 'import rouge' instead of 'from rouge_chinese import Rouge'.
fix
Install rouge-chinese and import as 'from rouge_chinese import Rouge'.
TypeError: get_scores() takes 3 positional arguments but 4 were given
Passing arguments incorrectly; the API expects (hypotheses, references) as lists of strings.
fix
Call as 'rouge.get_scores(hypotheses, references)' with two lists.
ImportError: No module named 'jieba'
Missing dependency jieba required for Chinese word segmentation.
fix
Install jieba: 'pip install jieba'.
Upgrade
Version history
1.0.3latest on PyPI · released Sep 18, 2022
Audit
Dependencies
jiebarequiredUsed for Chinese word segmentation
sixoptionalCompatibility with Python 2/3
Agent activity
25 hits · last 30 days
node
18
OpenAI (training)
1
Resources
rouge-chinese — pip install rouge-chinese · libregistry