



import datasets


__SCREAMING_SNAKE_CASE           =  """\
@InProceedings{conneau2018xnli,
  author = \"Conneau, Alexis
                 and Rinott, Ruty
                 and Lample, Guillaume
                 and Williams, Adina
                 and Bowman, Samuel R.
                 and Schwenk, Holger
                 and Stoyanov, Veselin\",
  title = \"XNLI: Evaluating Cross-lingual Sentence Representations\",
  booktitle = \"Proceedings of the 2018 Conference on Empirical Methods
               in Natural Language Processing\",
  year = \"2018\",
  publisher = \"Association for Computational Linguistics\",
  location = \"Brussels, Belgium\",
}
"""

__SCREAMING_SNAKE_CASE           =  """\
XNLI is a subset of a few thousand examples from MNLI which has been translated
into a 14 different languages (some low-ish resource). As with MNLI, the goal is
to predict textual entailment (does sentence A imply/contradict/neither sentence
B) and is a classification task (given two sentences, predict one of three
labels).
"""

__SCREAMING_SNAKE_CASE           =  """
Computes XNLI score which is just simple accuracy.
Args:
    predictions: Predicted labels.
    references: Ground truth labels.
Returns:
    'accuracy': accuracy
Examples:

    >>> predictions = [0, 1]
    >>> references = [0, 1]
    >>> xnli_metric = datasets.load_metric(\"xnli\")
    >>> results = xnli_metric.compute(predictions=predictions, references=references)
    >>> print(results)
    {'accuracy': 1.0}
"""




def 	UpperCAmelCase   (						_lowerCamelCase ,    _lowerCamelCase    ):
			return (preds == labels).mean()






@datasets.utils.file_utils.add_start_docstrings(_DESCRIPTION						,_KWARGS_DESCRIPTION						)
class 	lowerCamelCase_    ( datasets.Metric						):






						'''simple docstring'''







						def 			SCREAMING_SNAKE_CASE__		(	self      :			Optional[Any] )      ->				Union[str, Any]:
									return datasets.MetricInfo(
									    description=_DESCRIPTION	,	citation=_CITATION	,	inputs_description=_KWARGS_DESCRIPTION	,	features=datasets.Features(
									        {
									            "predictions": datasets.Value("int64" if self.config_name != "sts-b" else "float32" ),
									            "references": datasets.Value("int64" if self.config_name != "sts-b" else "float32" ),
									        } )	,	codebase_urls=[]	,	reference_urls=[]	,	format="numpy"	,	)







						def 			SCREAMING_SNAKE_CASE__		(	self      :			List[str]	,	__lowerCamelCase      :			Dict	,	__lowerCamelCase      :			List[str] )      ->				Optional[Any]:
									return {"accuracy": simple_accuracy(__lowerCamelCase	,	__lowerCamelCase )}




from collections import deque

from .hash_table import HashTable

class 	lowerCamelCase_    ( _A						):






						'''simple docstring'''







						def __init__(	self      :			Union[str, Any]	,	*__lowerCamelCase      :			Dict	,	**__lowerCamelCase      :			int )      ->				Optional[int]:
									super().__init__(*__lowerCamelCase	,	**__lowerCamelCase )







						def 			SCREAMING_SNAKE_CASE__		(	self      :			List[str]	,	__lowerCamelCase      :			List[str]	,	__lowerCamelCase      :			Union[str, Any] )      ->				Union[str, Any]:
									A							:					Optional[Any]              =						deque([] ) if self.values[key] is None else self.values[key]
									self.values[key].appendleft(__lowerCamelCase )
									A							:					Dict              =						self.values[key]







						def 			SCREAMING_SNAKE_CASE__		(	self      :			Any )      ->				str:
									return (
									    sum(self.charge_factor - len(__lowerCamelCase ) for slot in self.values )
									    / self.size_table
									    * self.charge_factor
									)







						def 			SCREAMING_SNAKE_CASE__		(	self      :			Optional[Any]	,	__lowerCamelCase      :			Any	,	__lowerCamelCase      :			List[Any]=None )      ->				Optional[int]:
									if not (
									    len(self.values[key] ) == self.charge_factor and self.values.count(__lowerCamelCase ) == 0
									):
												return key
									return super()._collision_resolution(__lowerCamelCase	,	__lowerCamelCase )