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

Method get_examples

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

Source from the content-addressed store, hash-verified

133 self.labels = ["company", "school", "artist", "athlete", "politics", "transportation", "building", "river", "village", "animal", "plant", "album", "film", "book",]
134
135 def get_examples(self, data_dir, split):
136 examples = []
137 label_file = open(os.path.join(data_dir,"{}_labels.txt".format(split)),'r')
138 labels = [int(x.strip()) for x in label_file.readlines()]
139 with open(os.path.join(data_dir,'{}.txt'.format(split)),'r') as fin:
140 for idx, line in enumerate(fin):
141 splited = line.strip().split(". ")
142 text_a, text_b = splited[0], splited[1:]
143 text_a = text_a+"."
144 text_b = ". ".join(text_b)
145 example = InputExample(guid=str(idx), text_a=text_a, text_b=text_b, label=int(labels[idx]))
146 examples.append(example)
147 return examples
148
149
150class ImdbProcessor(DataProcessor):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected