gabrielaltay
commited on
Commit
•
51cc888
1
Parent(s):
ca9c1b8
fix bigbio imports
Browse files- ddi_corpus.py +6 -3
ddi_corpus.py
CHANGED
@@ -28,6 +28,9 @@ 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
|
@@ -177,7 +180,7 @@ class DDICorpusDataset(datasets.GeneratorBasedBuilder):
|
|
177 |
if not file.endswith(".txt"):
|
178 |
continue
|
179 |
|
180 |
-
brat_example =
|
181 |
source_example = self._to_source_example(brat_example)
|
182 |
|
183 |
yield source_example["document_id"], source_example
|
@@ -190,8 +193,8 @@ class DDICorpusDataset(datasets.GeneratorBasedBuilder):
|
|
190 |
continue
|
191 |
|
192 |
# Read brat annotations for the given text file and convert example to the BigBio-KB format
|
193 |
-
brat_example =
|
194 |
-
kb_example =
|
195 |
kb_example["id"] = kb_example["document_id"]
|
196 |
|
197 |
yield kb_example["id"], kb_example
|
|
|
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 |
|
35 |
_LANGUAGES = ['English']
|
36 |
_PUBMED = True
|
|
|
180 |
if not file.endswith(".txt"):
|
181 |
continue
|
182 |
|
183 |
+
brat_example = parse_brat_file(Path(subdir) / file)
|
184 |
source_example = self._to_source_example(brat_example)
|
185 |
|
186 |
yield source_example["document_id"], source_example
|
|
|
193 |
continue
|
194 |
|
195 |
# Read brat annotations for the given text file and convert example to the BigBio-KB format
|
196 |
+
brat_example = parse_brat_file(Path(subdir) / file)
|
197 |
+
kb_example = brat_parse_to_bigbio_kb(brat_example)
|
198 |
kb_example["id"] = kb_example["document_id"]
|
199 |
|
200 |
yield kb_example["id"], kb_example
|