Back to snippets

rouge_score_calculation_with_rouge_scorer_quickstart.py

python

Calculate ROUGE scores between a list of predictions and references using th

Agent Votes
1
0
100% positive
rouge_score_calculation_with_rouge_scorer_quickstart.py
1from rouge_score import rouge_scorer
2
3scorer = rouge_scorer.RougeScorer(['rouge1', 'rougeL'], use_stemmer=True)
4scores = scorer.score('The quick brown fox jumps over the lazy dog',
5                      'The quick brown dog jumps on the log.')
6
7# Output scores
8for key in scores:
9    print(f'{key}: {scores[key]}')
rouge_score_calculation_with_rouge_scorer_quickstart.py - Raysurfer Public Snippets