(cls, target_str: str)
| 127 | return target_str[:i] |
| 128 | |
| 129 | def clean(cls, target_str: str): |
| 130 | opt = target_str.strip().replace('{{', '{').replace('}}', '}') |
| 131 | if not opt: |
| 132 | return opt |
| 133 | if opt[-1] == '.' or opt[-1] == '。': |
| 134 | return opt[:-1] |
| 135 | return opt |
| 136 | |
| 137 | def extract_answer(cls, pred: str, extract_last_num=False): |
| 138 | if pred.find('The final answer is ') >= 0: |