Spaces:
Running
Running
update MATH
Browse files
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
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 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):
|