Commit ·
21d31fd
1
Parent(s): 920e958
fix bigbio imports
Browse files- genia_relation_corpus.py +6 -3
genia_relation_corpus.py
CHANGED
|
@@ -32,6 +32,9 @@ import datasets
|
|
| 32 |
from .bigbiohub import kb_features
|
| 33 |
from .bigbiohub import BigBioConfig
|
| 34 |
from .bigbiohub import Tasks
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
_LANGUAGES = ['English']
|
| 37 |
_PUBMED = True
|
|
@@ -202,7 +205,7 @@ class GeniaRelationCorpusDataset(datasets.GeneratorBasedBuilder):
|
|
| 202 |
if filename.endswith(".txt"):
|
| 203 |
txt_file_path = Path(dirpath, filename)
|
| 204 |
if self.config.schema == "source":
|
| 205 |
-
example =
|
| 206 |
txt_file_path, annotation_file_suffixes=[".a1", ".rel"]
|
| 207 |
)
|
| 208 |
example["id"] = str(guid)
|
|
@@ -210,8 +213,8 @@ class GeniaRelationCorpusDataset(datasets.GeneratorBasedBuilder):
|
|
| 210 |
del example[key]
|
| 211 |
yield guid, example
|
| 212 |
elif self.config.schema == "bigbio_kb":
|
| 213 |
-
example =
|
| 214 |
-
|
| 215 |
)
|
| 216 |
example["id"] = str(guid)
|
| 217 |
yield guid, example
|
|
|
|
| 32 |
from .bigbiohub import kb_features
|
| 33 |
from .bigbiohub import BigBioConfig
|
| 34 |
from .bigbiohub import Tasks
|
| 35 |
+
from .bigbiohub import parse_brat_file
|
| 36 |
+
from .bigbiohub import brat_parse_to_bigbio_kb
|
| 37 |
+
|
| 38 |
|
| 39 |
_LANGUAGES = ['English']
|
| 40 |
_PUBMED = True
|
|
|
|
| 205 |
if filename.endswith(".txt"):
|
| 206 |
txt_file_path = Path(dirpath, filename)
|
| 207 |
if self.config.schema == "source":
|
| 208 |
+
example = parse_brat_file(
|
| 209 |
txt_file_path, annotation_file_suffixes=[".a1", ".rel"]
|
| 210 |
)
|
| 211 |
example["id"] = str(guid)
|
|
|
|
| 213 |
del example[key]
|
| 214 |
yield guid, example
|
| 215 |
elif self.config.schema == "bigbio_kb":
|
| 216 |
+
example = brat_parse_to_bigbio_kb(
|
| 217 |
+
parse_brat_file(txt_file_path)
|
| 218 |
)
|
| 219 |
example["id"] = str(guid)
|
| 220 |
yield guid, example
|