(text: str, data_name)
| 418 | |
| 419 | |
| 420 | def 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 |
no test coverage detected