Commit
·
c0e0bc6
1
Parent(s):
25c2add
fix bigbio imports
Browse files
pdr.py
CHANGED
|
@@ -28,6 +28,8 @@ import datasets
|
|
| 28 |
from .bigbiohub import kb_features
|
| 29 |
from .bigbiohub import BigBioConfig
|
| 30 |
from .bigbiohub import Tasks
|
|
|
|
|
|
|
| 31 |
|
| 32 |
_LANGUAGES = ['English']
|
| 33 |
_PUBMED = True
|
|
@@ -198,21 +200,21 @@ class PDRDataset(datasets.GeneratorBasedBuilder):
|
|
| 198 |
|
| 199 |
if self.config.subset_id == "pdr_annotator1":
|
| 200 |
# Provide annotations of annotator 1
|
| 201 |
-
example =
|
| 202 |
-
example =
|
| 203 |
|
| 204 |
elif self.config.subset_id == "pdr_annotator2":
|
| 205 |
# Provide annotations of annotator 2
|
| 206 |
-
example =
|
| 207 |
-
example =
|
| 208 |
|
| 209 |
elif self.config.subset_id == "pdr":
|
| 210 |
# Provide merged version of annotator 1 and 2
|
| 211 |
-
annotator1 =
|
| 212 |
-
annotator1 =
|
| 213 |
|
| 214 |
-
annotator2 =
|
| 215 |
-
annotator2 =
|
| 216 |
|
| 217 |
example = self._merge_annotations_by_intersection(
|
| 218 |
file, annotator1, annotator2
|
|
@@ -229,11 +231,11 @@ class PDRDataset(datasets.GeneratorBasedBuilder):
|
|
| 229 |
if not str(file).endswith(".txt"):
|
| 230 |
continue
|
| 231 |
|
| 232 |
-
annotator1 =
|
| 233 |
-
annotator1 =
|
| 234 |
|
| 235 |
-
annotator2 =
|
| 236 |
-
annotator2 =
|
| 237 |
|
| 238 |
merged_annotation = self._merge_annotations_by_intersection(
|
| 239 |
file, annotator1, annotator2
|
|
|
|
| 28 |
from .bigbiohub import kb_features
|
| 29 |
from .bigbiohub import BigBioConfig
|
| 30 |
from .bigbiohub import Tasks
|
| 31 |
+
from .bigbiohub import parse_brat_file
|
| 32 |
+
from .bigbiohub import brat_parse_to_bigbio_kb
|
| 33 |
|
| 34 |
_LANGUAGES = ['English']
|
| 35 |
_PUBMED = True
|
|
|
|
| 200 |
|
| 201 |
if self.config.subset_id == "pdr_annotator1":
|
| 202 |
# Provide annotations of annotator 1
|
| 203 |
+
example = parse_brat_file(file, [".ann"])
|
| 204 |
+
example = brat_parse_to_bigbio_kb(example)
|
| 205 |
|
| 206 |
elif self.config.subset_id == "pdr_annotator2":
|
| 207 |
# Provide annotations of annotator 2
|
| 208 |
+
example = parse_brat_file(file, [".ann2"])
|
| 209 |
+
example = brat_parse_to_bigbio_kb(example)
|
| 210 |
|
| 211 |
elif self.config.subset_id == "pdr":
|
| 212 |
# Provide merged version of annotator 1 and 2
|
| 213 |
+
annotator1 = parse_brat_file(file, [".ann"])
|
| 214 |
+
annotator1 = brat_parse_to_bigbio_kb(annotator1)
|
| 215 |
|
| 216 |
+
annotator2 = parse_brat_file(file, [".ann2"])
|
| 217 |
+
annotator2 = brat_parse_to_bigbio_kb(annotator2)
|
| 218 |
|
| 219 |
example = self._merge_annotations_by_intersection(
|
| 220 |
file, annotator1, annotator2
|
|
|
|
| 231 |
if not str(file).endswith(".txt"):
|
| 232 |
continue
|
| 233 |
|
| 234 |
+
annotator1 = parse_brat_file(file, [".ann"])
|
| 235 |
+
annotator1 = brat_parse_to_bigbio_kb(annotator1)
|
| 236 |
|
| 237 |
+
annotator2 = parse_brat_file(file, [".ann2"])
|
| 238 |
+
annotator2 = brat_parse_to_bigbio_kb(annotator2)
|
| 239 |
|
| 240 |
merged_annotation = self._merge_annotations_by_intersection(
|
| 241 |
file, annotator1, annotator2
|