MCPcopy Create free account
hub / github.com/Monalissaa/DisenDiff / get_all_metrics

Function get_all_metrics

utils/clipscore/generation_eval_utils.py:17–36  ·  view source on GitHub ↗
(refs, cands, return_per_cap=False)

Source from the content-addressed store, hash-verified

15
16
17def get_all_metrics(refs, cands, return_per_cap=False):
18 metrics = []
19 names = []
20
21 pycoco_eval_cap_scorers = [(Bleu(4), 'bleu'),
22 (Meteor(), 'meteor'),
23 (Rouge(), 'rouge'),
24 (Cider(), 'cider'),
25 (Spice(), 'spice')]
26
27 for scorer, name in pycoco_eval_cap_scorers:
28 overall, per_cap = pycoco_eval(scorer, refs, cands)
29 if return_per_cap:
30 metrics.append(per_cap)
31 else:
32 metrics.append(overall)
33 names.append(name)
34
35 metrics = dict(zip(names, metrics))
36 return metrics
37
38
39def tokenize(refs, cands, no_op=False):

Callers

nothing calls this directly

Calls 1

pycoco_evalFunction · 0.85

Tested by

no test coverage detected