import json from collections import defaultdict from enum import Enum from types import SimpleNamespace from dataclasses import dataclass import datasets from licenses import License from licenses import Licenses BigBioValues = SimpleNamespace(NULL="") @dataclass class BigBioConfig(datasets.BuilderConfig): """BuilderConfig for BigBio.""" name: str = None version: datasets.Version = None description: str = None schema: str = None subset_id: str = None # shamelessly compied from: # https://github.com/huggingface/datasets/blob/master/src/datasets/utils/metadata.py langs_json = json.load(open("languages.json", "r")) langs_dict = {k.replace("-", "_").upper(): v for k, v in langs_json.items()} Lang = Enum("Lang", langs_dict) METADATA: dict = { "_LOCAL": bool, "_LANGUAGES": Lang, "_PUBMED": bool, "_LICENSE": License, "_DISPLAYNAME": str, } class Tasks(Enum): NAMED_ENTITY_RECOGNITION = "NER" NAMED_ENTITY_DISAMBIGUATION = "NED" EVENT_EXTRACTION = "EE" RELATION_EXTRACTION = "RE" COREFERENCE_RESOLUTION = "COREF" QUESTION_ANSWERING = "QA" TEXTUAL_ENTAILMENT = "TE" SEMANTIC_SIMILARITY = "STS" PARAPHRASING = "PARA" TRANSLATION = "TRANSL" SUMMARIZATION = "SUM" TEXT_CLASSIFICATION = "TXTCLASS" entailment_features = datasets.Features( { "id": datasets.Value("string"), "premise": datasets.Value("string"), "hypothesis": datasets.Value("string"), "label": datasets.Value("string"), } )