MCPcopy Create free account
hub / github.com/InternScience/SciReason / extract_boxed_answer

Function extract_boxed_answer

opencompass/datasets/math_intern.py:51–62  ·  view source on GitHub ↗
(pred_str, strip_double_curly_brace=False)

Source from the content-addressed store, hash-verified

49
50
51def extract_boxed_answer(pred_str, strip_double_curly_brace=False):
52 boxed_str = last_boxed_only_string(pred_str)
53 if boxed_str is None:
54 return None
55 answer = remove_boxed(boxed_str)
56 if answer is None:
57 return None
58 if strip_double_curly_brace:
59 match = re.match('^\{(.*)\}$', answer) # noqa: W605
60 if match:
61 answer = match.group(1)
62 return answer
63
64
65@LOAD_DATASET.register_module()

Callers 1

loadMethod · 0.70

Calls 3

groupMethod · 0.80
last_boxed_only_stringFunction · 0.70
remove_boxedFunction · 0.70

Tested by

no test coverage detected