MCPcopy Create free account
hub / github.com/MuLabPKU/TransArch / parse_math_answer

Function parse_math_answer

TransMLA_NeurIPS_2025/lighteval/math_utils.py:420–435  ·  view source on GitHub ↗
(text: str, data_name)

Source from the content-addressed store, hash-verified

418
419
420def parse_math_answer(text: str, data_name):
421 # parse ground truth
422 if data_name in ["math", "minerva_math"]:
423 gt_cot = text
424 gt_ans = extract_answer(gt_cot, data_name)
425 elif data_name == "gsm8k":
426 gt_cot, gt_ans = text.split("####")
427 else:
428 raise NotImplementedError(f"`{data_name}`")
429 # post process
430 gt_ans = (
431 gt_ans.replace("\\neq", "\\ne")
432 .replace("\\leq", "\\le")
433 .replace("\\geq", "\\ge")
434 )
435 return gt_ans

Callers 1

tasks.pyFile · 0.85

Calls 1

extract_answerFunction · 0.85

Tested by

no test coverage detected