Repository navigation
Releases: SyntaxSpirits/rougers
Release list
rougers 0.2.1
About 2.5 times faster on one core, with identical scores.
- Tokens are written into one buffer per text and interned without a string per token;
stemming works in place. rouge1counts in a dense array androuge2uses packed bigram keys;rougeLuses
Hyyrö's bit-parallel LCS, with a linear-memory fallback for very large inputs.- The Python binding builds the result dicts in Rust.
- Scorers pickled by 0.1.0 load correctly.
On CNN/DailyMail, XSum and PubMed samples (2,000 pairs each, M1 Pro) scoring is now 30–80× faster than rouge-score on one core and 80–350× with eight threads, and faster than rouge-rust on the ROUGE-1/2/L subset it supports. Details in BENCHMARKS.md.
pip install -U rouge-score-rsrougers 0.2.0
Opt-in tokenizers for languages other than English. rouge-score keeps only [a-z0-9], so Russian, Arabic, Hindi or Chinese text scores zero; the default tokenizer and its scores stay exactly as before.
from rouge_score_rs import rouge_scorer, tokenizers
scorer = rouge_scorer.RougeScorer(["rouge1", "rougeL"], tokenizer=tokenizers.UnicodeTokenizer())
chinese = rouge_scorer.RougeScorer(["rouge1", "rougeL"], tokenizer=tokenizers.CharacterTokenizer())UnicodeTokenizer(profileunicode-v1): Unicode word boundaries after NFKC and full
case folding, for languages in any script.CharacterTokenizer(profilecharacter-v1): one token per grapheme cluster after the
same normalization, for character-level ROUGE such as in Chinese.- Both profiles use pinned Unicode 17.0 data, so tokens do not depend on the platform or
the Rust version. - Both run natively, including in parallel
score_batch. The default tokenizer is
unchanged. - Rust:
Tokenizer::unicode,Tokenizer::characterandTokenizer::profile.
Minimum Rust version 1.88.
This release also replaces the synthetic benchmark with measurements on CNN/DailyMail, XSum and PubMed.
pip install -U rouge-score-rsrouge-score-rs 0.1.1
Python package only; the Rust crate is unchanged.
score_batchno longer hangs in a process forked after it ran in the parent; such
processes score on a single thread.- Pickling and
copy.deepcopykeep the__slots__of subclasses. - Changing
use_stemmeron a scorer's tokenizer after construction takes effect. score_multiandscore_batchrespect ascoremethod replaced on the instance.tokenize.tokenizeaccepts stemmers that returnbytes, likerouge-score.
pip install -U rouge-score-rsrougers 0.1.0
First release.
rougers is a Rust implementation of ROUGE whose scores are bit-for-bit identical to Google's rouge-score, including its tokenizer, NLTK's Porter stemmer and the summary-level rougeLsum.
Install
pip install rouge-score-rsfrom rouge_score_rs import rouge_scorer # was: from rouge_score import rouge_scorerRust: rougers = "0.1" (crates.io).
Highlights
rouge1–rouge9,rougeLandrougeLsum, with the samerouge_scorer,scoring,tokenizeandtokenizersmodules asrouge-score.score_batchscores many pairs on all CPU cores without holding the GIL.- No required Python dependencies; NumPy and NLTK are optional extras for bootstrap aggregation and
split_summaries. - Wheels for Linux (x86_64, aarch64, glibc and musl), macOS (Intel and Apple Silicon) and Windows, for Python 3.9 and newer.
Performance
10,000 English text pairs, about 60 words each, rouge1, rouge2, rougeL, rougeLsum with stemming, Apple M1 Pro:
| pairs per second | speedup | |
|---|---|---|
rouge-score 0.1.2 |
590 | 1× |
score() |
17,078 | 29× |
score_batch(), 8 threads |
83,957 | 142× |
See the README for how compatibility is tested and the few known differences.