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

Method get_examples

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

Source from the content-addressed store, hash-verified

187 ,"Family & Relationships", "Politics & Government"]
188
189 def get_examples(self, data_dir, split):
190 path = os.path.join(data_dir, "{}.csv".format(split))
191 examples = []
192 with open(path, encoding='utf8') as f:
193 reader = csv.reader(f, delimiter=',')
194 for idx, row in enumerate(reader):
195 label, question_title, question_body, answer = row
196 text_a = ' '.join([question_title.replace('\\n', ' ').replace('\\', ' '),
197 question_body.replace('\\n', ' ').replace('\\', ' ')])
198 text_b = answer.replace('\\n', ' ').replace('\\', ' ')
199 example = InputExample(guid=str(idx), text_a=text_a, text_b=text_b, label=int(label)-1)
200 examples.append(example)
201 return examples
202
203
204class SST2Processor(DataProcessor):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected