Expand description
Fast ROUGE metrics whose scores are identical to Google’s
rouge-score
Python package, including its tokenizer, NLTK’s Porter stemmer and the
summary-level rougeLsum variant.
use rougers::{RougeScorer, RougeType};
let scorer = RougeScorer::new(["rouge1", "rouge2", "rougeLsum"], true)?;
let scores = scorer.score("the cat sat on the mat", "a cat was sitting on the mat");
for (rouge_type, score) in scores.iter() {
println!("{rouge_type}: {:.4}", score.fmeasure);
}Structs§
- Document
- Tokenized text, ready for scoring.
- Rouge
Scorer - Computes ROUGE scores between a target (reference) and a prediction.
- Score
- Precision, recall and F1 for one ROUGE variant.
- Scores
- Scores for each requested ROUGE variant, in request order.
- Tokenizer
- Splits text into tokens for scoring.
Enums§
Functions§
- fmeasure
- The harmonic mean of precision and recall, or zero when both are zero.