Skip to main content

rougers

CI PyPI Crates.io License

ROUGE metrics in Rust, with scores identical to Google's rouge-score, about 30 times faster on one core and over 100 times faster on all of them.

rouge-score is the reference implementation behind Hugging Face evaluate, most summarization papers and many LLM evaluation pipelines. It is written in pure Python and becomes the bottleneck once you score tens of thousands of outputs. rougers reproduces it exactly, down to the last bit of every float, including the tokenizer, NLTK's Porter stemmer and the summary-level rougeLsum.

The Rust crate is rougers; the Python package built on it is rouge-score-rs. This is an independent project, not affiliated with Google or the authors of rouge-score.

Python

pip install rouge-score-rs

Change the import and keep the rest of your code:

from rouge_score_rs import rouge_scorer  # was: from rouge_score import rouge_scorer

scorer = rouge_scorer.RougeScorer(["rouge1", "rouge2", "rougeL", "rougeLsum"], use_stemmer=True)
scores = scorer.score(
    "The quick brown fox jumps over the lazy dog",
    "The quick brown dog jumps on the log.",
)
scores["rouge1"]
# Score(precision=0.75, recall=0.6666666666666666, fmeasure=0.7058823529411765)

score_multi, custom tokenizers, split_summaries, scoring.BootstrapAggregator and tokenize.tokenize work the same way as in rouge-score, and scorers can be pickled for use in worker processes.

To score many pairs, use score_batch. With the default tokenizer it runs on all CPU cores and releases the GIL:

results = scorer.score_batch(references, predictions)  # list of dicts, one per pair

Set RAYON_NUM_THREADS to limit the number of threads. With a custom tokenizer or split_summaries=True, and in a process forked after a parallel call, pairs are scored one by one.

Rust

[dependencies]
rougers = "0.1"
use rougers::{RougeScorer, RougeType};

let scorer = RougeScorer::new(["rouge1", "rougeL"], true)?;
let scores = scorer.score(
    "The quick brown fox jumps over the lazy dog",
    "The quick brown dog jumps on the log.",
);
let rouge_l = scores.get(RougeType::L).unwrap();
println!("{:.4}", rouge_l.fmeasure);

RougeScorer is Send + Sync, so it can be shared across threads, for example with Rayon.

Performance

10,000 pairs of English text from the NLTK Gutenberg corpus, about 60 words each, with rouge1, rouge2, rougeL, rougeLsum and stemming. Measured on an Apple M1 Pro with Python 3.12:

seconds pairs per second speedup
rouge-score 0.1.2 16.95 590 1×
rouge-score-rs score() 0.59 17,078 29×
rouge-score-rs score_batch(), 8 threads 0.12 83,957 142×

The script asserts that all three produce the same scores. To reproduce:

cd bindings/python
python benchmarks/compare.py --pairs 10000

Compatibility

The test suite compares rouge-score-rs with rouge-score and fails on any difference in any float:

  • the stemmer against NLTK on all 235,976 words of a system dictionary (NLTK 3.8–3.10 stem them identically);
  • tokenization against Python's str.lower for every Unicode code point;
  • thousands of random texts with repeated words, punctuation, digits, newlines and non-Latin scripts, plus property-based tests on arbitrary Unicode;
  • score_multi, custom tokenizers, split_summaries and bootstrap aggregation with a fixed NumPy seed.

Known differences:

  • An invalid ROUGE type raises ValueError when the scorer is created, not on the first call to score. Type names must be exactly rouge1…rouge9, rougeL or rougeLsum.
  • Texts must be str; rouge-score also accepts UTF-8 bytes.
  • BootstrapAggregator needs NumPy (pip install 'rouge-score-rs[aggregate]') and split_summaries=True needs NLTK (pip install 'rouge-score-rs[sentences]'). Without them, rouge-score-rs has no Python dependencies.

Development

cargo test -p rougers
cd bindings/python
uv sync --group dev
uv run pytest

License

Apache-2.0, the same licence as rouge-score and NLTK, whose scoring, tokenization and stemming logic this project ports. See NOTICE.

Metadata

Release files for rouge-score-rs 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rouge-score-rs 0.1.1
File Size Uploaded
rouge_score_rs-0.1.1.tar.gz 110.8 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for rouge-score-rs 0.1.1
File
rouge_score_rs-0.1.1-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details
rouge_score_rs-0.1.1-cp39-abi3-musllinux_1_2_x86_64.whl CPython 3.9 abi3 Linux musl 1.2+ x86-64 Details
rouge_score_rs-0.1.1-cp39-abi3-musllinux_1_2_aarch64.whl CPython 3.9 abi3 Linux musl 1.2+ ARM64 Details
rouge_score_rs-0.1.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details
rouge_score_rs-0.1.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.9 abi3 Linux glibc 2.17+ ARM64 Details
rouge_score_rs-0.1.1-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details
rouge_score_rs-0.1.1-cp39-abi3-macosx_10_12_x86_64.whl CPython 3.9 abi3 macOS 10.12+ x86-64 Details

Total release size: 2.7 MB

Release files / rouge_score_rs-0.1.1.tar.gz

Download URL rouge_score_rs-0.1.1.tar.gz
Size 110.8 kB
Tags Source
SHA-256 checksum
How to use checksums
3668e03db5f816a1f502cab3902d695e4f326f2c99a3aa436abc1ac70cd2d270
BLAKE2b-256 checksum
How to use checksums
a898a4a45a8125f80f04344f1063a4f911c8f6c028dec3484e4095932919e09a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 11, 2026.

Transparency log

Release files / rouge_score_rs-0.1.1-cp39-abi3-win_amd64.whl

Download URL rouge_score_rs-0.1.1-cp39-abi3-win_amd64.whl
Size 209.3 kB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
9af26ffd8c3e7db6f360538be40ef40fa82decd5e3d83dbb1ebdaba46305829a
BLAKE2b-256 checksum
How to use checksums
6b272656e4a28a3445848dde2ad78a23e5b81de5d96225cfde1336485839057a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 11, 2026.

Transparency log

Release files / rouge_score_rs-0.1.1-cp39-abi3-musllinux_1_2_x86_64.whl

Download URL rouge_score_rs-0.1.1-cp39-abi3-musllinux_1_2_x86_64.whl
Size 559.3 kB
Tags CPython 3.9 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
49eac492c9ef98859748b9ed9338ad501cf2486124bb14686f32778abc9a1c95
BLAKE2b-256 checksum
How to use checksums
10074504508c4156bbcf2deb0c5e1d39ef6ab4c767e6b1f88017f634ffc36218
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 11, 2026.

Transparency log

Release files / rouge_score_rs-0.1.1-cp39-abi3-musllinux_1_2_aarch64.whl

Download URL rouge_score_rs-0.1.1-cp39-abi3-musllinux_1_2_aarch64.whl
Size 523.4 kB
Tags CPython 3.9 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
314f39d9c0031313f1d6e18615fcfcebfc36f763eebf53a85dba20ea0dba8f11
BLAKE2b-256 checksum
How to use checksums
7c509d6637fb0c9e60301ad95797fd67e2776e7710ba18b18d2e17eb60dae104
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 11, 2026.

Transparency log

Release files / rouge_score_rs-0.1.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL rouge_score_rs-0.1.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 346.9 kB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
edd0e8f925b7402792c715bbd7de662296b1978e8837e00b1bd7714ffc8d5585
BLAKE2b-256 checksum
How to use checksums
792811059e8b9e269d617e8974df892c9b3623d5a10a587a2ae9f3ca1b461de7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 11, 2026.

Transparency log

Release files / rouge_score_rs-0.1.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL rouge_score_rs-0.1.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 345.7 kB
Tags CPython 3.9 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
61b1ca6887eb1163f47a765c51954875cacdda0d085fd62af1ff299468f9907e
BLAKE2b-256 checksum
How to use checksums
5973e0e4401763c0374a95473ccf0ab552297b251cb26a283a20430d61c1e472
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 11, 2026.

Transparency log

Release files / rouge_score_rs-0.1.1-cp39-abi3-macosx_11_0_arm64.whl

Download URL rouge_score_rs-0.1.1-cp39-abi3-macosx_11_0_arm64.whl
Size 304.0 kB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
d04046849c23b5a03b706eb8f9eb1010aa023893bbd56fcaae4e51436b27789d
BLAKE2b-256 checksum
How to use checksums
96a77f86345e15822c3c2d1eedf4be239f347c3cad75f34f9df30d060d124fab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 11, 2026.

Transparency log

Release files / rouge_score_rs-0.1.1-cp39-abi3-macosx_10_12_x86_64.whl

Download URL rouge_score_rs-0.1.1-cp39-abi3-macosx_10_12_x86_64.whl
Size 308.1 kB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
905f5ea334308a9c5db159228a0a1a10db2f593bed360da1628d453945914cd4
BLAKE2b-256 checksum
How to use checksums
6915f5c4f040924b606957a27c33bb6f94558b6c35051c58f0e111a3b7ba054b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 11, 2026.

Transparency log

Release history Release notifications | RSS feed

0.2.1

8 release files

0.2.0

8 release files

This release

0.1.1 This release

8 release files

0.1.0

8 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page