import os

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


UpperCamelCase     					=     logging.get_logger(__name__)
class   UpperCAmelCase__				(    __lowerCamelCase			):


	"""simple docstring"""







	def __init__(			self       ,     _SCREAMING_SNAKE_CASE       ,     _SCREAMING_SNAKE_CASE=None )    ->	Optional[Any]:
							a_							:			Union[str, Any]     		=					language
							a_							:			Any     		=					train_language







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







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







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




UpperCamelCase     					=     {
    'xnli': XnliProcessor,
}

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

UpperCamelCase     					=     {
    'xnli': 3,
}





"""simple docstring"""






def  lowerCAmelCase_      (_SCREAMING_SNAKE_CASE	:str  )				-> int:
						a_							:			Optional[int]     		=					0
						for letter in data:
												a_							:			Union[str, Any]     		=					(hash_ << 4) + ord(_SCREAMING_SNAKE_CASE  )
												a_							:			Optional[int]     		=					hash_ & 0xf000_0000
												if x != 0:
																		hash_ ^= x >> 24
												hash_ &= ~x
						return hash_


if __name__ == "__main__":
				import doctest

				doctest.testmod()




