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

Function extract_number

opencompass/datasets/smolinstruct.py:304–308  ·  view source on GitHub ↗
(text)

Source from the content-addressed store, hash-verified

302
303
304def extract_number(text):
305 pattern = re.compile(
306 r'(?:<NUMBER>\s*|\\boxed\{)\s*(-?\d*\.?\d+)\s*(?:</NUMBER>|\})')
307 matches = pattern.findall(text)
308 return [float(match) for match in matches]
309
310
311@ICL_EVALUATORS.register_module()

Callers 1

scoreMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected