






import os

from ...utils import logging
from .utils import DataProcessor, InputExample


__lowerCamelCase						= logging.get_logger(__name__)

class      UpperCamelCase_							(				UpperCamelCase       ):




						def __init__(    self		,	lowercase		,	lowercase=None       )			->						Optional[Any]:
													_a  :    List[str]			=						language
													_a  :    Dict			=						train_language




						def      snake_case__(    self		,	lowercase       )			->						Any:
													_a  :    Optional[Any]			=						self.language if self.train_language is None else self.train_language
													_a  :    Tuple			=						self._read_tsv(os.path.join(lowercase		,	F'XNLI-MT-1.0/multinli/multinli.train.{lg}.tsv'       )       )
													_a  :    List[str]			=						[]
													for i, line in enumerate(lowercase       ):
																				if i == 0:
																											continue
																				_a  :    List[Any]			=						F'train-{i}'
																				_a  :    Tuple			=						line[0]
																				_a  :    int			=						line[1]
																				_a  :    Any			=						'''contradiction''' if line[2] == '''contradictory''' else line[2]
																				if not isinstance(lowercase		,	lowercase       ):
																											raise ValueError(F'Training input {text_a} is not a string'       )
																				if not isinstance(lowercase		,	lowercase       ):
																											raise ValueError(F'Training input {text_b} is not a string'       )
																				if not isinstance(lowercase		,	lowercase       ):
																											raise ValueError(F'Training label {label} is not a string'       )
																				examples.append(InputExample(guid=lowercase		,	text_a=lowercase		,	text_b=lowercase		,	label=lowercase       )       )
													return examples




						def      snake_case__(    self		,	lowercase       )			->						Optional[int]:
													_a  :    Union[str, Any]			=						self._read_tsv(os.path.join(lowercase		,	'''XNLI-1.0/xnli.test.tsv'''       )       )
													_a  :    Dict			=						[]
													for i, line in enumerate(lowercase       ):
																				if i == 0:
																											continue
																				_a  :    Optional[Any]			=						line[0]
																				if language != self.language:
																											continue
																				_a  :    Optional[Any]			=						F'test-{i}'
																				_a  :    Optional[Any]			=						line[6]
																				_a  :    List[Any]			=						line[7]
																				_a  :    List[Any]			=						line[1]
																				if not isinstance(lowercase		,	lowercase       ):
																											raise ValueError(F'Training input {text_a} is not a string'       )
																				if not isinstance(lowercase		,	lowercase       ):
																											raise ValueError(F'Training input {text_b} is not a string'       )
																				if not isinstance(lowercase		,	lowercase       ):
																											raise ValueError(F'Training label {label} is not a string'       )
																				examples.append(InputExample(guid=lowercase		,	text_a=lowercase		,	text_b=lowercase		,	label=lowercase       )       )
													return examples







						def      snake_case__(    self       )			->						List[Any]:
													return ["contradiction", "entailment", "neutral"]

__lowerCamelCase						= {
    'xnli': XnliProcessor,
}

__lowerCamelCase						= {
    'xnli': 'classification',
}

__lowerCamelCase						= {
    'xnli': 3,
}







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

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






def    UpperCamelCase__  (   UpperCAmelCase    ,	UpperCAmelCase    ,	UpperCAmelCase     )     ->		list:







							"""simple docstring"""





							_a  :    List[Any]			=						True
							_a  :    Optional[Any]			=						[]

							for neighbour in graph[vert]:
														if not visited[neighbour]:
																					connected_verts += dfs(UpperCAmelCase    ,	UpperCAmelCase    ,	UpperCAmelCase     )

							return [vert, *connected_verts]






def    UpperCamelCase__  (   UpperCAmelCase     )     ->		list:







							"""simple docstring"""





							_a  :    Optional[int]			=						len(UpperCAmelCase     )
							_a  :    Optional[Any]			=						graph_size * [False]
							_a  :    Optional[int]			=						[]

							for i in range(UpperCAmelCase     ):
														if not visited[i]:
																					_a  :    List[str]			=						dfs(UpperCAmelCase    ,	UpperCAmelCase    ,	UpperCAmelCase     )
																					components_list.append(UpperCAmelCase     )

							return components_list


if __name__ == "__main__":
						import doctest

						doctest.testmod()