Skip to main content

Fast pure-Python drop-in replacement for rouge-score with a bit-parallel ROUGE-L

Project description

rapidrouge

⚠️⚠️⚠️ This repository was build with AI ⚠️⚠️⚠️

A fast, pure-Python drop-in replacement for rouge-score.

uv add rapidrouge          # pure-Python, ZERO runtime deps — installs anywhere

Optional extras: rapidrouge[stemmer] (nltk, for use_stemmer=True), rapidrouge[aggregate] (numpy, for BootstrapAggregator), or rapidrouge[full].

Same import, same results as rouge_score 0.1.2 — ROUGE-L's LCS length is computed with the Hyyrö bit-parallel algorithm, so it's far faster on long documents:

from rapidrouge import rouge_scorer
scorer = rouge_scorer.RougeScorer(["rouge1", "rougeL"], use_stemmer=False)
scorer.score("the quick brown fox", "quick brown the fox")["rougeL"].fmeasure  # 0.75

Benchmarks

ROUGE-L is where the bit-parallel kernel pays off, and the win grows with document length. From ~10× on a sentence to ~900× on a 35k-token document (115 ms vs ~104 s), with results identical to rouge_score:

rougeL speedup vs document length

It's a memory win too: the reference fills an O(n·m) DP table (~9.8 GB at 35k tokens), while rapidrouge's LCS is O(n). rouge1/ rouge2 (n-gram counting) and rougeLsum (still a DP table) match the reference in both correctness and speed (~1×), as expected — only ROUGE-L rides the Hyyrö kernel.

License

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rapidrouge-0.2.0.tar.gz (14.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rapidrouge-0.2.0-py3-none-any.whl (17.1 kB view details)

Uploaded Python 3

File details

Details for the file rapidrouge-0.2.0.tar.gz.

File metadata

  • Download URL: rapidrouge-0.2.0.tar.gz
  • Upload date:
  • Size: 14.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rapidrouge-0.2.0.tar.gz
Algorithm Hash digest
SHA256 ad429b0edfee200c8f186d2539a0edf6ac68931f12cc90359135be8b508a37a2
MD5 e346efaea2d3a496ea328139623530d6
BLAKE2b-256 d5da598bb5bc2bd77077c2983e07c4f7288670bde007d517f6322c61fa8af057

See more details on using hashes here.

Provenance

The following attestation bundles were made for rapidrouge-0.2.0.tar.gz:

Publisher: release.yml on aisilab/rapidrouge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rapidrouge-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: rapidrouge-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 17.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rapidrouge-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a41860a482d6378a60de18567aa8da449beee26d260cdd5039afad2e745bf9fd
MD5 13244dc0817163e3700ad65273ebe923
BLAKE2b-256 79fc6ead02d72039cdeb398ef90a3b3181236876560d6e190bc550b708395055

See more details on using hashes here.

Provenance

The following attestation bundles were made for rapidrouge-0.2.0-py3-none-any.whl:

Publisher: release.yml on aisilab/rapidrouge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page