

import datasets


A__						=							"\\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"

A__						=							"\\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"

A__						=							"\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 					_lowercase     (				a_				:					int					,a_				:					int				)				->	Any:




					'''simple docstring'''







					return (preds == labels).mean()


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







	def 	_SCREAMING_SNAKE_CASE							(   self: 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 	_SCREAMING_SNAKE_CASE							(   self: Dict  , __UpperCamelCase: List[Any]  , __UpperCamelCase: Optional[Any]      ):

						'''simple docstring'''





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







import os
import unittest

from transformers import LayoutLMTokenizer, LayoutLMTokenizerFast
from transformers.models.layoutlm.tokenization_layoutlm import VOCAB_FILES_NAMES
from transformers.testing_utils import require_tokenizers

from ...test_tokenization_common import TokenizerTesterMixin

@require_tokenizers
class 				__UpperCamelCase				(					SCREAMING_SNAKE_CASE  ,						unittest.TestCase			):
	_lowercase  :   Tuple       				=  LayoutLMTokenizer
	_lowercase  :   List[str]       				=  LayoutLMTokenizerFast
	_lowercase  :   List[Any]       				=  True
	_lowercase  :   Optional[int]       				=  True







	def 	_SCREAMING_SNAKE_CASE							(   self: Any      ):

						'''simple docstring'''





						super().setUp()

						__magic_name__							=    [
						    '[UNK]',
						    '[CLS]',
						    '[SEP]',
						    'want',
						    '##want',
						    '##ed',
						    'wa',
						    'un',
						    'runn',
						    '##ing',
						    ',',
						    'low',
						    'lowest',
						]
						__magic_name__							=    os.path.join(self.tmpdirname  , VOCAB_FILES_NAMES['vocab_file']      )
						with open(self.vocab_file  , 'w'  , encoding='utf-8'      ) as vocab_writer:
											vocab_writer.write(''.join([x + '\n' for x in vocab_tokens]      )      )







	def 	_SCREAMING_SNAKE_CASE							(   self: Union[str, Any]  , **__UpperCamelCase: Union[str, Any]      ):

						'''simple docstring'''





						return LayoutLMTokenizer.from_pretrained(self.tmpdirname  , **__UpperCamelCase      )







	def 	_SCREAMING_SNAKE_CASE							(   self: Tuple  , __UpperCamelCase: List[str]      ):

						'''simple docstring'''





						__magic_name__							=    'UNwant\u00E9d,running'
						__magic_name__							=    'unwanted, running'
						return input_text, output_text







	def 	_SCREAMING_SNAKE_CASE							(   self: List[Any]      ):

						'''simple docstring'''





						__magic_name__							=    self.tokenizer_class(self.vocab_file      )

						__magic_name__							=    tokenizer.tokenize('UNwant\u00E9d,running'      )
						self.assertListEqual(__UpperCamelCase  , ['un', '##want', '##ed', ',', 'runn', '##ing']      )
						self.assertListEqual(tokenizer.convert_tokens_to_ids(__UpperCamelCase      )  , [7, 4, 5, 10, 8, 9]      )







	def 	_SCREAMING_SNAKE_CASE							(   self: Dict      ):

						'''simple docstring'''





						pass




