Skip to content

Commit

Permalink
Dummy, drop this message after t5 changes are in.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 451669166
  • Loading branch information
shashiongithub authored and t5-copybara committed Jun 15, 2022
1 parent 5ab3576 commit 9268326
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions t5/evaluation/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,21 @@ def bleu(targets, predictions, tokenizer="intl"):
return {"bleu": bleu_score.score}


def rouge(targets, predictions, score_keys=None):
def rouge(targets, predictions, score_keys=None, tokenizer=None):
"""Computes rouge score.
Args:
targets: list of strings
predictions: list of strings
score_keys: list of strings with the keys to compute.
tokenizer: okenizer object which has a tokenize() method.
Returns:
dict with score_key: rouge score across all targets and predictions
"""

if score_keys is None:
score_keys = ["rouge1", "rouge2", "rougeLsum"]
scorer = rouge_scorer.RougeScorer(score_keys)
scorer = rouge_scorer.RougeScorer(score_keys, tokenizer=tokenizer)
aggregator = scoring.BootstrapAggregator()

def _prepare_summary(summary):
Expand Down

0 comments on commit 9268326

Please sign in to comment.