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

Method get_examples

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

Source from the content-addressed store, hash-verified

109 self.labels = ["World", "Sports", "Business", "Tech"]
110
111 def get_examples(self, data_dir, split):
112 path = os.path.join(data_dir, "{}.csv".format(split))
113 examples = []
114 with open(path, encoding='utf8') as f:
115 reader = csv.reader(f, delimiter=',')
116 for idx, row in enumerate(reader):
117 label, headline, body = row
118 text_a = headline.replace('\\', ' ')
119 text_b = body.replace('\\', ' ')
120 example = InputExample(guid=str(idx), text_a=text_a, text_b=text_b, label=int(label)-1)
121 examples.append(example)
122 return examples
123
124class DBpediaProcessor(DataProcessor):
125 """

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected