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.0

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.0
File Size Uploaded Provenance Actions
rapidrouge-0.3.0.tar.gz 30.3 kB With provenance Details for rapidrouge-0.3.0.tar.gz

Built distribution (wheel)

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

Total release size: 56.1 kB

Release files / rapidrouge-0.3.0.tar.gz

Download URL rapidrouge-0.3.0.tar.gz
Size 30.3 kB
Tags Source
SHA-256 checksum
How to use checksums
57e589f1df6a9a5dc123b5cc23875ed4aaaab6bdfd6db2f87c469460a7a5eb37
BLAKE2b-256 checksum
How to use checksums
6da5f57f8e559d0903e54ea174b41aa52d5eeb1ff9773bbc2b9eb5094ac38de6
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.0-py3-none-any.whl

Download URL rapidrouge-0.3.0-py3-none-any.whl
Size 25.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ce7b4e9bad1778d9e602e3c97334eac6dba2113bc08fecfbdf756a20ee070270
BLAKE2b-256 checksum
How to use checksums
2fb7e5bc87152b4805ee104ca2aeb0904f5db211690660fac9928de1df3eba21
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.0

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.0.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