

'''simple docstring'''




import os

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


_a			:	Optional[Any]								=  logging.get_logger(__name__)



class     lowercase_		(						a	):

  '''simple docstring'''





  def __init__(       self				,	a_				,	a_=None       )							->			str:


    """simple docstring"""
    UpperCAmelCase  							=		language
    UpperCAmelCase  							=		train_language
  def   snake_case_     (       self				,	a_       )							->			List[Any]:


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


    """simple docstring"""
    UpperCAmelCase  							=		self._read_tsv(os.path.join(a_				,	'XNLI-1.0/xnli.test.tsv'       )       )
    UpperCAmelCase  							=		[]
    for i, line in enumerate(a_       ):
      if i == 0:
        continue
      UpperCAmelCase  							=		line[0]
      if language != self.language:
        continue
      UpperCAmelCase  							=		F'''test-{i}'''
      UpperCAmelCase  							=		line[6]
      UpperCAmelCase  							=		line[7]
      UpperCAmelCase  							=		line[1]
      if not isinstance(a_				,	a_       ):
        raise ValueError(F'''Training input {text_a} is not a string'''       )
      if not isinstance(a_				,	a_       ):
        raise ValueError(F'''Training input {text_b} is not a string'''       )
      if not isinstance(a_				,	a_       ):
        raise ValueError(F'''Training label {label} is not a string'''       )
      examples.append(InputExample(guid=a_				,	text_a=a_				,	text_b=a_				,	label=a_       )       )
    return examples





  def   snake_case_     (       self       )							->			Tuple:


    """simple docstring"""
    return ["contradiction", "entailment", "neutral"]




_a			:	str								=  {
    'xnli': XnliProcessor,
}

_a			:	Optional[int]								=  {
    'xnli': 'classification',
}

_a			:	Union[str, Any]								=  {
    'xnli': 3,
}





'''simple docstring'''




def  lowerCamelCase__						(  SCREAMING_SNAKE_CASE :				str  ):
  UpperCAmelCase  							=		str(SCREAMING_SNAKE_CASE  ).strip()
  if not bin_string:
    raise ValueError('Empty string was passed to the function'  )
  UpperCAmelCase  							=		bin_string[0] == '-'
  if is_negative:
    UpperCAmelCase  							=		bin_string[1:]
  if not all(char in '01' for char in bin_string  ):
    raise ValueError('Non-binary value was passed to the function'  )
  UpperCAmelCase  							=		0
  for char in bin_string:
    UpperCAmelCase  							=		2 * decimal_number + int(SCREAMING_SNAKE_CASE  )
  return -decimal_number if is_negative else decimal_number


if __name__ == "__main__":
  from doctest import testmod

  testmod()


