facat commited on
Commit
4e1024e
1 Parent(s): 232b173

update MATH

Browse files
Files changed (1) hide show
  1. utils.py +8 -8
utils.py CHANGED
@@ -136,17 +136,17 @@ def extract_numeric(string, pattern=NUMERIC_IN_EN) -> str:
136
 
137
 
138
  def remove_boxed(s):
139
- if "\\boxed " in s:
140
- left = "\\boxed "
141
  assert s[: len(left)] == left, s
142
  return s[len(left) :]
 
 
 
143
 
144
- left = "\\boxed{"
145
-
146
- assert s[: len(left)] == left, s
147
- assert s[-1] == "}", s
148
-
149
- return s[len(left) : -1]
150
 
151
 
152
  def last_boxed_only_string(string):
 
136
 
137
 
138
  def remove_boxed(s):
139
+ if (left := "\\boxed ") in s:
 
140
  assert s[: len(left)] == left, s
141
  return s[len(left) :]
142
+ elif (left := "\\boxed{") in s:
143
+ assert s[: len(left)] == left, s
144
+ return s[len(left) : -1]
145
 
146
+ elif (left := "\\fbox{") in s:
147
+ assert s[: len(left)] == left, s
148
+ return s[len(left) : -1]
149
+ raise ValueError(f"Cannot remove boxed from {s}")
 
 
150
 
151
 
152
  def last_boxed_only_string(string):