Skip to main content

rapidrouge

A fast, threads and free-threaded, pure-Python drop-in replacement for rouge-score. Change one import and get the same scores:

from rapidrouge import rouge_scorer

 scorer = rouge_scorer.RougeScorer(["rouge1", "rouge2", "rougeL", "rougeLsum"], use_stemmer=True)
 scorer.score(target, prediction)
uv add rapidrouge              # or: pip install rapidrouge
uv add rapidrouge[stemmer]     # nltk, for `use_stemmer=True`
uv add rapidrouge[aggregate]   # numpy, for `BootstrapAggregator`
uv add rapidrouge[full] 

How fast

rapidrouge speedup over rouge_score vs document length, per rouge type

How we got here

time per document pair after each change, from rouge_score to rapidrouge

How it works

ROUGE-L needs the length of the longest common subsequence (LCS) of two token lists. rouge_score fills an n × m table, one Python step per cell. Hyyrö's algorithm keeps one row of that table as a bit-vector and updates the whole row with an addition, a subtraction and two bitwise operations. A Python int has as many bits as you need, so the row is one integer and the arithmetic runs in C:

def lcs_length(a, b):
    masks = {}                         # masks[t]: bit i is set where a[i] == t
    for i, token in enumerate(a):
        masks[token] = masks.get(token, 0) | (1 << i)
    ones = (1 << len(a)) - 1
    row = ones                         # one row of the DP table, as one big integer
    for token in b:                    # one step per token of b
        carry = row & masks.get(token, 0)
        row = ((row + carry) | (row - carry)) & ones
    return len(a) - row.bit_count()    # every zero bit is one token of the LCS

References

License

Apache-2.0. Portions derived from rouge_score (Apache-2.0); see NOTICE.

Metadata

Release files for rapidrouge 0.3.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 rapidrouge 0.3.1
File Size Uploaded Provenance Actions
rapidrouge-0.3.1.tar.gz 30.3 kB With provenance Details for rapidrouge-0.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for rapidrouge 0.3.1
File Interpreter ABI Platform Actions
rapidrouge-0.3.1-py3-none-any.whl Python 3 none any Details for rapidrouge-0.3.1-py3-none-any.whl

Total release size: 56.1 kB

Release files / rapidrouge-0.3.1.tar.gz

Download URL rapidrouge-0.3.1.tar.gz
Size 30.3 kB
Tags Source
SHA-256 checksum
How to use checksums
2c728beeba3978d31b9fc26e188f844d1d2e3763a4d46bf4f6b15af4976df516
BLAKE2b-256 checksum
How to use checksums
94f9b3dd3add87d8d7194ae76a3833dc7b55ec90cb6980aeb98c31602a171fa7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Dec 2, 2026.

Transparency log

Release files / rapidrouge-0.3.1-py3-none-any.whl

Download URL rapidrouge-0.3.1-py3-none-any.whl
Size 25.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5941b639615cf3883d6c591f7dabbbe4741bdf46fd99ae8e3d730eabf08eb964
BLAKE2b-256 checksum
How to use checksums
55fc8337505c77a2c1f5cae031fedd5f25170d73a63f0e3982b90c1296d8398d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Dec 2, 2026.

Transparency log

Security for rapidrouge 0.3.1

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for rapidrouge-0.3.1.tar.gz

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 Dec 2, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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