从包含数学解题过程的字符串中提取所有 \boxed{} 标签内的答案。 Args: solution_string: 包含解题过程的字符串,可能包含 \boxed{} 标签。 Returns: 一个列表,包含所有找到的 \boxed{} 标签内的答案。如果未找到,则返回空列表。
(solution_string: str)
| 87 | |
| 88 | |
| 89 | def extract_boxed_answer(solution_string: str) -> list: |
| 90 | """ |
| 91 | 从包含数学解题过程的字符串中提取所有 \boxed{} 标签内的答案。 |
| 92 | |
| 93 | Args: |
| 94 | solution_string: 包含解题过程的字符串,可能包含 \boxed{} 标签。 |
| 95 | |
| 96 | Returns: |
| 97 | 一个列表,包含所有找到的 \boxed{} 标签内的答案。如果未找到,则返回空列表。 |
| 98 | """ |
| 99 | pattern = r"\\boxed\{(.*?)\}" |
| 100 | answers = re.findall(pattern, solution_string) |
| 101 | return answers |
| 102 | |
| 103 | |
| 104 | api_search = "http://11.219.2.7:8893" # default retriever port |
nothing calls this directly
no outgoing calls
no test coverage detected