Skip to content

Instantly share code, notes, and snippets.

@nahidalam
Created July 28, 2020 22:56
Show Gist options
  • Save nahidalam/3c327fc04f3c2e36a321e998286ba6c3 to your computer and use it in GitHub Desktop.
Save nahidalam/3c327fc04f3c2e36a321e998286ba6c3 to your computer and use it in GitHub Desktop.
from rouge_score import rouge_scorer
def read_input(filename = 'evaluation_input.txt'):
input_pair = []
# read evaluation_input.txt
# append each line to input_pair
return input_pair
def write_score(scores):
# write scores to a file. This file is the out of this milestone
return None
def scoring(input_pair):
scorer = rouge_scorer.RougeScorer(['rouge1'], use_stemmer=True)
for pair in input_pair:
scores = scorer.score(pair[0],pair[1])
write_score(scores)
return None
input_pair = [['The quick brown fox jumps over the lazy dog', 'The quick brown dog jumps on the log.'],['my name is fox', 'my name']]
print(scoring(input_pair))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment