Skip to content

Releases: SyntaxSpirits/rougers

rougers 0.2.1

Choose a tag to compare

@kholdrex kholdrex released this 11 Oct 04:21
8ddaec4

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.
  • rouge1 counts in a dense array and rouge2 uses packed bigram keys; rougeL uses
    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-rs

rougers 0.2.0

Choose a tag to compare

@kholdrex kholdrex released this 11 Oct 03:19
1ed3a3b

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 (profile unicode-v1): Unicode word boundaries after NFKC and full
    case folding, for languages in any script.
  • CharacterTokenizer (profile character-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::character and Tokenizer::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-rs

rouge-score-rs 0.1.1

Choose a tag to compare

@kholdrex kholdrex released this 11 Oct 01:23
a960e0e

Python package only; the Rust crate is unchanged.

  • score_batch no longer hangs in a process forked after it ran in the parent; such
    processes score on a single thread.
  • Pickling and copy.deepcopy keep the __slots__ of subclasses.
  • Changing use_stemmer on a scorer's tokenizer after construction takes effect.
  • score_multi and score_batch respect a score method replaced on the instance.
  • tokenize.tokenize accepts stemmers that return bytes, like rouge-score.
pip install -U rouge-score-rs

rougers 0.1.0

Choose a tag to compare

@kholdrex kholdrex released this 11 Oct 00:41
544a397

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-rs
from rouge_score_rs import rouge_scorer  # was: from rouge_score import rouge_scorer

Rust: rougers = "0.1" (crates.io).

Highlights

  • rouge1–rouge9, rougeL and rougeLsum, with the same rouge_scorer, scoring, tokenize and tokenizers modules as rouge-score.
  • score_batch scores 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.