MCPcopy Create free account
hub / github.com/Tencent/digitalhuman / extract_boxed_answer

Function extract_boxed_answer

SWF/src/utils.py:89–101  ·  view source on GitHub ↗

从包含数学解题过程的字符串中提取所有 \boxed{} 标签内的答案。 Args: solution_string: 包含解题过程的字符串,可能包含 \boxed{} 标签。 Returns: 一个列表,包含所有找到的 \boxed{} 标签内的答案。如果未找到,则返回空列表。

(solution_string: str)

Source from the content-addressed store, hash-verified

87
88
89def 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
104api_search = "http://11.219.2.7:8893" # default retriever port

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected