gabrielaltay
commited on
Commit
•
d963723
1
Parent(s):
4ecd51a
fix bigbio import
Browse files- seth_corpus.py +5 -3
seth_corpus.py
CHANGED
@@ -29,6 +29,8 @@ import datasets
|
|
29 |
from .bigbiohub import kb_features
|
30 |
from .bigbiohub import BigBioConfig
|
31 |
from .bigbiohub import Tasks
|
|
|
|
|
32 |
|
33 |
_LANGUAGES = ['English']
|
34 |
_PUBMED = True
|
@@ -203,7 +205,7 @@ class SethCorpusDataset(datasets.GeneratorBasedBuilder):
|
|
203 |
contents = f.readlines()
|
204 |
for guid, content in enumerate(contents):
|
205 |
file_name, text = content.split("\t")
|
206 |
-
example =
|
207 |
filepath / "annotations" / f"{file_name}.ann"
|
208 |
)
|
209 |
example["id"] = str(guid)
|
@@ -215,7 +217,7 @@ class SethCorpusDataset(datasets.GeneratorBasedBuilder):
|
|
215 |
contents = f.readlines()
|
216 |
for guid, content in enumerate(contents):
|
217 |
file_name, text = content.split("\t")
|
218 |
-
example =
|
219 |
filepath / "annotations" / f"{file_name}.ann"
|
220 |
)
|
221 |
|
@@ -226,7 +228,7 @@ class SethCorpusDataset(datasets.GeneratorBasedBuilder):
|
|
226 |
example["events"] = []
|
227 |
|
228 |
example["text"] = text
|
229 |
-
example =
|
230 |
example["id"] = str(guid)
|
231 |
yield guid, example
|
232 |
else:
|
|
|
29 |
from .bigbiohub import kb_features
|
30 |
from .bigbiohub import BigBioConfig
|
31 |
from .bigbiohub import Tasks
|
32 |
+
from .bigbiohub import parse_brat_file
|
33 |
+
from .bigbiohub import brat_parse_to_bigbio_kb
|
34 |
|
35 |
_LANGUAGES = ['English']
|
36 |
_PUBMED = True
|
|
|
205 |
contents = f.readlines()
|
206 |
for guid, content in enumerate(contents):
|
207 |
file_name, text = content.split("\t")
|
208 |
+
example = parse_brat_file(
|
209 |
filepath / "annotations" / f"{file_name}.ann"
|
210 |
)
|
211 |
example["id"] = str(guid)
|
|
|
217 |
contents = f.readlines()
|
218 |
for guid, content in enumerate(contents):
|
219 |
file_name, text = content.split("\t")
|
220 |
+
example = parse_brat_file(
|
221 |
filepath / "annotations" / f"{file_name}.ann"
|
222 |
)
|
223 |
|
|
|
228 |
example["events"] = []
|
229 |
|
230 |
example["text"] = text
|
231 |
+
example = brat_parse_to_bigbio_kb(example)
|
232 |
example["id"] = str(guid)
|
233 |
yield guid, example
|
234 |
else:
|