(self, data_dir, split)
| 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 | |
| 124 | class DBpediaProcessor(DataProcessor): |
| 125 | """ |
nothing calls this directly
no outgoing calls
no test coverage detected