class_docstr: The class to read the Ubuntu V2 dataset from csv files.
  
  Please, see https://github.com/rkadlec/ubuntu-ranking-dataset-creator.
class_docstr_tok: ["The","class","to","read","the","Ubuntu","V2","dataset","from","csv","files",".","Please",",","see","https",":","\/\/github.com\/rkadlec\/ubuntu-ranking-dataset-creator","."]
code: def preprocess_data_train(
      self, train_fname: Union[Path, str]
  ) -> List[Tuple[List[str], int]]:
      contexts = []
      responses = []
      labels = []
      with open(train_fname, "r") as f:
          reader = csv.reader(f)
          next(reader)
          for el in reader:
              contexts.append(el[0])
              responses.append(el[1])
              labels.append(int(el[2]))
          data = list(zip(contexts, responses))
          data = list(zip(data, labels))
          if self.positive_samples:
              data = [el[0] for el in data if el[1] == 1]
              data = list(zip(data, range(len(data))))
      return data
  
file_path: DeepPavlov/deeppavlov/dataset_readers/ubuntu_v2_reader.py
imports: import csv
  from pathlib import Path
  from typing import List, Dict, Tuple, Union
  from deeppavlov.core.commands.utils import expand_path
  from deeppavlov.core.common.registry import register
  from deeppavlov.core.data.dataset_reader import DatasetReader
label_desc: Use image node_id 2 for calling the UbuntuV2Reader obj's underlying member method code with example usage: obj.preprocess_data_train(train_fname) and returns: data