Commit aecf13dd authored by Leo Gao's avatar Leo Gao
Browse files

fix hendrycksMath for \fixed without curly braces

parent 9bbf2406
...@@ -107,16 +107,23 @@ class Math(Task): ...@@ -107,16 +107,23 @@ class Math(Task):
return str1 == str2 return str1 == str2
def remove_boxed(self, s): def remove_boxed(self, s):
left = "\\boxed{" if "\\boxed " in s:
try: left = "\\boxed "
assert s[:len(left)] == left assert s[:len(left)] == left
assert s[-1] == "}" return s[len(left):]
return s[len(left):-1]
except AssertionError: left = "\\boxed{"
return None
assert s[:len(left)] == left
assert s[-1] == "}"
return s[len(left):-1]
def last_boxed_only_string(self, string): def last_boxed_only_string(self, string):
idx = string.rfind("\\boxed") idx = string.rfind("\\boxed")
if "\\boxed " in string:
return "\\boxed " + string.split("\\boxed ")[-1].split("$")[0]
if idx < 0: if idx < 0:
idx = string.rfind("\\fbox") idx = string.rfind("\\fbox")
if idx < 0: if idx < 0:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment