'''simple docstring'''

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

import datasets


__a:					Any			  =  '''\
@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}
}
'''


__a:					str			  =  '''\
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.
'''


__a:					Union[str, Any]			  =  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      UpperCAmelCase    (		datasets.Metric   ):





       '''simple docstring'''



       def _lowerCAmelCase(		self					)    ->    Tuple:
        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      ,  __lowerCAmelCase      ,  __lowerCAmelCase					)    ->    Union[str, Any]:
        lowercase__							:       Dict										=   0.0
        for i, j in zip(_snake_case      ,  _snake_case					):
         n_correct += 1.0 if math_equivalence.is_equiv(_snake_case      ,  _snake_case					) else 0.0
        lowercase__							:       Union[str, Any]										=   n_correct / len(_snake_case					)
        return {
            "accuracy": accuracy,
        }








"""simple docstring"""
def 		_SCREAMING_SNAKE_CASE			(_UpperCAmelCase					:    str			):
 return " ".join(input_str.split()[::-1]			)


if __name__ == "__main__":
       import doctest

       doctest.testmod()





