High-performance Rust-backed ROUGE scoring for Python
Project description
rouge-rust
rouge-rust is a Rust-powered replacement for Google's rouge-score Python package.
It provides matching ROUGE-1, ROUGE-2, and ROUGE-L metrics through a PyO3 extension module,
with fast batch APIs for large-scale evaluation workloads.
Features
- ROUGE-1, ROUGE-2, and ROUGE-L scoring
score()for drop-in per-pair scoringscore_batch()for list-of-dicts batch scoringscore_batch_flat()for high-throughput struct-of-arrays batch scoring- Rust core optimized for large datasets
Installation
pip install rouge-rust
Usage
import fast_rouge
single = fast_rouge.score("the cat sat", "the cat sat")
print(single["rouge1"].fmeasure)
batch = fast_rouge.score_batch(
["the cat sat", "hello world"],
["the dog sat", "hello there"],
)
print(batch[0]["rougeL"].precision)
flat = fast_rouge.score_batch_flat(
["the cat sat", "hello world"],
["the dog sat", "hello there"],
)
print(flat.rouge1_fmeasure[0])
Development
Build the extension into the active virtual environment:
source "$HOME/.cargo/env"
.venv/bin/maturin develop --release
Run tests:
source "$HOME/.cargo/env"
cargo test
.venv/bin/pytest -q
Run the benchmark:
PAIR_COUNT=100000 REPEATS=3 .venv/bin/python benchmark.py
Contributing
See CONTRIBUTING.md.
License
This project is released under the MIT License. See LICENSE.
Release
Build a source distribution and wheel:
source "$HOME/.cargo/env"
.venv/bin/maturin build --release --sdist -o dist
Validate the distributions:
.venv/bin/python -m twine check dist/*
Upload to PyPI:
source "$HOME/.cargo/env"
.venv/bin/maturin upload dist/*
GitHub Actions release flow
This repo includes a GitHub Actions pipeline in .github/workflows/release.yml.
- pushes and pull requests to
mainanddevelopbuild and test wheels - tags matching
v*build release artifacts - tag builds publish to PyPI and create a GitHub Release
One-time PyPI setup
Configure PyPI trusted publishing for:
- owner:
kyle-mirich - repository:
rouge-rust - workflow:
release.yml - environment:
pypi
After that, creating and pushing a tag such as v0.1.0 will trigger publishing.
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
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rouge_rust-0.1.4.tar.gz.
File metadata
- Download URL: rouge_rust-0.1.4.tar.gz
- Upload date:
- Size: 11.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb260c9ee08222c0a658696cd061d13c27b0d275e9fc1a61fb8f374b5505b09e
|
|
| MD5 |
e6b16221f687d33beb98c3c43ea01069
|
|
| BLAKE2b-256 |
88b4172ab66a6d9e16094b95e70b05f509bf4c77466fab535149a8bc1d640296
|
Provenance
The following attestation bundles were made for rouge_rust-0.1.4.tar.gz:
Publisher:
release.yml on kyle-mirich/rouge-rust
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rouge_rust-0.1.4.tar.gz -
Subject digest:
eb260c9ee08222c0a658696cd061d13c27b0d275e9fc1a61fb8f374b5505b09e - Sigstore transparency entry: 1170012645
- Sigstore integration time:
-
Permalink:
kyle-mirich/rouge-rust@e773e5c13b683d266f1652d47b76e316b0a82669 -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/kyle-mirich
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e773e5c13b683d266f1652d47b76e316b0a82669 -
Trigger Event:
push
-
Statement type:
File details
Details for the file rouge_rust-0.1.4-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: rouge_rust-0.1.4-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 284.5 kB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b05f557c8159684731d41dfcb1bbec641e450f7e2ebc2f25c0544b7c643e84c
|
|
| MD5 |
f3a3cbd078cc6dd3b8fdd88feb452171
|
|
| BLAKE2b-256 |
1efca9a7a7c76463a0d0914e0fa67d438dd6ef6ede6c396c6dcd5ce9ce59bbb5
|
Provenance
The following attestation bundles were made for rouge_rust-0.1.4-cp313-cp313-macosx_11_0_arm64.whl:
Publisher:
release.yml on kyle-mirich/rouge-rust
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rouge_rust-0.1.4-cp313-cp313-macosx_11_0_arm64.whl -
Subject digest:
9b05f557c8159684731d41dfcb1bbec641e450f7e2ebc2f25c0544b7c643e84c - Sigstore transparency entry: 1170013310
- Sigstore integration time:
-
Permalink:
kyle-mirich/rouge-rust@e773e5c13b683d266f1652d47b76e316b0a82669 -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/kyle-mirich
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e773e5c13b683d266f1652d47b76e316b0a82669 -
Trigger Event:
push
-
Statement type:
File details
Details for the file rouge_rust-0.1.4-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: rouge_rust-0.1.4-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 284.3 kB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
26152ed5e6e20a512d0688b6d2eb597343360ac500c7da79a0e98ab72ca9fa92
|
|
| MD5 |
b3b79045efdfb2a8a990a39c45e3302f
|
|
| BLAKE2b-256 |
3f5f3448ef7f735a2859a07d62a1c396aedd5a4ca508626473c89f422e3cfed7
|
Provenance
The following attestation bundles were made for rouge_rust-0.1.4-cp312-cp312-macosx_11_0_arm64.whl:
Publisher:
release.yml on kyle-mirich/rouge-rust
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rouge_rust-0.1.4-cp312-cp312-macosx_11_0_arm64.whl -
Subject digest:
26152ed5e6e20a512d0688b6d2eb597343360ac500c7da79a0e98ab72ca9fa92 - Sigstore transparency entry: 1170012835
- Sigstore integration time:
-
Permalink:
kyle-mirich/rouge-rust@e773e5c13b683d266f1652d47b76e316b0a82669 -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/kyle-mirich
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e773e5c13b683d266f1652d47b76e316b0a82669 -
Trigger Event:
push
-
Statement type:
File details
Details for the file rouge_rust-0.1.4-cp311-cp311-macosx_11_0_arm64.whl.
File metadata
- Download URL: rouge_rust-0.1.4-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 285.3 kB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce969e6f45f95895f7c9087c60048b316a396653a486f27e42072c7a2e64da27
|
|
| MD5 |
1b35050c1acad090383463d5ea1a8432
|
|
| BLAKE2b-256 |
97b36def8dbc5923f44b21dfdcf6718b3d811ed72a03a62d0c0bf5621125e33f
|
Provenance
The following attestation bundles were made for rouge_rust-0.1.4-cp311-cp311-macosx_11_0_arm64.whl:
Publisher:
release.yml on kyle-mirich/rouge-rust
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rouge_rust-0.1.4-cp311-cp311-macosx_11_0_arm64.whl -
Subject digest:
ce969e6f45f95895f7c9087c60048b316a396653a486f27e42072c7a2e64da27 - Sigstore transparency entry: 1170013125
- Sigstore integration time:
-
Permalink:
kyle-mirich/rouge-rust@e773e5c13b683d266f1652d47b76e316b0a82669 -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/kyle-mirich
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e773e5c13b683d266f1652d47b76e316b0a82669 -
Trigger Event:
push
-
Statement type:
File details
Details for the file rouge_rust-0.1.4-cp310-cp310-macosx_11_0_arm64.whl.
File metadata
- Download URL: rouge_rust-0.1.4-cp310-cp310-macosx_11_0_arm64.whl
- Upload date:
- Size: 285.4 kB
- Tags: CPython 3.10, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
72a5f9264063fbe666bec2c52fc77dac375d04834ec57e2cc1e3b2302b59e49f
|
|
| MD5 |
e30d245bd54fb0ab2774190e7f976c64
|
|
| BLAKE2b-256 |
c063f4f10a9b19d8c8ba8d0422e78a48799eece4651dc97b269e5230d5034b79
|
Provenance
The following attestation bundles were made for rouge_rust-0.1.4-cp310-cp310-macosx_11_0_arm64.whl:
Publisher:
release.yml on kyle-mirich/rouge-rust
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rouge_rust-0.1.4-cp310-cp310-macosx_11_0_arm64.whl -
Subject digest:
72a5f9264063fbe666bec2c52fc77dac375d04834ec57e2cc1e3b2302b59e49f - Sigstore transparency entry: 1170013421
- Sigstore integration time:
-
Permalink:
kyle-mirich/rouge-rust@e773e5c13b683d266f1652d47b76e316b0a82669 -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/kyle-mirich
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e773e5c13b683d266f1652d47b76e316b0a82669 -
Trigger Event:
push
-
Statement type:
File details
Details for the file rouge_rust-0.1.4-cp39-cp39-macosx_11_0_arm64.whl.
File metadata
- Download URL: rouge_rust-0.1.4-cp39-cp39-macosx_11_0_arm64.whl
- Upload date:
- Size: 286.8 kB
- Tags: CPython 3.9, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d4bfeab4c39a3e4dd37995c69a90c8735697b2c0d5f2447246bbe7d667d1797
|
|
| MD5 |
d6f7293e55805fe0eac5e7b60b8fb99c
|
|
| BLAKE2b-256 |
24fca5da65e60df63b8c70b63e003cad7ccc7135168032a9acd3f7665697b370
|
Provenance
The following attestation bundles were made for rouge_rust-0.1.4-cp39-cp39-macosx_11_0_arm64.whl:
Publisher:
release.yml on kyle-mirich/rouge-rust
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rouge_rust-0.1.4-cp39-cp39-macosx_11_0_arm64.whl -
Subject digest:
9d4bfeab4c39a3e4dd37995c69a90c8735697b2c0d5f2447246bbe7d667d1797 - Sigstore transparency entry: 1170013016
- Sigstore integration time:
-
Permalink:
kyle-mirich/rouge-rust@e773e5c13b683d266f1652d47b76e316b0a82669 -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/kyle-mirich
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e773e5c13b683d266f1652d47b76e316b0a82669 -
Trigger Event:
push
-
Statement type: