



'''simple docstring'''

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

import datasets


_A				:    int     						='''\
@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				:    Tuple     						='''\
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				:    Dict     						=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 		lowerCamelCase__      (						datasets.Metric     ):




					'''simple docstring'''



					def 						__UpperCAmelCase     (  self				:	List[Any]					)  ->       Union[str, Any]:



						'''simple docstring'''





						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 						__UpperCAmelCase     (  self				:	List[Any]     ,  UpperCamelCase_				:	str     ,  UpperCamelCase_				:	Dict					)  ->       Union[str, Any]:



						'''simple docstring'''





						_lowercase					:       List[str]       =		0.0
						for i, j in zip(UpperCamelCase_     ,  UpperCamelCase_					):
							n_correct += 1.0 if math_equivalence.is_equiv(UpperCamelCase_     ,  UpperCamelCase_					) else 0.0
						_lowercase					:       int       =		n_correct / len(UpperCamelCase_					)
						return {
						    "accuracy": accuracy,
						}





'''simple docstring'''

from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_sentencepiece_available,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


_A				:    Optional[Any]     						={'''configuration_xlnet''': ['''XLNET_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''XLNetConfig''']}

try:
		if not is_sentencepiece_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		_A				:    Tuple     						=['''XLNetTokenizer''']

try:
		if not is_tokenizers_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		_A				:    str     						=['''XLNetTokenizerFast''']

try:
		if not is_torch_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		_A				:    Any     						=[
		    '''XLNET_PRETRAINED_MODEL_ARCHIVE_LIST''',
		    '''XLNetForMultipleChoice''',
		    '''XLNetForQuestionAnswering''',
		    '''XLNetForQuestionAnsweringSimple''',
		    '''XLNetForSequenceClassification''',
		    '''XLNetForTokenClassification''',
		    '''XLNetLMHeadModel''',
		    '''XLNetModel''',
		    '''XLNetPreTrainedModel''',
		    '''load_tf_weights_in_xlnet''',
		]

try:
		if not is_tf_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		_A				:    str     						=[
		    '''TF_XLNET_PRETRAINED_MODEL_ARCHIVE_LIST''',
		    '''TFXLNetForMultipleChoice''',
		    '''TFXLNetForQuestionAnsweringSimple''',
		    '''TFXLNetForSequenceClassification''',
		    '''TFXLNetForTokenClassification''',
		    '''TFXLNetLMHeadModel''',
		    '''TFXLNetMainLayer''',
		    '''TFXLNetModel''',
		    '''TFXLNetPreTrainedModel''',
		]


if TYPE_CHECKING:
		from .configuration_xlnet import XLNET_PRETRAINED_CONFIG_ARCHIVE_MAP, XLNetConfig

		try:
				if not is_sentencepiece_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .tokenization_xlnet import XLNetTokenizer

		try:
				if not is_tokenizers_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .tokenization_xlnet_fast import XLNetTokenizerFast

		try:
				if not is_torch_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_xlnet import (
				    XLNET_PRETRAINED_MODEL_ARCHIVE_LIST,
				    XLNetForMultipleChoice,
				    XLNetForQuestionAnswering,
				    XLNetForQuestionAnsweringSimple,
				    XLNetForSequenceClassification,
				    XLNetForTokenClassification,
				    XLNetLMHeadModel,
				    XLNetModel,
				    XLNetPreTrainedModel,
				    load_tf_weights_in_xlnet,
				)

		try:
				if not is_tf_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_tf_xlnet import (
				    TF_XLNET_PRETRAINED_MODEL_ARCHIVE_LIST,
				    TFXLNetForMultipleChoice,
				    TFXLNetForQuestionAnsweringSimple,
				    TFXLNetForSequenceClassification,
				    TFXLNetForTokenClassification,
				    TFXLNetLMHeadModel,
				    TFXLNetMainLayer,
				    TFXLNetModel,
				    TFXLNetPreTrainedModel,
				)

else:
		import sys

		_A				:    str     						=_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)
