gabrielaltay
commited on
Commit
•
9ae565b
1
Parent(s):
5a48ab3
fix parsing imports
Browse files- cantemist.py +7 -4
cantemist.py
CHANGED
@@ -32,6 +32,9 @@ import pandas as pd
|
|
32 |
from .bigbiohub import kb_features
|
33 |
from .bigbiohub import BigBioConfig
|
34 |
from .bigbiohub import Tasks
|
|
|
|
|
|
|
35 |
|
36 |
_LANGUAGES = ['Spanish']
|
37 |
_PUBMED = False
|
@@ -324,7 +327,7 @@ class CantemistDataset(datasets.GeneratorBasedBuilder):
|
|
324 |
|
325 |
if self.config.schema == "source":
|
326 |
for guid, txt_file in enumerate(txt_files_task2):
|
327 |
-
example =
|
328 |
if example["document_id"] in task3_dict:
|
329 |
example["labels"] = task3_dict[example["document_id"]]
|
330 |
else:
|
@@ -338,8 +341,8 @@ class CantemistDataset(datasets.GeneratorBasedBuilder):
|
|
338 |
|
339 |
elif self.config.schema == "bigbio_kb":
|
340 |
for guid, txt_file in enumerate(txt_files_task2):
|
341 |
-
parsed_brat =
|
342 |
-
example =
|
343 |
example["id"] = str(guid)
|
344 |
for i in range(0, len(example["entities"])):
|
345 |
normalized_dict = {
|
@@ -351,7 +354,7 @@ class CantemistDataset(datasets.GeneratorBasedBuilder):
|
|
351 |
|
352 |
elif self.config.schema == "bigbio_text":
|
353 |
for guid, txt_file in enumerate(txt_files_task1):
|
354 |
-
parsed_brat =
|
355 |
if parsed_brat["document_id"] in task3_dict:
|
356 |
labels = task3_dict[parsed_brat["document_id"]]
|
357 |
else:
|
|
|
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 = ['Spanish']
|
40 |
_PUBMED = False
|
|
|
327 |
|
328 |
if self.config.schema == "source":
|
329 |
for guid, txt_file in enumerate(txt_files_task2):
|
330 |
+
example = parse_brat_file(txt_file, parse_notes=True)
|
331 |
if example["document_id"] in task3_dict:
|
332 |
example["labels"] = task3_dict[example["document_id"]]
|
333 |
else:
|
|
|
341 |
|
342 |
elif self.config.schema == "bigbio_kb":
|
343 |
for guid, txt_file in enumerate(txt_files_task2):
|
344 |
+
parsed_brat = parse_brat_file(txt_file, parse_notes=True)
|
345 |
+
example = brat_parse_to_bigbio_kb(parsed_brat)
|
346 |
example["id"] = str(guid)
|
347 |
for i in range(0, len(example["entities"])):
|
348 |
normalized_dict = {
|
|
|
354 |
|
355 |
elif self.config.schema == "bigbio_text":
|
356 |
for guid, txt_file in enumerate(txt_files_task1):
|
357 |
+
parsed_brat = parse_brat_file(txt_file, parse_notes=False)
|
358 |
if parsed_brat["document_id"] in task3_dict:
|
359 |
labels = task3_dict[parsed_brat["document_id"]]
|
360 |
else:
|