MCPcopy Create free account
hub / github.com/MichSchli/AVeriTeC / count_stats

Function count_stats

utils.py:15–34  ·  view source on GitHub ↗
(candidate_dict, reference_dict)

Source from the content-addressed store, hash-verified

13 return nltk.translate.meteor_score.single_meteor_score(word_tokenize(reference), word_tokenize(candidate))
14
15def count_stats(candidate_dict, reference_dict):
16 count_match = [0 for _ in candidate_dict]
17 count_diff = [0 for _ in candidate_dict]
18
19 for i, k in enumerate(candidate_dict.keys()):
20 pred_parts = candidate_dict[k]
21 tgt_parts = reference_dict[k]
22
23 if len(pred_parts) == len(tgt_parts):
24 count_match[i] = 1
25
26 count_diff[i] = abs(len(pred_parts) - len(tgt_parts))
27
28 count_match_score = np.mean(count_match)
29 count_diff_score = np.mean(count_diff)
30
31 return {
32 "count_match_score": count_match_score,
33 "count_diff_score": count_diff_score
34 }
35
36def f1_metric(candidate_dict, reference_dict, pairwise_metric):
37 all_best_p = [0 for _ in candidate_dict]

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected