



'''simple docstring'''





import os

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


_UpperCamelCase							       =		logging.get_logger(__name__)






class       lowerCamelCase_					(       SCREAMING_SNAKE_CASE_  ):
  """simple docstring"""




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




  def 		_lowercase  (				self   :			Optional[Any]    ,			_a   :			str     )      ->      Any:
    __lowerCamelCase : Optional[Any]					 =				self.language if self.train_language is None else self.train_language
    __lowerCamelCase : str					 =				self._read_tsv(os.path.join(_a    ,			f'XNLI-MT-1.0/multinli/multinli.train.{lg}.tsv'     )     )
    __lowerCamelCase : int					 =				[]
    for i, line in enumerate(_a     ):
      if i == 0:
        continue
      __lowerCamelCase : List[Any]					 =				f'train-{i}'
      __lowerCamelCase : List[Any]					 =				line[0]
      __lowerCamelCase : List[str]					 =				line[1]
      __lowerCamelCase : List[Any]					 =				'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 		_lowercase  (				self   :			int    ,			_a   :			Tuple     )      ->      Dict:
    __lowerCamelCase : Union[str, Any]					 =				self._read_tsv(os.path.join(_a    ,			'XNLI-1.0/xnli.test.tsv'     )     )
    __lowerCamelCase : Optional[Any]					 =				[]
    for i, line in enumerate(_a     ):
      if i == 0:
        continue
      __lowerCamelCase : Dict					 =				line[0]
      if language != self.language:
        continue
      __lowerCamelCase : int					 =				f'test-{i}'
      __lowerCamelCase : List[Any]					 =				line[6]
      __lowerCamelCase : List[str]					 =				line[7]
      __lowerCamelCase : Union[str, Any]					 =				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 		_lowercase  (				self   :			Tuple     )      ->      str:
    return ["contradiction", "entailment", "neutral"]




_UpperCamelCase							       =		{
    'xnli': XnliProcessor,
}

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

_UpperCamelCase							       =		{
    'xnli': 3,
}











'''simple docstring'''





from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available


_UpperCamelCase							       =		{}

try:
   if not is_sentencepiece_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   _UpperCamelCase							       =		['BarthezTokenizer']

try:
   if not is_tokenizers_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   _UpperCamelCase							       =		['BarthezTokenizerFast']


if TYPE_CHECKING:
   try:
      if not is_sentencepiece_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .tokenization_barthez import BarthezTokenizer

   try:
      if not is_tokenizers_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .tokenization_barthez_fast import BarthezTokenizerFast

else:
   import sys

   _UpperCamelCase							       =		_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)






