Created
July 28, 2020 22:56
-
-
Save nahidalam/3c327fc04f3c2e36a321e998286ba6c3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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