
"""simple docstring"""






__UpperCAmelCase       =  {0: [2, 3], 1: [0], 2: [1], 3: [4], 4: []}

__UpperCAmelCase       =  {0: [1, 2, 3], 1: [2], 2: [0], 3: [4], 4: [5], 5: [3]}






def 						_snake_case       (	lowercase__		:  dict[int, list[int]]      ,     lowercase__		:  int      ,     lowercase__		:  list[bool]		)  ->				list[int]:


			'''simple docstring'''





			lowerCAmelCase_    :List[str]			     =  True
			lowerCAmelCase_    :Any			     =  []

			for neighbour in graph[vert]:
						if not visited[neighbour]:
									order += topology_sort(lowercase__      ,     lowercase__      ,     lowercase__		)

			order.append(lowercase__		)

			return order






def 						_snake_case       (	lowercase__		:  dict[int, list[int]]      ,     lowercase__		:  int      ,     lowercase__		:  list[bool]		)  ->				list[int]:


			'''simple docstring'''





			lowerCAmelCase_    :Union[str, Any]			     =  True
			lowerCAmelCase_    :Optional[Any]			     =  [vert]

			for neighbour in reversed_graph[vert]:
						if not visited[neighbour]:
									component += find_components(lowercase__      ,     lowercase__      ,     lowercase__		)

			return component






def 						_snake_case       (	lowercase__		:  dict[int, list[int]]		)  ->				list[list[int]]:


			'''simple docstring'''





			lowerCAmelCase_    :str			     =  len(lowercase__		) * [False]
			lowerCAmelCase_    :dict[int, list[int]]			     =  {vert: [] for vert in range(len(lowercase__		)		)}

			for vert, neighbours in graph.items():
						for neighbour in neighbours:
									reversed_graph[neighbour].append(lowercase__		)

			lowerCAmelCase_    :Any			     =  []
			for i, was_visited in enumerate(lowercase__		):
						if not was_visited:
									order += topology_sort(lowercase__      ,     lowercase__      ,     lowercase__		)

			lowerCAmelCase_    :Dict			     =  []
			lowerCAmelCase_    :Optional[Any]			     =  len(lowercase__		) * [False]

			for i in range(len(lowercase__		)		):
						lowerCAmelCase_    :str			     =  order[len(lowercase__		) - i - 1]
						if not visited[vert]:
									lowerCAmelCase_    :List[Any]			     =  find_components(lowercase__      ,     lowercase__      ,     lowercase__		)
									components_list.append(lowercase__		)

			return components_list








"""simple docstring"""





import datasets


_a														=		"""\
@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\",
}
"""

_a														=		"""\
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).
"""

_a														=		"""
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__		(			__snake_case,     __snake_case	)							->		str:


					"""simple docstring"""





					return (preds == labels).mean()






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



		def 						UpperCAmelCase							(					self)       ->       Dict:






							'''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				,		__a				,		__a)       ->       Dict:






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






