(completion)
| 51 | |
| 52 | |
| 53 | def 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 | |
| 68 | def parse_gold(lines): |
| 69 | all_ans = [] |