Commit
·
207b60d
1
Parent(s):
3ecbd2c
fix bigbio import
Browse files- pharmaconer.py +7 -5
pharmaconer.py
CHANGED
@@ -32,6 +32,8 @@ 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
|
@@ -310,7 +312,7 @@ class PharmaconerDataset(datasets.GeneratorBasedBuilder):
|
|
310 |
|
311 |
if self.config.schema == "source":
|
312 |
for guid, (txt_file, tsv_file) in enumerate(zip(txt_files, tsv_files)):
|
313 |
-
example =
|
314 |
try:
|
315 |
subtrack2_df = pd.read_csv(tsv_file, sep="\t", header=None)
|
316 |
subtrack2_df[1] = subtrack2_df[1].apply(str)
|
@@ -324,16 +326,16 @@ class PharmaconerDataset(datasets.GeneratorBasedBuilder):
|
|
324 |
|
325 |
elif self.config.schema == "bigbio_kb":
|
326 |
for guid, (txt_file, tsv_file) in enumerate(zip(txt_files, tsv_files)):
|
327 |
-
example =
|
328 |
-
|
329 |
)
|
330 |
example["id"] = str(guid)
|
331 |
yield guid, example
|
332 |
|
333 |
elif self.config.schema == "bigbio_text":
|
334 |
for guid, (txt_file, tsv_file) in enumerate(zip(txt_files, tsv_files)):
|
335 |
-
brat =
|
336 |
-
|
337 |
)
|
338 |
try:
|
339 |
subtrack2_df = pd.read_csv(tsv_file, sep="\t", header=None)
|
|
|
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 |
_LANGUAGES = ['Spanish']
|
39 |
_PUBMED = False
|
|
|
312 |
|
313 |
if self.config.schema == "source":
|
314 |
for guid, (txt_file, tsv_file) in enumerate(zip(txt_files, tsv_files)):
|
315 |
+
example = parse_brat_file(txt_file)
|
316 |
try:
|
317 |
subtrack2_df = pd.read_csv(tsv_file, sep="\t", header=None)
|
318 |
subtrack2_df[1] = subtrack2_df[1].apply(str)
|
|
|
326 |
|
327 |
elif self.config.schema == "bigbio_kb":
|
328 |
for guid, (txt_file, tsv_file) in enumerate(zip(txt_files, tsv_files)):
|
329 |
+
example = brat_parse_to_bigbio_kb(
|
330 |
+
parse_brat_file(txt_file)
|
331 |
)
|
332 |
example["id"] = str(guid)
|
333 |
yield guid, example
|
334 |
|
335 |
elif self.config.schema == "bigbio_text":
|
336 |
for guid, (txt_file, tsv_file) in enumerate(zip(txt_files, tsv_files)):
|
337 |
+
brat = brat_parse_to_bigbio_kb(
|
338 |
+
parse_brat_file(txt_file)
|
339 |
)
|
340 |
try:
|
341 |
subtrack2_df = pd.read_csv(tsv_file, sep="\t", header=None)
|