MCPcopy Create free account
hub / github.com/OpenBMB/DecT / get_examples

Method get_examples

src/process_data.py:83–97  ·  view source on GitHub ↗
(self, data_dir, split)

Source from the content-addressed store, hash-verified

81 self.labels = ["contradiction", "entailment", "neutral"]
82
83 def get_examples(self, data_dir, split):
84 path = os.path.join(data_dir, "{}.tsv".format(self.dataset_project[split]))
85 examples = []
86 with open(path, encoding='utf8') as f:
87 reader = csv.reader(f, delimiter='\t', quoting=csv.QUOTE_NONE)
88 next(reader, None)
89 for row in reader:
90 label, headline, body = self.get_label_id(row[-1]), row[8], row[9]
91 text_a = headline.replace('\\', ' ')
92 text_b = body.replace('\\', ' ')
93 example = InputExample(
94 guid=str(0), text_a=text_a, text_b=text_b, label=label)
95 examples.append(example)
96
97 return examples
98
99
100class AgnewsProcessor(DataProcessor):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected