This commit is contained in:
Myhs-phz 2025-04-07 02:36:51 +00:00
parent 3a9a384173
commit 01b0ee6ee6

View File

@ -22,17 +22,6 @@ class MATHEvaluator(BaseEvaluator):
details = []
for i, j in zip(predictions, references):
count += 1
gold_parsed = parse(
j,
extraction_mode='first_match',
extraction_config=[
LatexExtractionConfig(),
ExprExtractionConfig(),
],
)
# If parsing result is empty, try adding LaTeX
# environment and parse again
if len(gold_parsed) == 0:
j_with_env = f'${j}$'
gold_parsed = parse(
j_with_env,
@ -42,6 +31,18 @@ class MATHEvaluator(BaseEvaluator):
ExprExtractionConfig(),
],
)
# If parsing result is empty, try adding LaTeX
# environment and parse again
# if len(gold_parsed) == 0:
# j_with_env = f'${j}$'
# gold_parsed = parse(
# j_with_env,
# extraction_mode='first_match',
# extraction_config=[
# LatexExtractionConfig(),
# ExprExtractionConfig(),
# ],
# )
if len(gold_parsed) != 0:
# We require the answer to be provided in correct
# latex (no malformed operators)