Skip to content
Snippets Groups Projects
Commit 0039afac authored by kreuzer's avatar kreuzer
Browse files

Aktualisieren utils.py

parent f3217546
No related branches found
No related tags found
No related merge requests found
......@@ -23,7 +23,7 @@ def select_elements(iterable, idx_list):
def rouge(summary, gold_summary):
def rouge(summary, gold_summary, verbose=False):
def rouge_n(counts, gold_counts, length, gold_length):
......@@ -141,6 +141,11 @@ def rouge(summary, gold_summary):
length_summary = len(tokens)
length_gold_summary = len(gold_tokens)
if verbose:
return rouge_n(unigram_counts, gold_unigram_counts, length_summary, length_gold_summary),
rouge_n(bigram_counts, gold_bigram_counts, length_summary - 1, length_gold_summary - 1),
rouge_l(summary, gold_summary, unigram_counts, gold_unigram_counts, length_summary, length_gold_summary)
return (rouge_n(unigram_counts, gold_unigram_counts, length_summary, length_gold_summary)
+ rouge_n(bigram_counts, gold_bigram_counts, length_summary - 1, length_gold_summary - 1)
+ rouge_l(summary, gold_summary, unigram_counts, gold_unigram_counts, length_summary, length_gold_summary)) / 3.0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment