A fast Python implementation of full ROUGE metrics for automatic summarization evaluation, also providing a Python wrapper for the official ROUGE-1.5.5.pl Perl script. It supports various ROUGE variants (N, L, W, S, SU) and multi-reference evaluation. The library is actively maintained with periodic updates.
pip install rouge-metricVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use the pure Python ROUGE implementation to evaluate a single hypothesis against a single reference string, and also how to evaluate tokenized input against multiple references. The output includes ROUGE-N, ROUGE-L, ROUGE-W, ROUGE-S, and ROUGE-SU scores.
Combine ROUGE scores with semantic similarity metrics (e.g., BERTScore) and qualitative human evaluation to get a more robust assessment of text quality.
If exact replication of ROUGE-1.5.5.pl multi-document scores is critical, use the `PerlRouge` wrapper or adjust expectations for slight differences in multi-document scenarios with `Rouge`.
Ensure consistent and appropriate preprocessing (tokenization, stemming, etc.) is applied to both hypothesis and reference texts before passing them to `rouge_metric.Rouge`.
For non-English text evaluation, use `rouge_metric.Rouge` and ensure your input tokens are appropriately preprocessed for the target language. For English, `PerlRouge` can still be used for official ROUGE-1.5.5.pl compatibility.