(pred_str, strip_double_curly_brace=False)
| 49 | |
| 50 | |
| 51 | def extract_boxed_answer(pred_str, strip_double_curly_brace=False): |
| 52 | boxed_str = last_boxed_only_string(pred_str) |
| 53 | if boxed_str is None: |
| 54 | return None |
| 55 | answer = remove_boxed(boxed_str) |
| 56 | if answer is None: |
| 57 | return None |
| 58 | if strip_double_curly_brace: |
| 59 | match = re.match('^\{(.*)\}$', answer) # noqa: W605 |
| 60 | if match: |
| 61 | answer = match.group(1) |
| 62 | return answer |
| 63 | |
| 64 | |
| 65 | @LOAD_DATASET.register_module() |
no test coverage detected