File size: 4,585 Bytes
e33db38 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
from dataclasses import dataclass
from enum import Enum
import datasets
from types import SimpleNamespace
BigBioValues = SimpleNamespace(NULL="<BB_NULL_STR>")
@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
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"
TEXT_PAIRS_CLASSIFICATION = "TXT2CLASS"
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"),
}
)
pairs_features = datasets.Features(
{
"id": datasets.Value("string"),
"document_id": datasets.Value("string"),
"text_1": datasets.Value("string"),
"text_2": datasets.Value("string"),
"label": datasets.Value("string"),
}
)
qa_features = datasets.Features(
{
"id": datasets.Value("string"),
"question_id": datasets.Value("string"),
"document_id": datasets.Value("string"),
"question": datasets.Value("string"),
"type": datasets.Value("string"),
"choices": [datasets.Value("string")],
"context": datasets.Value("string"),
"answer": datasets.Sequence(datasets.Value("string")),
}
)
text_features = datasets.Features(
{
"id": datasets.Value("string"),
"document_id": datasets.Value("string"),
"text": datasets.Value("string"),
"labels": [datasets.Value("string")],
}
)
text2text_features = datasets.Features(
{
"id": datasets.Value("string"),
"document_id": datasets.Value("string"),
"text_1": datasets.Value("string"),
"text_2": datasets.Value("string"),
"text_1_name": datasets.Value("string"),
"text_2_name": datasets.Value("string"),
}
)
kb_features = datasets.Features(
{
"id": datasets.Value("string"),
"document_id": datasets.Value("string"),
"passages": [
{
"id": datasets.Value("string"),
"type": datasets.Value("string"),
"text": datasets.Sequence(datasets.Value("string")),
"offsets": datasets.Sequence([datasets.Value("int32")]),
}
],
"entities": [
{
"id": datasets.Value("string"),
"type": datasets.Value("string"),
"text": datasets.Sequence(datasets.Value("string")),
"offsets": datasets.Sequence([datasets.Value("int32")]),
"normalized": [
{
"db_name": datasets.Value("string"),
"db_id": datasets.Value("string"),
}
],
}
],
"events": [
{
"id": datasets.Value("string"),
"type": datasets.Value("string"),
# refers to the text_bound_annotation of the trigger
"trigger": {
"text": datasets.Sequence(datasets.Value("string")),
"offsets": datasets.Sequence([datasets.Value("int32")]),
},
"arguments": [
{
"role": datasets.Value("string"),
"ref_id": datasets.Value("string"),
}
],
}
],
"coreferences": [
{
"id": datasets.Value("string"),
"entity_ids": datasets.Sequence(datasets.Value("string")),
}
],
"relations": [
{
"id": datasets.Value("string"),
"type": datasets.Value("string"),
"arg1_id": datasets.Value("string"),
"arg2_id": datasets.Value("string"),
"normalized": [
{
"db_name": datasets.Value("string"),
"db_id": datasets.Value("string"),
}
],
}
],
}
)
|