'''simple docstring'''







import math_equivalence  # From: git+https://github.com/hendrycks/math.git

import datasets


UpperCamelCase_      	=	'''\
@article{hendrycksmath2021,
  title={Measuring Mathematical Problem Solving With the MATH Dataset},
  author={Dan Hendrycks
    and Collin Burns
    and Saurav Kadavath
    and Akul Arora
    and Steven Basart
    and Eric Tang
    and Dawn Song
    and Jacob Steinhardt},
  journal={arXiv preprint arXiv:2103.03874},
  year={2021}
}
'''


UpperCamelCase_      	=	'''\
This metric is used to assess performance on the Mathematics Aptitude Test of Heuristics (MATH) dataset.
It first canonicalizes the inputs (e.g., converting "1/2" to "\\frac{1}{2}") and then computes accuracy.
'''


UpperCamelCase_      	=	R'''
Calculates accuracy after canonicalizing inputs.

Args:
    predictions: list of predictions to score. Each prediction
        is a string that contains natural language and LaTex.
    references: list of reference for each prediction. Each
        reference is a string that contains natural language
        and LaTex.
Returns:
    accuracy: accuracy after canonicalizing inputs
        (e.g., converting "1/2" to "\\frac{1}{2}")

Examples:
    >>> metric = datasets.load_metric("competition_math")
    >>> results = metric.compute(references=["\\frac{1}{2}"], predictions=["1/2"])
    >>> print(results)
    {\'accuracy\': 1.0}
'''




@datasets.utils.file_utils.add_end_docstrings(_DESCRIPTION						,						_KWARGS_DESCRIPTION					)
class _SCREAMING_SNAKE_CASE(							datasets.Metric					):




						def      __lowerCamelCase       (    self :       Tuple      )     ->				int:
													return datasets.MetricInfo(
													    description=_DESCRIPTION							,							citation=_CITATION							,							inputs_description=_KWARGS_DESCRIPTION							,							features=datasets.Features(
													        {
													            'predictions': datasets.Value('string'      ),
													            'references': datasets.Value('string'      ),
													        }      )							,							homepage='https://github.com/hendrycks/math'							,							codebase_urls=['https://github.com/hendrycks/math']							,							)




						def      __lowerCamelCase       (    self :       Dict							,							UpperCamelCase_ :       Any							,							UpperCamelCase_ :       Union[str, Any]      )     ->				Union[str, Any]:
													SCREAMING_SNAKE_CASE__     :Optional[int]						    = 0.0
													for i, j in zip(UpperCamelCase_							,							UpperCamelCase_      ):
																				n_correct += 1.0 if math_equivalence.is_equiv(UpperCamelCase_							,							UpperCamelCase_      ) else 0.0
													SCREAMING_SNAKE_CASE__     :Tuple						    = n_correct / len(UpperCamelCase_      )
													return {
													    "accuracy": accuracy,
													}







'''simple docstring'''







import os


# All paths are set with the intent you should run this script from the root of the repo with the command
# python utils/check_doctest_list.py
UpperCamelCase_      	=	'''.'''


if __name__ == "__main__":
		UpperCamelCase_      	=	os.path.join(REPO_PATH, '''utils/documentation_tests.txt''')
		UpperCamelCase_      	=	[]
		UpperCamelCase_      	=	[]
		with open(doctest_file_path) as fp:
				for line in fp:
						UpperCamelCase_      	=	line.strip()
						UpperCamelCase_      	=	os.path.join(REPO_PATH, line)
						if not (os.path.isfile(path) or os.path.isdir(path)):
								non_existent_paths.append(line)
						all_paths.append(path)
		if len(non_existent_paths) > 0:
				UpperCamelCase_      	=	'''\n'''.join(non_existent_paths)
				raise ValueError(f"`utils/documentation_tests.txt` contains non-existent paths:\n{non_existent_paths}")
		if all_paths != sorted(all_paths):
				raise ValueError('''Files in `utils/documentation_tests.txt` are not in alphabetical order.''')






