docstr: Reads a tab separated value file.
docstr_tok: ["Reads","a","tab","separated","value","file","."]
code: def _read_file(self, input_file, phase=None):
      """Reads a tab separated value file."""
      has_warned = False
      with io.open(input_file, "r", encoding="UTF-8") as file:
          reader = csv.reader(file, delimiter="\t", quotechar=None)
          examples = []
          for i, line in enumerate(reader):
              if i == 0:
                  ncol = len(line)
                  if self.if_file_with_header[phase]:
                      continue
              if phase != "predict":
                  if ncol == 1:
                      raise Exception(
                          "the %s file: %s only has one column but it is not a predict file"
                          % (phase, input_file)
                      )
                  elif ncol == 2:
                      example = InputExample(
                          guid=i, text_a=line[0], label=line[1]
                      )
                  elif ncol == 3:
                      example = InputExample(
                          guid=i,
                          text_a=line[0],
                          text_b=line[1],
                          label=line[2],
                      )
                  else:
                      raise Exception(
                          "the %s file: %s has too many columns (should <=3)"
                          % (phase, input_file)
                      )
              else:
                  if ncol == 1:
                      example = InputExample(guid=i, text_a=line[0])
                  elif ncol == 2:
                      if not has_warned:
                          logger.warning(
                              "the predict file: %s has 2 columns, as it is a predict file, the second one will be regarded as text_b"
                              % (input_file)
                          )
                          has_warned = True
                      example = InputExample(
                          guid=i, text_a=line[0], text_b=line[1]
                      )
                  else:
                      raise Exception(
                          "the predict file: %s has too many columns (should <=2)"
                          % (input_file)
                      )
              examples.append(example)
          return examples
  
imports: import io
  import csv
  import collections
  import numpy
  from tqdm import tqdm
  from paddlehub.compat.datasets.base_dataset import InputExample, BaseDataset
  from paddlehub.utils.log import logger
  from paddlehub.text.tokenizer import CustomTokenizer
  from paddlehub.text.bert_tokenizer import BertTokenizer
label_desc: Use image node_id 6 for calling the BaseNLPDataset obj's underlying member method code with example usage: obj._read_file(input_file, phase) and returns: examples