jiangshan382 eraldoluis commited on
Commit
455eb9d
·
0 Parent(s):

Duplicate from eraldoluis/faquad

Browse files

Co-authored-by: Eraldo R. Fernandes <eraldoluis@users.noreply.huggingface.co>

Files changed (3) hide show
  1. .gitattributes +51 -0
  2. README.md +176 -0
  3. faquad.py +149 -0
.gitattributes ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ftz filter=lfs diff=lfs merge=lfs -text
6
+ *.gz filter=lfs diff=lfs merge=lfs -text
7
+ *.h5 filter=lfs diff=lfs merge=lfs -text
8
+ *.joblib filter=lfs diff=lfs merge=lfs -text
9
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
10
+ *.lz4 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
+ *.npy filter=lfs diff=lfs merge=lfs -text
14
+ *.npz filter=lfs diff=lfs merge=lfs -text
15
+ *.onnx filter=lfs diff=lfs merge=lfs -text
16
+ *.ot filter=lfs diff=lfs merge=lfs -text
17
+ *.parquet filter=lfs diff=lfs merge=lfs -text
18
+ *.pb filter=lfs diff=lfs merge=lfs -text
19
+ *.pickle filter=lfs diff=lfs merge=lfs -text
20
+ *.pkl filter=lfs diff=lfs merge=lfs -text
21
+ *.pt filter=lfs diff=lfs merge=lfs -text
22
+ *.pth filter=lfs diff=lfs merge=lfs -text
23
+ *.rar filter=lfs diff=lfs merge=lfs -text
24
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
25
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
26
+ *.tflite filter=lfs diff=lfs merge=lfs -text
27
+ *.tgz filter=lfs diff=lfs merge=lfs -text
28
+ *.wasm filter=lfs diff=lfs merge=lfs -text
29
+ *.xz filter=lfs diff=lfs merge=lfs -text
30
+ *.zip filter=lfs diff=lfs merge=lfs -text
31
+ *.zst filter=lfs diff=lfs merge=lfs -text
32
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
33
+ # Audio files - uncompressed
34
+ *.pcm filter=lfs diff=lfs merge=lfs -text
35
+ *.sam filter=lfs diff=lfs merge=lfs -text
36
+ *.raw filter=lfs diff=lfs merge=lfs -text
37
+ # Audio files - compressed
38
+ *.aac filter=lfs diff=lfs merge=lfs -text
39
+ *.flac filter=lfs diff=lfs merge=lfs -text
40
+ *.mp3 filter=lfs diff=lfs merge=lfs -text
41
+ *.ogg filter=lfs diff=lfs merge=lfs -text
42
+ *.wav filter=lfs diff=lfs merge=lfs -text
43
+ # Image files - uncompressed
44
+ *.bmp filter=lfs diff=lfs merge=lfs -text
45
+ *.gif filter=lfs diff=lfs merge=lfs -text
46
+ *.png filter=lfs diff=lfs merge=lfs -text
47
+ *.tiff filter=lfs diff=lfs merge=lfs -text
48
+ # Image files - compressed
49
+ *.jpg filter=lfs diff=lfs merge=lfs -text
50
+ *.jpeg filter=lfs diff=lfs merge=lfs -text
51
+ *.webp filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ pretty_name: FaQuAD
3
+ annotations_creators:
4
+ - expert-generated
5
+ language_creators:
6
+ - found
7
+ language:
8
+ - pt
9
+ license:
10
+ - cc-by-4.0
11
+ multilinguality:
12
+ - monolingual
13
+ size_categories:
14
+ - n<1K
15
+ source_datasets:
16
+ - extended|wikipedia
17
+ task_categories:
18
+ - question-answering
19
+ task_ids:
20
+ - extractive-qa
21
+ # paperswithcode_id: faquad
22
+ train-eval-index:
23
+ - config: plain_text
24
+ task: question-answering
25
+ task_id: extractive_question_answering
26
+ splits:
27
+ train_split: train
28
+ eval_split: validation
29
+ col_mapping:
30
+ question: question
31
+ context: context
32
+ answers:
33
+ text: text
34
+ answer_start: answer_start
35
+ metrics:
36
+ - type: squad
37
+ name: SQuAD
38
+ ---
39
+
40
+ # Dataset Card for FaQuAD
41
+
42
+ ## Table of Contents
43
+ - [Table of Contents](#table-of-contents)
44
+ - [Dataset Description](#dataset-description)
45
+ - [Dataset Summary](#dataset-summary)
46
+ - [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
47
+ - [Languages](#languages)
48
+ - [Dataset Structure](#dataset-structure)
49
+ - [Data Instances](#data-instances)
50
+ - [Data Fields](#data-fields)
51
+ - [Data Splits](#data-splits)
52
+ - [Dataset Creation](#dataset-creation)
53
+ - [Curation Rationale](#curation-rationale)
54
+ - [Source Data](#source-data)
55
+ - [Annotations](#annotations)
56
+ - [Personal and Sensitive Information](#personal-and-sensitive-information)
57
+ - [Considerations for Using the Data](#considerations-for-using-the-data)
58
+ - [Social Impact of Dataset](#social-impact-of-dataset)
59
+ - [Discussion of Biases](#discussion-of-biases)
60
+ - [Other Known Limitations](#other-known-limitations)
61
+ - [Additional Information](#additional-information)
62
+ - [Dataset Curators](#dataset-curators)
63
+ - [Licensing Information](#licensing-information)
64
+ - [Citation Information](#citation-information)
65
+ - [Contributions](#contributions)
66
+
67
+ ## Dataset Description
68
+
69
+ - **Homepage:** https://github.com/liafacom/faquad
70
+ - **Repository:** https://github.com/liafacom/faquad
71
+ - **Paper:** https://ieeexplore.ieee.org/document/8923668/
72
+ <!-- - **Leaderboard:** -->
73
+ - **Point of Contact:** Eraldo R. Fernandes <eraldoluis@gmail.com>
74
+
75
+ ### Dataset Summary
76
+
77
+ Academic secretaries and faculty members of higher education institutions face a common problem:
78
+ the abundance of questions sent by academics
79
+ whose answers are found in available institutional documents.
80
+ The official documents produced by Brazilian public universities are vast and disperse,
81
+ which discourage students to further search for answers in such sources.
82
+ In order to lessen this problem, we present FaQuAD:
83
+ a novel machine reading comprehension dataset
84
+ in the domain of Brazilian higher education institutions.
85
+ FaQuAD follows the format of SQuAD (Stanford Question Answering Dataset) [Rajpurkar et al. 2016].
86
+ It comprises 900 questions about 249 reading passages (paragraphs),
87
+ which were taken from 18 official documents of a computer science college
88
+ from a Brazilian federal university
89
+ and 21 Wikipedia articles related to Brazilian higher education system.
90
+ As far as we know, this is the first Portuguese reading comprehension dataset in this format.
91
+
92
+ ### Supported Tasks and Leaderboards
93
+
94
+ [More Information Needed]
95
+
96
+ ### Languages
97
+
98
+ [More Information Needed]
99
+
100
+ ## Dataset Structure
101
+
102
+ ### Data Instances
103
+
104
+ [More Information Needed]
105
+
106
+ ### Data Fields
107
+
108
+ | name |train|validation|
109
+ |---------|----:|----:|
110
+ |faquad|837|63|
111
+
112
+ ### Data Splits
113
+
114
+ [More Information Needed]
115
+
116
+ ## Dataset Creation
117
+
118
+ ### Curation Rationale
119
+
120
+ [More Information Needed]
121
+
122
+ ### Source Data
123
+
124
+ #### Initial Data Collection and Normalization
125
+
126
+ [More Information Needed]
127
+
128
+ #### Who are the source language producers?
129
+
130
+ [More Information Needed]
131
+
132
+ ### Annotations
133
+
134
+ #### Annotation process
135
+
136
+ [More Information Needed]
137
+
138
+ #### Who are the annotators?
139
+
140
+ [More Information Needed]
141
+
142
+ ### Personal and Sensitive Information
143
+
144
+ [More Information Needed]
145
+
146
+ ## Considerations for Using the Data
147
+
148
+ ### Social Impact of Dataset
149
+
150
+ [More Information Needed]
151
+
152
+ ### Discussion of Biases
153
+
154
+ [More Information Needed]
155
+
156
+ ### Other Known Limitations
157
+
158
+ [More Information Needed]
159
+
160
+ ## Additional Information
161
+
162
+ ### Dataset Curators
163
+
164
+ [More Information Needed]
165
+
166
+ ### Licensing Information
167
+
168
+ [More Information Needed]
169
+
170
+ ### Citation Information
171
+
172
+ [More Information Needed]
173
+
174
+ ### Contributions
175
+
176
+ Thanks to [@github-username](https://github.com/<github-username>) for adding this dataset.
faquad.py ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2020 The TensorFlow Datasets Authors and the HuggingFace Datasets Authors.
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
+ #
16
+ # Adapted from the SQuAD script.
17
+ #
18
+
19
+ # Lint as: python3
20
+ """FaQuAD: Reading Comprehension Dataset in the Domain of Brazilian Higher Education."""
21
+
22
+
23
+ import json
24
+
25
+ import datasets
26
+
27
+
28
+ logger = datasets.logging.get_logger(__name__)
29
+
30
+
31
+ _CITATION = """\
32
+ @INPROCEEDINGS{
33
+ 8923668,
34
+ author={Sayama, Hélio Fonseca and Araujo, Anderson Viçoso and Fernandes, Eraldo Rezende},
35
+ booktitle={2019 8th Brazilian Conference on Intelligent Systems (BRACIS)},
36
+ title={FaQuAD: Reading Comprehension Dataset in the Domain of Brazilian Higher Education},
37
+ year={2019},
38
+ volume={},
39
+ number={},
40
+ pages={443-448},
41
+ doi={10.1109/BRACIS.2019.00084}
42
+ }
43
+ """
44
+
45
+ _DESCRIPTION = """\
46
+ Academic secretaries and faculty members of higher education institutions face a common problem:
47
+ the abundance of questions sent by academics
48
+ whose answers are found in available institutional documents.
49
+ The official documents produced by Brazilian public universities are vast and disperse,
50
+ which discourage students to further search for answers in such sources.
51
+ In order to lessen this problem, we present FaQuAD:
52
+ a novel machine reading comprehension dataset
53
+ in the domain of Brazilian higher education institutions.
54
+ FaQuAD follows the format of SQuAD (Stanford Question Answering Dataset) [Rajpurkar et al. 2016].
55
+ It comprises 900 questions about 249 reading passages (paragraphs),
56
+ which were taken from 18 official documents of a computer science college
57
+ from a Brazilian federal university
58
+ and 21 Wikipedia articles related to Brazilian higher education system.
59
+ As far as we know, this is the first Portuguese reading comprehension dataset in this format.
60
+ """
61
+
62
+ _URL = "https://raw.githubusercontent.com/liafacom/faquad/master/data/"
63
+ _URLS = {
64
+ "train": _URL + "train.json",
65
+ "dev": _URL + "dev.json",
66
+ }
67
+
68
+
69
+ class FaquadConfig(datasets.BuilderConfig):
70
+ """BuilderConfig for FaQuAD."""
71
+
72
+ def __init__(self, **kwargs):
73
+ """BuilderConfig for FaQuAD.
74
+
75
+ Args:
76
+ **kwargs: keyword arguments forwarded to super.
77
+ """
78
+ super(FaquadConfig, self).__init__(**kwargs)
79
+
80
+
81
+ class Faquad(datasets.GeneratorBasedBuilder):
82
+ """FaQuAD: Reading Comprehension Dataset in the Domain of Brazilian Higher Education. Version 1.0."""
83
+
84
+ BUILDER_CONFIGS = [
85
+ FaquadConfig(
86
+ name="plain_text",
87
+ version=datasets.Version("1.0.0", ""),
88
+ description="Plain text",
89
+ ),
90
+ ]
91
+
92
+ def _info(self):
93
+ return datasets.DatasetInfo(
94
+ description=_DESCRIPTION,
95
+ features=datasets.Features(
96
+ {
97
+ "id": datasets.Value("string"),
98
+ "title": datasets.Value("string"),
99
+ "context": datasets.Value("string"),
100
+ "question": datasets.Value("string"),
101
+ "answers": datasets.features.Sequence(
102
+ {
103
+ "text": datasets.Value("string"),
104
+ "answer_start": datasets.Value("int32"),
105
+ }
106
+ ),
107
+ }
108
+ ),
109
+ # No default supervised_keys (as we have to pass both question
110
+ # and context as input).
111
+ supervised_keys=None,
112
+ homepage="https://github.com/liafacom/faquad",
113
+ citation=_CITATION,
114
+ )
115
+
116
+ def _split_generators(self, dl_manager):
117
+ downloaded_files = dl_manager.download_and_extract(_URLS)
118
+
119
+ return [
120
+ datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_files["train"]}),
121
+ datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": downloaded_files["dev"]}),
122
+ ]
123
+
124
+ def _generate_examples(self, filepath):
125
+ """This function returns the examples in the raw (text) form."""
126
+ logger.info("generating examples from = %s", filepath)
127
+ key = 0
128
+ with open(filepath, encoding="utf-8") as f:
129
+ faquad = json.load(f)
130
+ for article in faquad["data"]:
131
+ title = article.get("title", "")
132
+ for paragraph in article["paragraphs"]:
133
+ context = paragraph["context"] # do not strip leading blank spaces GH-2585
134
+ for qa in paragraph["qas"]:
135
+ answer_starts = [answer["answer_start"] for answer in qa["answers"]]
136
+ answers = [answer["text"] for answer in qa["answers"]]
137
+ # Features currently used are "context", "question", and "answers".
138
+ # Others are extracted here for the ease of future expansions.
139
+ yield key, {
140
+ "title": title,
141
+ "context": context,
142
+ "question": qa["question"],
143
+ "id": qa["id"],
144
+ "answers": {
145
+ "answer_start": answer_starts,
146
+ "text": answers,
147
+ },
148
+ }
149
+ key += 1