MCPcopy
hub / github.com/ymcui/Chinese-LLaMA-Alpaca-2 / normalize_answer

Method normalize_answer

scripts/ceval/evaluator.py:32–44  ·  view source on GitHub ↗
(self,s)

Source from the content-addressed store, hash-verified

30 pass
31
32 def normalize_answer(self,s):
33
34 def white_space_fix(text):
35 return ' '.join(text.split())
36
37 def remove_punc(text):
38 exclude=set(self.puncs)
39 return ''.join(ch for ch in text if ch not in exclude)
40
41 def lower(text):
42 return text.lower()
43
44 return white_space_fix(remove_punc(lower(s)))
45
46 def exact_match(self,pred, target):
47 return self.normalize_answer(pred)==self.normalize_answer(target)

Callers 1

exact_matchMethod · 0.95

Calls 3

white_space_fixFunction · 0.85
remove_puncFunction · 0.85
lowerFunction · 0.85

Tested by

no test coverage detected