Datasets:

Languages:
English
License:
gabrielaltay commited on
Commit
b10b8ae
1 Parent(s): dbcb682

upload bigbiohub.py to hub from bigbio repo

Browse files
Files changed (1) hide show
  1. bigbiohub.py +153 -0
bigbiohub.py ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from dataclasses import dataclass
2
+ from enum import Enum
3
+ import datasets
4
+ from types import SimpleNamespace
5
+
6
+
7
+ BigBioValues = SimpleNamespace(NULL="<BB_NULL_STR>")
8
+
9
+
10
+ @dataclass
11
+ class BigBioConfig(datasets.BuilderConfig):
12
+ """BuilderConfig for BigBio."""
13
+
14
+ name: str = None
15
+ version: datasets.Version = None
16
+ description: str = None
17
+ schema: str = None
18
+ subset_id: str = None
19
+
20
+
21
+ class Tasks(Enum):
22
+ NAMED_ENTITY_RECOGNITION = "NER"
23
+ NAMED_ENTITY_DISAMBIGUATION = "NED"
24
+ EVENT_EXTRACTION = "EE"
25
+ RELATION_EXTRACTION = "RE"
26
+ COREFERENCE_RESOLUTION = "COREF"
27
+ QUESTION_ANSWERING = "QA"
28
+ TEXTUAL_ENTAILMENT = "TE"
29
+ SEMANTIC_SIMILARITY = "STS"
30
+ TEXT_PAIRS_CLASSIFICATION = "TXT2CLASS"
31
+ PARAPHRASING = "PARA"
32
+ TRANSLATION = "TRANSL"
33
+ SUMMARIZATION = "SUM"
34
+ TEXT_CLASSIFICATION = "TXTCLASS"
35
+
36
+
37
+ entailment_features = datasets.Features(
38
+ {
39
+ "id": datasets.Value("string"),
40
+ "premise": datasets.Value("string"),
41
+ "hypothesis": datasets.Value("string"),
42
+ "label": datasets.Value("string"),
43
+ }
44
+ )
45
+
46
+ pairs_features = datasets.Features(
47
+ {
48
+ "id": datasets.Value("string"),
49
+ "document_id": datasets.Value("string"),
50
+ "text_1": datasets.Value("string"),
51
+ "text_2": datasets.Value("string"),
52
+ "label": datasets.Value("string"),
53
+ }
54
+ )
55
+
56
+ qa_features = datasets.Features(
57
+ {
58
+ "id": datasets.Value("string"),
59
+ "question_id": datasets.Value("string"),
60
+ "document_id": datasets.Value("string"),
61
+ "question": datasets.Value("string"),
62
+ "type": datasets.Value("string"),
63
+ "choices": [datasets.Value("string")],
64
+ "context": datasets.Value("string"),
65
+ "answer": datasets.Sequence(datasets.Value("string")),
66
+ }
67
+ )
68
+
69
+ text_features = datasets.Features(
70
+ {
71
+ "id": datasets.Value("string"),
72
+ "document_id": datasets.Value("string"),
73
+ "text": datasets.Value("string"),
74
+ "labels": [datasets.Value("string")],
75
+ }
76
+ )
77
+
78
+ text2text_features = datasets.Features(
79
+ {
80
+ "id": datasets.Value("string"),
81
+ "document_id": datasets.Value("string"),
82
+ "text_1": datasets.Value("string"),
83
+ "text_2": datasets.Value("string"),
84
+ "text_1_name": datasets.Value("string"),
85
+ "text_2_name": datasets.Value("string"),
86
+ }
87
+ )
88
+
89
+ kb_features = datasets.Features(
90
+ {
91
+ "id": datasets.Value("string"),
92
+ "document_id": datasets.Value("string"),
93
+ "passages": [
94
+ {
95
+ "id": datasets.Value("string"),
96
+ "type": datasets.Value("string"),
97
+ "text": datasets.Sequence(datasets.Value("string")),
98
+ "offsets": datasets.Sequence([datasets.Value("int32")]),
99
+ }
100
+ ],
101
+ "entities": [
102
+ {
103
+ "id": datasets.Value("string"),
104
+ "type": datasets.Value("string"),
105
+ "text": datasets.Sequence(datasets.Value("string")),
106
+ "offsets": datasets.Sequence([datasets.Value("int32")]),
107
+ "normalized": [
108
+ {
109
+ "db_name": datasets.Value("string"),
110
+ "db_id": datasets.Value("string"),
111
+ }
112
+ ],
113
+ }
114
+ ],
115
+ "events": [
116
+ {
117
+ "id": datasets.Value("string"),
118
+ "type": datasets.Value("string"),
119
+ # refers to the text_bound_annotation of the trigger
120
+ "trigger": {
121
+ "text": datasets.Sequence(datasets.Value("string")),
122
+ "offsets": datasets.Sequence([datasets.Value("int32")]),
123
+ },
124
+ "arguments": [
125
+ {
126
+ "role": datasets.Value("string"),
127
+ "ref_id": datasets.Value("string"),
128
+ }
129
+ ],
130
+ }
131
+ ],
132
+ "coreferences": [
133
+ {
134
+ "id": datasets.Value("string"),
135
+ "entity_ids": datasets.Sequence(datasets.Value("string")),
136
+ }
137
+ ],
138
+ "relations": [
139
+ {
140
+ "id": datasets.Value("string"),
141
+ "type": datasets.Value("string"),
142
+ "arg1_id": datasets.Value("string"),
143
+ "arg2_id": datasets.Value("string"),
144
+ "normalized": [
145
+ {
146
+ "db_name": datasets.Value("string"),
147
+ "db_id": datasets.Value("string"),
148
+ }
149
+ ],
150
+ }
151
+ ],
152
+ }
153
+ )