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

Method get_examples

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

Source from the content-addressed store, hash-verified

241 self.labels = ["contradiction", "entailment", "neutral"]
242
243 def get_examples(self, data_dir, split):
244 path = os.path.join(data_dir, "{}.jsonl".format(self.dataset_project[split]))
245 examples = []
246 with open(path)as f:
247 lines = f.readlines()
248 for idx, line in enumerate(lines):
249 data = json.loads(line)
250 text_a = data["sentence1"]
251 text_b = data["sentence2"]
252 if data["gold_label"] not in self.labels:
253 continue
254 label = self.get_label_id(data["gold_label"])
255 example = InputExample(
256 guid=str(idx), text_a=text_a, text_b=text_b, label=label)
257 examples.append(example)
258 return examples
259
260class YelpProcessor(DataProcessor):
261 dataset_project = {"train": "train",

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected