gabrielaltay
commited on
Commit
•
de8e5a3
1
Parent(s):
269ba64
fix bigbio imports
Browse files
genia_ptm_event_corpus.py
CHANGED
@@ -30,6 +30,9 @@ import datasets
|
|
30 |
from .bigbiohub import kb_features
|
31 |
from .bigbiohub import BigBioConfig
|
32 |
from .bigbiohub import Tasks
|
|
|
|
|
|
|
33 |
|
34 |
_LANGUAGES = ['English']
|
35 |
_PUBMED = True
|
@@ -194,7 +197,7 @@ class GeniaPtmEventCorpusDataset(datasets.GeneratorBasedBuilder):
|
|
194 |
if filename.endswith(".txt"):
|
195 |
txt_file_path = Path(dirpath, filename)
|
196 |
if self.config.schema == "source":
|
197 |
-
example =
|
198 |
txt_file_path, annotation_file_suffixes=[".a1", ".a2"]
|
199 |
)
|
200 |
example["id"] = str(guid)
|
@@ -202,8 +205,8 @@ class GeniaPtmEventCorpusDataset(datasets.GeneratorBasedBuilder):
|
|
202 |
del example[key]
|
203 |
yield guid, example
|
204 |
elif self.config.schema == "bigbio_kb":
|
205 |
-
example =
|
206 |
-
|
207 |
)
|
208 |
example["id"] = str(guid)
|
209 |
yield guid, example
|
|
|
30 |
from .bigbiohub import kb_features
|
31 |
from .bigbiohub import BigBioConfig
|
32 |
from .bigbiohub import Tasks
|
33 |
+
from .bigbiohub import parse_brat_file
|
34 |
+
from .bigbiohub import brat_parse_to_bigbio_kb
|
35 |
+
|
36 |
|
37 |
_LANGUAGES = ['English']
|
38 |
_PUBMED = True
|
|
|
197 |
if filename.endswith(".txt"):
|
198 |
txt_file_path = Path(dirpath, filename)
|
199 |
if self.config.schema == "source":
|
200 |
+
example = parse_brat_file(
|
201 |
txt_file_path, annotation_file_suffixes=[".a1", ".a2"]
|
202 |
)
|
203 |
example["id"] = str(guid)
|
|
|
205 |
del example[key]
|
206 |
yield guid, example
|
207 |
elif self.config.schema == "bigbio_kb":
|
208 |
+
example = brat_parse_to_bigbio_kb(
|
209 |
+
parse_brat_file(txt_file_path)
|
210 |
)
|
211 |
example["id"] = str(guid)
|
212 |
yield guid, example
|