Metadata-Version: 2.4
Name: rouge-rust
Version: 0.1.8
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Rust
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Dist: pytest>=8 ; extra == 'dev'
Requires-Dist: rouge-score>=0.1.2 ; extra == 'dev'
Requires-Dist: twine>=6 ; extra == 'dev'
Provides-Extra: dev
License-File: LICENSE
Summary: High-performance Rust-backed ROUGE scoring for Python
Keywords: nlp,rouge,evaluation,rust,pyo3
Home-Page: https://github.com/kyle-mirich/rouge-rust
Requires-Python: >=3.8
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Homepage, https://github.com/kyle-mirich/rouge-rust
Project-URL: Issues, https://github.com/kyle-mirich/rouge-rust/issues
Project-URL: Repository, https://github.com/kyle-mirich/rouge-rust

# 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 scoring
- `score_batch()` for list-of-dicts batch scoring
- `score_batch_flat()` for high-throughput struct-of-arrays batch scoring
- Rust core optimized for large datasets

## Installation

```bash
uv add rouge-rust
```

## Usage

```python
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])
```

## Local setup

Create a local environment and install the package in editable mode:

```bash
uv venv
uv pip install -e .[dev]
uv run maturin develop --release
```

Run the Rust tests:

```bash
cargo test
```

## License

This project is released under the MIT License. See [LICENSE](LICENSE).

## Release

Build a source distribution and wheel:

```bash
uvx maturin build --release --sdist -o dist
```

Validate the distributions:

```bash
uvx twine check dist/*
```

Upload to PyPI:

```bash
uvx maturin upload dist/*
```

## GitHub Actions release flow

This repo includes a GitHub Actions pipeline in `.github/workflows/release.yml`.

- pushes and pull requests to `main` and `develop` build 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.

