`Dbpedia `_ is a Wikipedia Topic Classification dataset. we use dataset provided by `LOTClass `_
| 122 | return examples |
| 123 | |
| 124 | class DBpediaProcessor(DataProcessor): |
| 125 | """ |
| 126 | `Dbpedia <https://aclanthology.org/L16-1532.pdf>`_ is a Wikipedia Topic Classification dataset. |
| 127 | |
| 128 | we use dataset provided by `LOTClass <https://github.com/yumeng5/LOTClass>`_ |
| 129 | """ |
| 130 | |
| 131 | def __init__(self): |
| 132 | super().__init__() |
| 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 | |
| 150 | class ImdbProcessor(DataProcessor): |
nothing calls this directly
no outgoing calls
no test coverage detected