Datasets:
Tasks:
Text Classification
Sub-tasks:
multi-class-classification
Languages:
English
Size:
10K - 100K
ArXiv:
Tags:
relation extraction
License:
Fix invalid entity start/end indices for invalid examples
Browse files
kbp37.py
CHANGED
@@ -217,15 +217,18 @@ class KBP37(datasets.GeneratorBasedBuilder):
|
|
217 |
subj_end = tokens.index("</e1>")
|
218 |
tokens.pop(subj_end)
|
219 |
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
|
|
|
|
|
|
229 |
else:
|
230 |
yield int(id_), {
|
231 |
"id": id_,
|
|
|
217 |
subj_end = tokens.index("</e1>")
|
218 |
tokens.pop(subj_end)
|
219 |
|
220 |
+
# some examples, like train/1276 are invalid (empty head/tail), and
|
221 |
+
# yield non-sensical examples without this check
|
222 |
+
if subj_end > subj_start and obj_end > obj_start:
|
223 |
+
yield int(id_), {
|
224 |
+
"id": id_,
|
225 |
+
"token": tokens,
|
226 |
+
"subj_start": subj_start,
|
227 |
+
"subj_end": subj_end,
|
228 |
+
"obj_start": obj_start,
|
229 |
+
"obj_end": obj_end,
|
230 |
+
"relation": relation,
|
231 |
+
}
|
232 |
else:
|
233 |
yield int(id_), {
|
234 |
"id": id_,
|