update parsing imports
#2
by
gabrielaltay
- opened
- anat_em.py +6 -3
anat_em.py
CHANGED
|
@@ -27,6 +27,9 @@ import datasets
|
|
| 27 |
from .bigbiohub import kb_features
|
| 28 |
from .bigbiohub import BigBioConfig
|
| 29 |
from .bigbiohub import Tasks
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
_LANGUAGES = ['English']
|
| 32 |
_PUBMED = True
|
|
@@ -154,7 +157,7 @@ class AnatEMDataset(datasets.GeneratorBasedBuilder):
|
|
| 154 |
continue
|
| 155 |
|
| 156 |
# Read brat annotations for the given text file and convert example to the source format
|
| 157 |
-
brat_example =
|
| 158 |
source_example = self._to_source_example(file, brat_example)
|
| 159 |
|
| 160 |
yield source_example["document_id"], source_example
|
|
@@ -166,8 +169,8 @@ class AnatEMDataset(datasets.GeneratorBasedBuilder):
|
|
| 166 |
continue
|
| 167 |
|
| 168 |
# Read brat annotations for the given text file and convert example to the BigBio-KB format
|
| 169 |
-
brat_example =
|
| 170 |
-
kb_example =
|
| 171 |
kb_example["id"] = kb_example["document_id"]
|
| 172 |
|
| 173 |
# Fix text type annotation for the converted example
|
|
|
|
| 27 |
from .bigbiohub import kb_features
|
| 28 |
from .bigbiohub import BigBioConfig
|
| 29 |
from .bigbiohub import Tasks
|
| 30 |
+
from .bigbiohub import parse_brat_file
|
| 31 |
+
from .bigbiohub import brat_parse_to_bigbio_kb
|
| 32 |
+
|
| 33 |
|
| 34 |
_LANGUAGES = ['English']
|
| 35 |
_PUBMED = True
|
|
|
|
| 157 |
continue
|
| 158 |
|
| 159 |
# Read brat annotations for the given text file and convert example to the source format
|
| 160 |
+
brat_example = parse_brat_file(file)
|
| 161 |
source_example = self._to_source_example(file, brat_example)
|
| 162 |
|
| 163 |
yield source_example["document_id"], source_example
|
|
|
|
| 169 |
continue
|
| 170 |
|
| 171 |
# Read brat annotations for the given text file and convert example to the BigBio-KB format
|
| 172 |
+
brat_example = parse_brat_file(file)
|
| 173 |
+
kb_example = brat_parse_to_bigbio_kb(brat_example)
|
| 174 |
kb_example["id"] = kb_example["document_id"]
|
| 175 |
|
| 176 |
# Fix text type annotation for the converted example
|