system HF staff commited on
Commit
3d5cc7c
0 Parent(s):

Update files from the datasets library (from 1.2.0)

Browse files

Release notes: https://github.com/huggingface/datasets/releases/tag/1.2.0

.gitattributes ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bin.* filter=lfs diff=lfs merge=lfs -text
5
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.model filter=lfs diff=lfs merge=lfs -text
12
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
13
+ *.onnx filter=lfs diff=lfs merge=lfs -text
14
+ *.ot filter=lfs diff=lfs merge=lfs -text
15
+ *.parquet filter=lfs diff=lfs merge=lfs -text
16
+ *.pb filter=lfs diff=lfs merge=lfs -text
17
+ *.pt filter=lfs diff=lfs merge=lfs -text
18
+ *.pth filter=lfs diff=lfs merge=lfs -text
19
+ *.rar filter=lfs diff=lfs merge=lfs -text
20
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
21
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
22
+ *.tflite filter=lfs diff=lfs merge=lfs -text
23
+ *.tgz filter=lfs diff=lfs merge=lfs -text
24
+ *.xz filter=lfs diff=lfs merge=lfs -text
25
+ *.zip filter=lfs diff=lfs merge=lfs -text
26
+ *.zstandard filter=lfs diff=lfs merge=lfs -text
27
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,249 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ annotations_creators:
3
+ - no-annotation
4
+ language_creators:
5
+ - expert-generated
6
+ languages:
7
+ en:
8
+ - en
9
+ es:
10
+ - es
11
+ licenses:
12
+ - mit
13
+ multilinguality:
14
+ - monolingual
15
+ size_categories:
16
+ - 1K<n<10K
17
+ source_datasets:
18
+ - original
19
+ task_categories:
20
+ - question-answering
21
+ task_ids:
22
+ - multiple-choice-qa
23
+ ---
24
+
25
+ # Dataset Card for HEAD-QA
26
+
27
+ ## Table of Contents
28
+ - [Dataset Description](#dataset-description)
29
+ - [Dataset Summary](#dataset-summary)
30
+ - [Supported Tasks](#supported-tasks-and-leaderboards)
31
+ - [Languages](#languages)
32
+ - [Dataset Structure](#dataset-structure)
33
+ - [Data Instances](#data-instances)
34
+ - [Data Fields](#data-fields)
35
+ - [Data Splits](#data-splits)
36
+ - [Dataset Creation](#dataset-creation)
37
+ - [Curation Rationale](#curation-rationale)
38
+ - [Source Data](#source-data)
39
+ - [Annotations](#annotations)
40
+ - [Personal and Sensitive Information](#personal-and-sensitive-information)
41
+ - [Considerations for Using the Data](#considerations-for-using-the-data)
42
+ - [Social Impact of Dataset](#social-impact-of-dataset)
43
+ - [Discussion of Biases](#discussion-of-biases)
44
+ - [Other Known Limitations](#other-known-limitations)
45
+ - [Additional Information](#additional-information)
46
+ - [Dataset Curators](#dataset-curators)
47
+ - [Licensing Information](#licensing-information)
48
+ - [Citation Information](#citation-information)
49
+
50
+ ## Dataset Description
51
+
52
+ - **Homepage:** [HEAD-QA homepage](https://aghie.github.io/head-qa/)
53
+ - **Repository:** [HEAD-QA repository](https://github.com/aghie/head-qa)
54
+ - **Paper:** [HEAD-QA: A Healthcare Dataset for Complex Reasoning](https://www.aclweb.org/anthology/P19-1092/)
55
+ - **Leaderboard:** [HEAD-QA leaderboard](https://aghie.github.io/head-qa/#leaderboard-general)
56
+ - **Point of Contact:** [María Grandury](mailto:mariagrandury@gmail.com) (Dataset Submitter)
57
+
58
+ ### Dataset Summary
59
+
60
+ HEAD-QA is a multi-choice HEAlthcare Dataset. The questions come from exams to access a specialized position in the
61
+ Spanish healthcare system, and are challenging even for highly specialized humans. They are designed by the
62
+ [Ministerio de Sanidad, Consumo y Bienestar Social](https://www.mscbs.gob.es/), who also provides direct
63
+ [access](https://fse.mscbs.gob.es/fseweb/view/public/datosanteriores/cuadernosExamen/busquedaConvocatoria.xhtml)
64
+ to the exams of the last 5 years (in Spanish).
65
+
66
+ ```
67
+ Date of the last update of the documents object of the reuse: January, 14th, 2019.
68
+ ```
69
+
70
+ HEAD-QA tries to make these questions accesible for the Natural Language Processing community. We hope it is an useful resource towards achieving better QA systems. The dataset contains questions about the following topics:
71
+ - Medicine
72
+ - Nursing
73
+ - Psychology
74
+ - Chemistry
75
+ - Pharmacology
76
+ - Biology
77
+
78
+ ### Supported Tasks and Leaderboards
79
+
80
+ - `multiple-choice-qa`: HEAD-QA is a multi-choice question answering testbed to encourage research on complex reasoning.
81
+
82
+ ### Languages
83
+
84
+ The questions and answers are available in both Spanish (BCP-47 code: 'es-ES') and English (BCP-47 code: 'en').
85
+
86
+ The language by default is Spanish:
87
+ ```
88
+ from datasets import load_dataset
89
+
90
+ data_es = load_dataset('head_qa')
91
+
92
+ data_en = load_dataset('head_qa', 'en')
93
+ ```
94
+
95
+ ## Dataset Structure
96
+
97
+ ### Data Instances
98
+
99
+ A typical data point comprises a question `qtext`, multiple possible answers `atext` and the right answer `ra`.
100
+
101
+ An example from the HEAD-QA dataset looks as follows:
102
+ ```
103
+ {
104
+ 'qid': '1',
105
+ 'category': 'biology',
106
+ 'qtext': 'Los potenciales postsinápticos excitadores:',
107
+ 'answers': [
108
+ {
109
+ 'aid': 1,
110
+ 'atext': 'Son de tipo todo o nada.'
111
+ },
112
+ {
113
+ 'aid': 2,
114
+ 'atext': 'Son hiperpolarizantes.'
115
+ },
116
+ {
117
+ 'aid': 3,
118
+ 'atext': 'Se pueden sumar.'
119
+ },
120
+ {
121
+ 'aid': 4,
122
+ 'atext': 'Se propagan a largas distancias.'
123
+ },
124
+ {
125
+ 'aid': 5,
126
+ 'atext': 'Presentan un periodo refractario.'
127
+ }],
128
+ 'ra': '3',
129
+ 'image': '',
130
+ 'name': 'Cuaderno_2013_1_B',
131
+ 'year': '2013'
132
+ }
133
+ ```
134
+
135
+ ### Data Fields
136
+
137
+ - `qid`: question identifier (int)
138
+ - `category`: category of the question: "medicine", "nursing", "psychology", "chemistry", "pharmacology", "biology"
139
+ - `qtext`: question text
140
+ - `answers`: list of possible answers. Each element of the list is a dictionary with 2 keys:
141
+ - `aid`: answer identifier (int)
142
+ - `atext`: answer text
143
+ - `ra`: `aid` of the right answer (int)
144
+ - `image`: optional, some of the questions refer to an image
145
+ - `name`: name of the exam from which the question was extracted
146
+ - `year`: year in which the exam took place
147
+
148
+ ### Data Splits
149
+
150
+ The data is split into train, validation and test set for each of the two languages. The split sizes are as follow:
151
+
152
+ | | Train | Val | Test |
153
+ | ----- | ------ | ----- | ---- |
154
+ | Spanish | 2657 | 1366 | 2742 |
155
+ | English | 2657 | 1366 | 2742 |
156
+
157
+ ## Dataset Creation
158
+
159
+ ### Curation Rationale
160
+
161
+ As motivation for the creation of this dataset, here is the abstract of the paper:
162
+
163
+ "We present HEAD-QA, a multi-choice question answering testbed to encourage research on complex reasoning. The questions
164
+ come from exams to access a specialized position in the Spanish healthcare system, and are challenging even for highly
165
+ specialized humans. We then consider monolingual (Spanish) and cross-lingual (to English) experiments with information
166
+ retrieval and neural techniques. We show that: (i) HEAD-QA challenges current methods, and (ii) the results lag well
167
+ behind human performance, demonstrating its usefulness as a benchmark for future work."
168
+
169
+ ### Source Data
170
+
171
+ #### Initial Data Collection and Normalization
172
+
173
+ The questions come from exams to access a specialized position in the Spanish healthcare system, and are designed by the
174
+ [Ministerio de Sanidad, Consumo y Bienestar Social](https://www.mscbs.gob.es/), who also provides direct
175
+ [access](https://fse.mscbs.gob.es/fseweb/view/public/datosanteriores/cuadernosExamen/busquedaConvocatoria.xhtml)
176
+ to the exams of the last 5 years (in Spanish).
177
+
178
+ #### Who are the source language producers?
179
+
180
+ The dataset was created by David Vilares and Carlos Gómez-Rodríguez.
181
+
182
+ ### Annotations
183
+
184
+ The dataset does not contain any additional annotations.
185
+
186
+ #### Annotation process
187
+
188
+ [N/A]
189
+
190
+ #### Who are the annotators?
191
+
192
+ [N/A]
193
+
194
+ ### Personal and Sensitive Information
195
+
196
+ [More Information Needed]
197
+
198
+ ## Considerations for Using the Data
199
+
200
+ ### Social Impact of Dataset
201
+
202
+ [More Information Needed]
203
+
204
+ ### Discussion of Biases
205
+
206
+ [More Information Needed]
207
+
208
+ ### Other Known Limitations
209
+
210
+ [More Information Needed]
211
+
212
+ ## Additional Information
213
+
214
+ ### Dataset Curators
215
+
216
+ The dataset was created by David Vilares and Carlos Gómez-Rodríguez.
217
+
218
+ ### Licensing Information
219
+
220
+ According to the [HEAD-QA homepage](https://aghie.github.io/head-qa/#legal-requirements):
221
+
222
+ The Ministerio de Sanidad, Consumo y Biniestar Social allows the redistribution of the exams and their content under [certain conditions:](https://www.mscbs.gob.es/avisoLegal/home.htm)
223
+
224
+ - The denaturalization of the content of the information is prohibited in any circumstance.
225
+ - The user is obliged to cite the source of the documents subject to reuse.
226
+ - The user is obliged to indicate the date of the last update of the documents object of the reuse.
227
+
228
+ According to the [HEAD-QA repository](https://github.com/aghie/head-qa/blob/master/LICENSE):
229
+
230
+ The dataset is licensed under the [MIT License](https://mit-license.org/).
231
+
232
+ ### Citation Information
233
+
234
+ ```
235
+ @inproceedings{vilares-gomez-rodriguez-2019-head,
236
+ title = "{HEAD}-{QA}: A Healthcare Dataset for Complex Reasoning",
237
+ author = "Vilares, David and
238
+ G{\'o}mez-Rodr{\'i}guez, Carlos",
239
+ booktitle = "Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics",
240
+ month = jul,
241
+ year = "2019",
242
+ address = "Florence, Italy",
243
+ publisher = "Association for Computational Linguistics",
244
+ url = "https://www.aclweb.org/anthology/P19-1092",
245
+ doi = "10.18653/v1/P19-1092",
246
+ pages = "960--966",
247
+ abstract = "We present HEAD-QA, a multi-choice question answering testbed to encourage research on complex reasoning. The questions come from exams to access a specialized position in the Spanish healthcare system, and are challenging even for highly specialized humans. We then consider monolingual (Spanish) and cross-lingual (to English) experiments with information retrieval and neural techniques. We show that: (i) HEAD-QA challenges current methods, and (ii) the results lag well behind human performance, demonstrating its usefulness as a benchmark for future work.",
248
+ }
249
+ ```
dataset_infos.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"es": {"description": "HEAD-QA is a multi-choice HEAlthcare Dataset. The questions come from exams to access a specialized position in the\nSpanish healthcare system, and are challenging even for highly specialized humans. They are designed by the Ministerio\nde Sanidad, Consumo y Bienestar Social.\n\nThe dataset contains questions about the following topics: medicine, nursing, psychology, chemistry, pharmacology and biology.\n", "citation": "@inproceedings{vilares-gomez-rodriguez-2019-head,\n title = \"{HEAD}-{QA}: A Healthcare Dataset for Complex Reasoning\",\n author = \"Vilares, David and\n G{'o}mez-Rodr{'i}guez, Carlos\",\n booktitle = \"Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics\",\n month = jul,\n year = \"2019\",\n address = \"Florence, Italy\",\n publisher = \"Association for Computational Linguistics\",\n url = \"https://www.aclweb.org/anthology/P19-1092\",\n doi = \"10.18653/v1/P19-1092\",\n pages = \"960--966\",\n abstract = \"We present HEAD-QA, a multi-choice question answering testbed to encourage research on complex reasoning. The questions come from exams to access a specialized position in the Spanish healthcare system, and are challenging even for highly specialized humans. We then consider monolingual (Spanish) and cross-lingual (to English) experiments with information retrieval and neural techniques. We show that: (i) HEAD-QA challenges current methods, and (ii) the results lag well behind human performance, demonstrating its usefulness as a benchmark for future work.\",\n}\n", "homepage": "https://aghie.github.io/head-qa/", "license": "MIT License", "features": {"name": {"dtype": "string", "id": null, "_type": "Value"}, "year": {"dtype": "string", "id": null, "_type": "Value"}, "category": {"dtype": "string", "id": null, "_type": "Value"}, "qid": {"dtype": "int32", "id": null, "_type": "Value"}, "qtext": {"dtype": "string", "id": null, "_type": "Value"}, "ra": {"dtype": "int32", "id": null, "_type": "Value"}, "image": {"dtype": "string", "id": null, "_type": "Value"}, "answers": [{"aid": {"dtype": "int32", "id": null, "_type": "Value"}, "atext": {"dtype": "string", "id": null, "_type": "Value"}}]}, "post_processed": null, "supervised_keys": null, "builder_name": "head_qa", "config_name": "es", "version": {"version_str": "1.1.0", "description": null, "major": 1, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 1207986, "num_examples": 2657, "dataset_name": "head_qa"}, "test": {"name": "test", "num_bytes": 1182358, "num_examples": 2742, "dataset_name": "head_qa"}, "validation": {"name": "validation", "num_bytes": 563002, "num_examples": 1366, "dataset_name": "head_qa"}}, "download_checksums": {"https://drive.google.com/uc?export=download&id=1dUIqVwvoZAtbX_-z5axCoe97XNcFo1No": {"num_bytes": 1856679, "checksum": "6bb1cf3bbf8eccab2c5be33c2eb63896f1bd8c14c7a305a9449b254be3d0bfc5"}}, "download_size": 1856679, "post_processing_size": null, "dataset_size": 2953346, "size_in_bytes": 4810025}, "en": {"description": "HEAD-QA is a multi-choice HEAlthcare Dataset. The questions come from exams to access a specialized position in the\nSpanish healthcare system, and are challenging even for highly specialized humans. They are designed by the Ministerio\nde Sanidad, Consumo y Bienestar Social.\n\nThe dataset contains questions about the following topics: medicine, nursing, psychology, chemistry, pharmacology and biology.\n", "citation": "@inproceedings{vilares-gomez-rodriguez-2019-head,\n title = \"{HEAD}-{QA}: A Healthcare Dataset for Complex Reasoning\",\n author = \"Vilares, David and\n G{'o}mez-Rodr{'i}guez, Carlos\",\n booktitle = \"Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics\",\n month = jul,\n year = \"2019\",\n address = \"Florence, Italy\",\n publisher = \"Association for Computational Linguistics\",\n url = \"https://www.aclweb.org/anthology/P19-1092\",\n doi = \"10.18653/v1/P19-1092\",\n pages = \"960--966\",\n abstract = \"We present HEAD-QA, a multi-choice question answering testbed to encourage research on complex reasoning. The questions come from exams to access a specialized position in the Spanish healthcare system, and are challenging even for highly specialized humans. We then consider monolingual (Spanish) and cross-lingual (to English) experiments with information retrieval and neural techniques. We show that: (i) HEAD-QA challenges current methods, and (ii) the results lag well behind human performance, demonstrating its usefulness as a benchmark for future work.\",\n}\n", "homepage": "https://aghie.github.io/head-qa/", "license": "MIT License", "features": {"name": {"dtype": "string", "id": null, "_type": "Value"}, "year": {"dtype": "string", "id": null, "_type": "Value"}, "category": {"dtype": "string", "id": null, "_type": "Value"}, "qid": {"dtype": "int32", "id": null, "_type": "Value"}, "qtext": {"dtype": "string", "id": null, "_type": "Value"}, "ra": {"dtype": "int32", "id": null, "_type": "Value"}, "image": {"dtype": "string", "id": null, "_type": "Value"}, "answers": [{"aid": {"dtype": "int32", "id": null, "_type": "Value"}, "atext": {"dtype": "string", "id": null, "_type": "Value"}}]}, "post_processed": null, "supervised_keys": null, "builder_name": "head_qa", "config_name": "en", "version": {"version_str": "1.1.0", "description": null, "major": 1, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 1135116, "num_examples": 2657, "dataset_name": "head_qa"}, "test": {"name": "test", "num_bytes": 1109888, "num_examples": 2742, "dataset_name": "head_qa"}, "validation": {"name": "validation", "num_bytes": 529540, "num_examples": 1366, "dataset_name": "head_qa"}}, "download_checksums": {"https://drive.google.com/uc?export=download&id=1phryJg4FjCFkn0mSCqIOP2-FscAeKGV0": {"num_bytes": 1749836, "checksum": "21ca4e48930a3afe63d50d722b6b335ecb636e283489713ac3e8706db20ed92e"}}, "download_size": 1749836, "post_processing_size": null, "dataset_size": 2774544, "size_in_bytes": 4524380}}
dummy/en/1.1.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a4444c7ec54df2feb8264c0e3e0fd4423ff6a834e8557e261ae5845ff9df8ca6
3
+ size 2533
dummy/es/1.1.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e32d340330882f3487b3ff718464864cbefe9e987781976e6d502dadca039bc0
3
+ size 2533
head_qa.py ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ """HEAD-QA: A Healthcare Dataset for Complex Reasoning"""
16
+
17
+ from __future__ import absolute_import, division, print_function
18
+
19
+ import json
20
+ import os
21
+
22
+ import datasets
23
+
24
+
25
+ _CITATION = """\
26
+ @inproceedings{vilares-gomez-rodriguez-2019-head,
27
+ title = "{HEAD}-{QA}: A Healthcare Dataset for Complex Reasoning",
28
+ author = "Vilares, David and
29
+ G{\'o}mez-Rodr{\'i}guez, Carlos",
30
+ booktitle = "Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics",
31
+ month = jul,
32
+ year = "2019",
33
+ address = "Florence, Italy",
34
+ publisher = "Association for Computational Linguistics",
35
+ url = "https://www.aclweb.org/anthology/P19-1092",
36
+ doi = "10.18653/v1/P19-1092",
37
+ pages = "960--966",
38
+ abstract = "We present HEAD-QA, a multi-choice question answering testbed to encourage research on complex reasoning. The questions come from exams to access a specialized position in the Spanish healthcare system, and are challenging even for highly specialized humans. We then consider monolingual (Spanish) and cross-lingual (to English) experiments with information retrieval and neural techniques. We show that: (i) HEAD-QA challenges current methods, and (ii) the results lag well behind human performance, demonstrating its usefulness as a benchmark for future work.",
39
+ }
40
+ """
41
+
42
+ _DESCRIPTION = """\
43
+ HEAD-QA is a multi-choice HEAlthcare Dataset. The questions come from exams to access a specialized position in the
44
+ Spanish healthcare system, and are challenging even for highly specialized humans. They are designed by the Ministerio
45
+ de Sanidad, Consumo y Bienestar Social.
46
+
47
+ The dataset contains questions about the following topics: medicine, nursing, psychology, chemistry, pharmacology and biology.
48
+ """
49
+
50
+ _HOMEPAGE = "https://aghie.github.io/head-qa/"
51
+
52
+ _LICENSE = "MIT License"
53
+
54
+ _URLs = {
55
+ "es": "https://drive.google.com/uc?export=download&id=1dUIqVwvoZAtbX_-z5axCoe97XNcFo1No",
56
+ "en": "https://drive.google.com/uc?export=download&id=1phryJg4FjCFkn0mSCqIOP2-FscAeKGV0",
57
+ }
58
+
59
+ _DIRS = {"es": "HEAD", "en": "HEAD_EN"}
60
+
61
+
62
+ class HeadQA(datasets.GeneratorBasedBuilder):
63
+ """HEAD-QA: A Healthcare Dataset for Complex Reasoning"""
64
+
65
+ VERSION = datasets.Version("1.1.0")
66
+
67
+ BUILDER_CONFIGS = [
68
+ datasets.BuilderConfig(name="es", version=VERSION, description="Spanish HEAD dataset"),
69
+ datasets.BuilderConfig(name="en", version=VERSION, description="English HEAD dataset"),
70
+ ]
71
+
72
+ DEFAULT_CONFIG_NAME = "es"
73
+
74
+ def _info(self):
75
+ return datasets.DatasetInfo(
76
+ description=_DESCRIPTION,
77
+ features=datasets.Features(
78
+ {
79
+ "name": datasets.Value("string"),
80
+ "year": datasets.Value("string"),
81
+ "category": datasets.Value("string"),
82
+ "qid": datasets.Value("int32"),
83
+ "qtext": datasets.Value("string"),
84
+ "ra": datasets.Value("int32"),
85
+ "image": datasets.Value("string"),
86
+ "answers": [
87
+ {
88
+ "aid": datasets.Value("int32"),
89
+ "atext": datasets.Value("string"),
90
+ }
91
+ ],
92
+ }
93
+ ),
94
+ supervised_keys=None,
95
+ homepage=_HOMEPAGE,
96
+ license=_LICENSE,
97
+ citation=_CITATION,
98
+ )
99
+
100
+ def _split_generators(self, dl_manager):
101
+ """Returns SplitGenerators."""
102
+ data_dir = dl_manager.download_and_extract(_URLs[self.config.name])
103
+
104
+ dir = _DIRS[self.config.name]
105
+ data_dir = os.path.join(data_dir, dir)
106
+
107
+ return [
108
+ datasets.SplitGenerator(
109
+ name=datasets.Split.TRAIN, gen_kwargs={"filepath": os.path.join(data_dir, "train_{}.json".format(dir))}
110
+ ),
111
+ datasets.SplitGenerator(
112
+ name=datasets.Split.TEST, gen_kwargs={"filepath": os.path.join(data_dir, "test_{}.json".format(dir))}
113
+ ),
114
+ datasets.SplitGenerator(
115
+ name=datasets.Split.VALIDATION,
116
+ gen_kwargs={"filepath": os.path.join(data_dir, "dev_{}.json".format(dir))},
117
+ ),
118
+ ]
119
+
120
+ def _generate_examples(self, filepath):
121
+ """ Yields examples. """
122
+ with open(filepath, encoding="utf-8") as f:
123
+ head_qa = json.load(f)
124
+ for exam in head_qa["exams"]:
125
+ content = head_qa["exams"][exam]
126
+ name = content["name"].strip()
127
+ year = content["year"].strip()
128
+ category = content["category"].strip()
129
+ for question in content["data"]:
130
+ id_ = int(question["qid"].strip())
131
+ qtext = question["qtext"].strip()
132
+ ra = int(question["ra"].strip())
133
+ image = question["image"].strip()
134
+
135
+ aids = [answer["aid"] for answer in question["answers"]]
136
+ atexts = [answer["atext"].strip() for answer in question["answers"]]
137
+ answers = [{"aid": aid, "atext": atext} for aid, atext in zip(aids, atexts)]
138
+
139
+ yield id_, {
140
+ "name": name,
141
+ "year": year,
142
+ "category": category,
143
+ "qid": id_,
144
+ "qtext": qtext,
145
+ "ra": ra,
146
+ "image": image,
147
+ "answers": answers,
148
+ }