Amanpreet Singh
commited on
Commit
•
df53f7b
1
Parent(s):
1ec99fb
Add yes/no task
Browse files- bioasq_task_b.py +14 -0
bioasq_task_b.py
CHANGED
@@ -28,6 +28,7 @@ import json
|
|
28 |
import os
|
29 |
import re
|
30 |
from dataclasses import dataclass
|
|
|
31 |
|
32 |
import datasets
|
33 |
from enum import Enum
|
@@ -420,6 +421,7 @@ class BigBioConfig(datasets.BuilderConfig):
|
|
420 |
description: str = None
|
421 |
schema: str = None
|
422 |
subset_id: str = None
|
|
|
423 |
|
424 |
|
425 |
class BioasqTaskBDataset(datasets.GeneratorBasedBuilder):
|
@@ -454,6 +456,16 @@ class BioasqTaskBDataset(datasets.GeneratorBasedBuilder):
|
|
454 |
subset_id=f"bioasq_{version}b",
|
455 |
)
|
456 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
457 |
|
458 |
@property
|
459 |
def manual_download_instructions(self):
|
@@ -629,6 +641,8 @@ class BioasqTaskBDataset(datasets.GeneratorBasedBuilder):
|
|
629 |
# for questions that do not have snippets, skip
|
630 |
if "snippets" not in record:
|
631 |
continue
|
|
|
|
|
632 |
for i, snippet in enumerate(record["snippets"]):
|
633 |
yield uid, {
|
634 |
"id": f'{record["id"]}_{i}',
|
|
|
28 |
import os
|
29 |
import re
|
30 |
from dataclasses import dataclass
|
31 |
+
from typing import Optional
|
32 |
|
33 |
import datasets
|
34 |
from enum import Enum
|
|
|
421 |
description: str = None
|
422 |
schema: str = None
|
423 |
subset_id: str = None
|
424 |
+
type_subset: Optional[str] = None
|
425 |
|
426 |
|
427 |
class BioasqTaskBDataset(datasets.GeneratorBasedBuilder):
|
|
|
456 |
subset_id=f"bioasq_{version}b",
|
457 |
)
|
458 |
)
|
459 |
+
BUILDER_CONFIGS.append(
|
460 |
+
BigBioConfig(
|
461 |
+
name="bioasq_7b_bigbio_qa_yes_no_only",
|
462 |
+
version=BIGBIO_VERSION,
|
463 |
+
description="bioasq7 Task B in simplified BigBio schema",
|
464 |
+
schema="bigbio_qa",
|
465 |
+
subset_id="bioasq_7b",
|
466 |
+
type_subset="yesno"
|
467 |
+
)
|
468 |
+
)
|
469 |
|
470 |
@property
|
471 |
def manual_download_instructions(self):
|
|
|
641 |
# for questions that do not have snippets, skip
|
642 |
if "snippets" not in record:
|
643 |
continue
|
644 |
+
if self.config.type_subset is not None and self.config.type_subset != record["type"]:
|
645 |
+
continue
|
646 |
for i, snippet in enumerate(record["snippets"]):
|
647 |
yield uid, {
|
648 |
"id": f'{record["id"]}_{i}',
|