Amanpreet Singh commited on
Commit
b29d824
1 Parent(s): 4607ab7

Fix local deps

Browse files
Files changed (1) hide show
  1. bioasq_task_b.py +47 -4
bioasq_task_b.py CHANGED
@@ -27,11 +27,11 @@ import glob
27
  import json
28
  import os
29
  import re
 
30
 
31
  import datasets
32
- from utils import schemas
33
- from utils.configs import BigBioConfig
34
- from utils.constants import Tasks
35
 
36
  _CITATION = """\
37
  @article{tsatsaronis2015overview,
@@ -374,10 +374,53 @@ _URLs = {
374
  "bioasq_2b": ["BioASQ-trainingDataset2b.zip", "Task2BGoldenEnriched.zip"],
375
  }
376
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
377
  _SUPPORTED_TASKS = [Tasks.QUESTION_ANSWERING]
378
  _SOURCE_VERSION = "1.0.0"
379
  _BIGBIO_VERSION = "1.0.0"
380
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
381
 
382
  class BioasqTaskBDataset(datasets.GeneratorBasedBuilder):
383
  """
@@ -446,7 +489,7 @@ class BioasqTaskBDataset(datasets.GeneratorBasedBuilder):
446
  )
447
  # simplified schema for QA tasks
448
  elif self.config.schema == "bigbio_qa":
449
- features = schemas.qa_features
450
 
451
  return datasets.DatasetInfo(
452
  description=_DESCRIPTION[self.config.subset_id],
 
27
  import json
28
  import os
29
  import re
30
+ from dataclasses import dataclass
31
 
32
  import datasets
33
+ from enum import Enum
34
+
 
35
 
36
  _CITATION = """\
37
  @article{tsatsaronis2015overview,
 
374
  "bioasq_2b": ["BioASQ-trainingDataset2b.zip", "Task2BGoldenEnriched.zip"],
375
  }
376
 
377
+ class Tasks(Enum):
378
+ NAMED_ENTITY_RECOGNITION = "NER"
379
+ NAMED_ENTITY_DISAMBIGUATION = "NED"
380
+ EVENT_EXTRACTION = "EE"
381
+ RELATION_EXTRACTION = "RE"
382
+ COREFERENCE_RESOLUTION = "COREF"
383
+
384
+ QUESTION_ANSWERING = "QA"
385
+
386
+ TEXTUAL_ENTAILMENT = "TE"
387
+
388
+ SEMANTIC_SIMILARITY = "STS"
389
+
390
+ PARAPHRASING = "PARA"
391
+ TRANSLATION = "TRANSL"
392
+ SUMMARIZATION = "SUM"
393
+
394
+ TEXT_CLASSIFICATION = "TXTCLASS"
395
+
396
  _SUPPORTED_TASKS = [Tasks.QUESTION_ANSWERING]
397
  _SOURCE_VERSION = "1.0.0"
398
  _BIGBIO_VERSION = "1.0.0"
399
 
400
+ qa_features = datasets.Features(
401
+ {
402
+ "id": datasets.Value("string"),
403
+ "question_id": datasets.Value("string"),
404
+ "document_id": datasets.Value("string"),
405
+ "question": datasets.Value("string"),
406
+ "type": datasets.Value("string"),
407
+ "choices": [datasets.Value("string")],
408
+ "context": datasets.Value("string"),
409
+ "answer": datasets.Sequence(datasets.Value("string")),
410
+ }
411
+ )
412
+
413
+
414
+ @dataclass
415
+ class BigBioConfig(datasets.BuilderConfig):
416
+ """BuilderConfig for BigBio."""
417
+
418
+ name: str = None
419
+ version: datasets.Version = None
420
+ description: str = None
421
+ schema: str = None
422
+ subset_id: str = None
423
+
424
 
425
  class BioasqTaskBDataset(datasets.GeneratorBasedBuilder):
426
  """
 
489
  )
490
  # simplified schema for QA tasks
491
  elif self.config.schema == "bigbio_qa":
492
+ features = qa_features
493
 
494
  return datasets.DatasetInfo(
495
  description=_DESCRIPTION[self.config.subset_id],