





import datasets


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

UpperCAmelCase_  							=				'\\nXNLI is a subset of a few thousand examples from MNLI which has been translated\ninto a 14 different languages (some low-ish resource). As with MNLI, the goal is\nto predict textual entailment (does sentence A imply/contradict/neither sentence\nB) and is a classification task (given two sentences, predict one of three\nlabels).\n'

UpperCAmelCase_  							=				'\nComputes XNLI score which is just simple accuracy.\nArgs:\n    predictions: Predicted labels.\n    references: Ground truth labels.\nReturns:\n    \'accuracy\': accuracy\nExamples:\n\n    >>> predictions = [0, 1]\n    >>> references = [0, 1]\n    >>> xnli_metric = datasets.load_metric("xnli")\n    >>> results = xnli_metric.compute(predictions=predictions, references=references)\n    >>> print(results)\n    {\'accuracy\': 1.0}\n'




def 	lowerCAmelCase_					(						__UpperCAmelCase:    Dict	,     __UpperCAmelCase:    str   )   ->			Union[str, Any]:
    return (preds == labels).mean()






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

   '''simple docstring'''


   def    UpperCamelCase__						(					self							)				->   Optional[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,	__magic_name__,	__magic_name__							)				->   List[Any]:






       """simple docstring"""
       return {"accuracy": simple_accuracy(__magic_name__,	__magic_name__							)}








# Lint as: python3
import itertools
import os
import re


UpperCAmelCase_  							=				re.compile(R'([A-Z]+)([A-Z][a-z])')
UpperCAmelCase_  							=				re.compile(R'([a-z\d])([A-Z])')

UpperCAmelCase_  							=				re.compile(R'(?<!_)_(?!_)')
UpperCAmelCase_  							=				re.compile(R'(_{2,})')

UpperCAmelCase_  							=				R'^\w+(\.\w+)*$'

UpperCAmelCase_  							=				R'<>:/\|?*'




def 	lowerCAmelCase_					(						__UpperCAmelCase:    Optional[int]   )   ->			List[Any]:
    UpperCamelCase__							:       int      =   _uppercase_uppercase_re.sub(r'''\1_\2'''	,     __UpperCAmelCase   )
    UpperCamelCase__							:       Tuple      =   _lowercase_uppercase_re.sub(r'''\1_\2'''	,     __UpperCAmelCase   )
    return name.lower()




def 	lowerCAmelCase_					(						__UpperCAmelCase:    Any   )   ->			Any:
    UpperCamelCase__							:       Optional[int]      =   _single_underscore_re.split(__UpperCAmelCase   )
    UpperCamelCase__							:       Dict      =   [_multiple_underscores_re.split(__UpperCAmelCase   ) for n in name]
    return "".join(n.capitalize() for n in itertools.chain.from_iterable(__UpperCAmelCase   ) if n != ''''''   )




def 	lowerCAmelCase_					(						__UpperCAmelCase:    int   )   ->			Union[str, Any]:
    if os.path.basename(__UpperCAmelCase   ) != name:
        raise ValueError(f"Should be a dataset name, not a path: {name}"   )
    return camelcase_to_snakecase(__UpperCAmelCase   )




def 	lowerCAmelCase_					(						__UpperCAmelCase:    Dict	,     __UpperCAmelCase:    Optional[int]   )   ->			Optional[Any]:
    if os.path.basename(__UpperCAmelCase   ) != name:
        raise ValueError(f"Should be a dataset name, not a path: {name}"   )
    if not re.match(_split_re	,     __UpperCAmelCase   ):
        raise ValueError(f"Split name should match '{_split_re}'' but got '{split}'."   )
    return f"{filename_prefix_for_name(__UpperCAmelCase   )}-{split}"




def 	lowerCAmelCase_					(						__UpperCAmelCase:    str	,     __UpperCAmelCase:    Dict	,     __UpperCAmelCase:    List[Any]	,     __UpperCAmelCase:    List[Any]=None   )   ->			Union[str, Any]:
    UpperCamelCase__							:       Optional[Any]      =   filename_prefix_for_split(__UpperCAmelCase	,     __UpperCAmelCase   )
    if filetype_suffix:
        prefix += f".{filetype_suffix}"
    UpperCamelCase__							:       Dict      =   os.path.join(__UpperCAmelCase	,     __UpperCAmelCase   )
    return f"{filepath}*"





def 	lowerCAmelCase_					(						__UpperCAmelCase:    List[str]	,     __UpperCAmelCase:    List[str]	,     __UpperCAmelCase:    int	,     __UpperCAmelCase:    str=None	,     __UpperCAmelCase:    Tuple=None   )   ->			Tuple:
    UpperCamelCase__							:       str      =   filename_prefix_for_split(__UpperCAmelCase	,     __UpperCAmelCase   )
    UpperCamelCase__							:       Tuple      =   os.path.join(__UpperCAmelCase	,     __UpperCAmelCase   )

    if shard_lengths:
        UpperCamelCase__							:       Optional[Any]      =   len(__UpperCAmelCase   )
        UpperCamelCase__							:       List[str]      =   [f"{prefix}-{shard_id:05d}-of-{num_shards:05d}" for shard_id in range(__UpperCAmelCase   )]
        if filetype_suffix:
            UpperCamelCase__							:       Union[str, Any]      =   [filename + f".{filetype_suffix}" for filename in filenames]
        return filenames
    else:
        UpperCamelCase__							:       Tuple      =   prefix
        if filetype_suffix:
            filename += f".{filetype_suffix}"
        return [filename]

