


import datasets


snake_case_    :      Optional[int]				    =				'''\
@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",
}
'''

snake_case_    :      Optional[int]				    =				'''\
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).
'''

snake_case_    :      str				    =				'''
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     lowerCamelCase( a__						,a__):
				return (preds == labels).mean()


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




						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('''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 				__UpperCamelCase					(							self       :   str					,     _a       :   Dict					,     _a       :   Optional[Any]	)				->  Union[str, Any]:


										"""simple docstring"""





										return {"accuracy": simple_accuracy(__UpperCamelCase					,     __UpperCamelCase	)}

def 	UpperCamelCase__  (     SCREAMING_SNAKE_CASE_	:	int       )  ->     list:

						# bit count represents no. of bits in the gray code
						if bit_count < 0:
												raise ValueError("""The given input must be positive"""       )

						# get the generated string sequence
						_lowercase					       =					gray_code_sequence_string(SCREAMING_SNAKE_CASE_       )
						#
						# convert them to integers
						for i in range(len(SCREAMING_SNAKE_CASE_       )       ):
												_lowercase					       =					int(sequence[i]		,   2       )

						return sequence




def 	UpperCamelCase__  (     SCREAMING_SNAKE_CASE_	:	int       )  ->     list:

						# The approach is a recursive one
						# Base case achieved when either n = 0 or n=1
						if bit_count == 0:
												return ["0"]

						if bit_count == 1:
												return ["0", "1"]

						_lowercase					       =					1 << bit_count  # defines the length of the sequence
						# 1<< n is equivalent to 2^n

						# recursive answer will generate answer for n-1 bits
						_lowercase					       =					gray_code_sequence_string(bit_count - 1       )

						_lowercase					       =					[]

						# append 0 to first half of the smaller sequence generated
						for i in range(seq_len // 2       ):
												_lowercase					       =					"""0""" + smaller_sequence[i]
												sequence.append(SCREAMING_SNAKE_CASE_       )

						# append 1 to second half ... start from the end of the list
						for i in reversed(range(seq_len // 2       )       ):
												_lowercase					       =					"""1""" + smaller_sequence[i]
												sequence.append(SCREAMING_SNAKE_CASE_       )

						return sequence


if __name__ == "__main__":
		import doctest

		doctest.testmod()