# Path: third_party/processors/utils.py
# class InputExample(object):
#   """
#   A single training/test example for simple sequence classification.
#   Args:
#     guid: Unique id for the example.
#     text_a: string. The untokenized text of the first sequence. For single
#     sequence tasks, only this sequence must be specified.
#     text_b: (Optional) string. The untokenized text of the second sequence.
#     Only must be specified for sequence pair tasks.
#     label: (Optional) string. The label of the example. This should be
#     specified for train and dev examples, but not for test examples.
#   """
# 
#   def __init__(self, guid, text_a, text_b=None, label=None, language=None):
#     self.guid = guid
#     self.text_a = text_a
#     self.text_b = text_b
#     self.label = label
#     self.language = language
# 
#   def __repr__(self):
#     return str(self.to_json_string())
# 
#   def to_dict(self):
#     """Serializes this instance to a Python dictionary."""
#     output = copy.deepcopy(self.__dict__)
#     return output
# 
#   def to_json_string(self):
#     """Serializes this instance to a JSON string."""
#     return json.dumps(self.to_dict(), indent=2, sort_keys=True) + "\n"


import logging
import os
from transformers import DataProcessor
from .utils import InputExample
      
      for (i, line) in enumerate(lines):
        guid = "%s-%s-%s" % (split, lg, i)
        text_a = line[0]
        text_b = line[1]
        if split == 'test' and len(line) != 3:
          label = "0"
        else:
          label = str(line[2].strip())
        assert isinstance(text_a, str) and isinstance(text_b, str) and isinstance(label, str)
        examples.append(InputExample(guid=guid, text_a=text_a, text_b=text_b, label=label, language=lg))
    return examples

  def get_translate_examples(self, data_dir, language='en', split='train'):
    """See base class."""
    languages = language.split(',')
    examples = []
    for language in languages:
      if split == 'train':
        file_path = os.path.join(data_dir, "translated/en-{}-translated.tsv".format(language))
      else:
        file_path = os.path.join(data_dir, "translated/test-{}-en-translated.tsv".format(language))
      logger.info("reading from " + file_path)
      lines = self._read_tsv(file_path)
      for (i, line) in enumerate(lines):
        guid = "%s-%s-%s" % (split, language, i)
        text_a = line[0]
        text_b = line[1]
        label = str(line[2].strip())
        assert isinstance(text_a, str) and isinstance(text_b, str) and isinstance(label, str)

# Path: third_party/processors/utils.py
# class InputExample(object):
#   """
#   A single training/test example for simple sequence classification.
#   Args:
#     guid: Unique id for the example.
#     text_a: string. The untokenized text of the first sequence. For single
#     sequence tasks, only this sequence must be specified.
#     text_b: (Optional) string. The untokenized text of the second sequence.
#     Only must be specified for sequence pair tasks.
#     label: (Optional) string. The label of the example. This should be
#     specified for train and dev examples, but not for test examples.
#   """
# 
#   def __init__(self, guid, text_a, text_b=None, label=None, language=None):
#     self.guid = guid
#     self.text_a = text_a
#     self.text_b = text_b
#     self.label = label
#     self.language = language
# 
#   def __repr__(self):
#     return str(self.to_json_string())
# 
#   def to_dict(self):
#     """Serializes this instance to a Python dictionary."""
#     output = copy.deepcopy(self.__dict__)
#     return output
# 
#   def to_json_string(self):
#     """Serializes this instance to a JSON string."""
#     return json.dumps(self.to_dict(), indent=2, sort_keys=True) + "\n"


# Path: third_party/processors/pawsx.py
import logging
import os
from transformers import DataProcessor
from .utils import InputExample

      
      for (i, line) in enumerate(lines):
        guid = "%s-%s-%s" % (split, lg, i)
        text_a = line[0]
        text_b = line[1]
        if split == 'test' and len(line) != 3:
          label = "0"
        else:
          label = str(line[2].strip())
        assert isinstance(text_a, str) and isinstance(text_b, str) and isinstance(label, str)
        examples.append(InputExample(guid=guid, text_a=text_a, text_b=text_b, label=label, language=lg))
    return examples

  def get_translate_examples(self, data_dir, language='en', split='train'):
    """See base class."""
    languages = language.split(',')
    examples = []
    for language in languages:
      if split == 'train':
        file_path = os.path.join(data_dir, "translated/en-{}-translated.tsv".format(language))
      else:
        file_path = os.path.join(data_dir, "translated/test-{}-en-translated.tsv".format(language))
      logger.info("reading from " + file_path)
      lines = self._read_tsv(file_path)
      for (i, line) in enumerate(lines):
        guid = "%s-%s-%s" % (split, language, i)
        text_a = line[0]
        text_b = line[1]
        label = str(line[2].strip())
        assert isinstance(text_a, str) and isinstance(text_b, str) and isinstance(label, str)

        examples.append(InputExample(guid=guid, text_a=text_a, text_b=text_b, label=label, language=language))