MCPcopy Create free account
hub / github.com/OpenBitSys/BitDistiller / extract_answer

Function extract_answer

test/gsm8k/eval.py:53–66  ·  view source on GitHub ↗
(completion)

Source from the content-addressed store, hash-verified

51
52
53def extract_answer(completion):
54 if completion.find('\u0000') >= 0:
55 completion = completion[0:completion.find('\u0000')]
56 match = ANS_RE.search(completion)
57 if match:
58 match_str = match.group(1).strip()
59 match_str = match_str.replace(",", "")
60 try:
61 float(match_str)
62 except BaseException:
63 return INVALID_ANS
64 return match_str
65 else:
66 return INVALID_ANS
67
68def parse_gold(lines):
69 all_ans = []

Callers 1

parse_goldFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected