



'''simple docstring'''






import datasets


UpperCamelCase__:   Tuple								=			"\\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__:   List[str]								=			"\\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__:   List[Any]								=			"\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  snake_case_     (					_lowerCAmelCase  :						Tuple   ,      _lowerCAmelCase  :						Tuple  )      ->   List[str]:
							return (preds == labels).mean()




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







	"""simple docstring"""






	def      A	(						self			:     List[Any]		)			->		Optional[int]:
								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      A	(						self			:     Dict		,			__snake_case			:     Union[str, Any]		,			__snake_case			:     Union[str, Any]		)			->		List[str]:
								return {"accuracy": simple_accuracy(__snake_case		,			__snake_case		)}







from queue import PriorityQueue
from typing import Any

import numpy as np




def  __magic_name__ (   __lowerCAmelCase	:						dict		,  __lowerCAmelCase	:						str		,  __lowerCAmelCase	:						set		,  __lowerCAmelCase	:						set		,  __lowerCAmelCase	:						dict		,  __lowerCAmelCase	:						dict		,  __lowerCAmelCase	:						PriorityQueue		,  __lowerCAmelCase	:						dict		,  __lowerCAmelCase	:						float | int		,  )			->   float | int:
				for nxt, d in graph[v]:
								if nxt in visited_forward:
												continue
								__lowerCamelCase    					=	cst_fwd.get(__lowerCAmelCase		,  np.inf							)
								__lowerCamelCase    					=	cst_fwd[v] + d
								if new_cost_f < old_cost_f:
												queue.put((new_cost_f, nxt)							)
												__lowerCamelCase    					=	new_cost_f
												__lowerCamelCase    					=	v
								if nxt in visited_backward:
												if cst_fwd[v] + d + cst_bwd[nxt] < shortest_distance:
																__lowerCamelCase    					=	cst_fwd[v] + d + cst_bwd[nxt]
				return shortest_distance




def  __magic_name__ (   __lowerCAmelCase	:						str		,  __lowerCAmelCase	:						str		,  __lowerCAmelCase	:						dict		,  __lowerCAmelCase	:						dict							)			->   int:
				__lowerCamelCase    					=	-1

				__lowerCamelCase    					=	set()
				__lowerCamelCase    					=	set()
				__lowerCamelCase    					=	{source: 0}
				__lowerCamelCase    					=	{destination: 0}
				__lowerCamelCase    					=	{source: None}
				__lowerCamelCase    					=	{destination: None}
				__lowerCamelCase    					=	PriorityQueue()
				__lowerCamelCase    					=	PriorityQueue()

				__lowerCamelCase    					=	np.inf

				queue_forward.put((0, source)							)
				queue_backward.put((0, destination)							)

				if source == destination:
								return 0

				while not queue_forward.empty() and not queue_backward.empty():
								__lowerCamelCase					,    __lowerCamelCase    					=	queue_forward.get()
								visited_forward.add(__lowerCAmelCase							)

								__lowerCamelCase					,    __lowerCamelCase    					=	queue_backward.get()
								visited_backward.add(__lowerCAmelCase							)

								__lowerCamelCase    					=	pass_and_relaxation(
								    __lowerCAmelCase		,  __lowerCAmelCase		,  __lowerCAmelCase		,  __lowerCAmelCase		,  __lowerCAmelCase		,  __lowerCAmelCase		,  __lowerCAmelCase		,  __lowerCAmelCase		,  __lowerCAmelCase		,  )

								__lowerCamelCase    					=	pass_and_relaxation(
								    __lowerCAmelCase		,  __lowerCAmelCase		,  __lowerCAmelCase		,  __lowerCAmelCase		,  __lowerCAmelCase		,  __lowerCAmelCase		,  __lowerCAmelCase		,  __lowerCAmelCase		,  __lowerCAmelCase		,  )

								if cst_fwd[v_fwd] + cst_bwd[v_bwd] >= shortest_distance:
												break

				if shortest_distance != np.inf:
								__lowerCamelCase    					=	shortest_distance
				return shortest_path_distance


SCREAMING_SNAKE_CASE__   :			List[Any]												=    {
    "B": [["C", 1]],
    "C": [["D", 1]],
    "D": [["F", 1]],
    "E": [["B", 1], ["G", 2]],
    "F": [],
    "G": [["F", 1]],
}
SCREAMING_SNAKE_CASE__   :			Optional[int]												=    {
    "B": [["E", 1]],
    "C": [["B", 1]],
    "D": [["C", 1]],
    "F": [["D", 1], ["G", 1]],
    "E": [[None, np.inf]],
    "G": [["E", 2]],
}

if __name__ == "__main__":
					import doctest

					doctest.testmod()



