Salama1429 commited on
Commit
c426a81
·
1 Parent(s): 975521e

Upload 3 files

Browse files
Files changed (3) hide show
  1. README.md +209 -35
  2. dataset_infos.json +1 -0
  3. quranqa.py +136 -0
README.md CHANGED
@@ -1,38 +1,212 @@
1
  ---
2
- dataset_info:
3
- features:
4
- - name: pq_id
5
- dtype: string
6
- - name: passage
7
- dtype: string
8
- - name: surah
9
- dtype: int8
10
- - name: verses
11
- dtype: string
12
- - name: question
13
- dtype: string
14
- - name: answers
15
- sequence:
16
- - name: text
17
- dtype: string
18
- - name: answer_start
19
- dtype: int32
20
- splits:
21
- - name: train
22
- num_bytes: 692719
23
- num_examples: 710
24
- - name: validation
25
- num_bytes: 107785
26
- num_examples: 109
27
- - name: test
28
- num_bytes: 216975
29
- num_examples: 238
30
- - name: test_noAnswers
31
- num_bytes: 227799
32
- num_examples: 274
33
- download_size: 486968
34
- dataset_size: 1245278
35
  ---
36
- # Dataset Card for "tarteel-ai-QuranQA"
37
 
38
- [More Information needed](https://github.com/huggingface/datasets/blob/main/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ annotations_creators:
3
+ - expert-generated
4
+ language:
5
+ - ar
6
+ language_creators:
7
+ - expert-generated
8
+ license:
9
+ - cc-by-nd-4.0
10
+ multilinguality:
11
+ - monolingual
12
+ pretty_name: Qur'anic Reading Comprehension Dataset
13
+ size_categories:
14
+ - n<1K
15
+ - 1K<n<10K
16
+ source_datasets:
17
+ - original
18
+ tags:
19
+ - quran
20
+ - qa
21
+ task_categories:
22
+ - question-answering
23
+ task_ids:
24
+ - extractive-qa
 
 
 
 
 
 
 
 
 
 
25
  ---
 
26
 
27
+ # Dataset Card for the Qur'anic Reading Comprehension Dataset (QRCD)
28
+
29
+ ## Table of Contents
30
+ - [Table of Contents](#table-of-contents)
31
+ - [Dataset Description](#dataset-description)
32
+ - [Dataset Summary](#dataset-summary)
33
+ - [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
34
+ - [Languages](#languages)
35
+ - [Dataset Structure](#dataset-structure)
36
+ - [Data Instances](#data-instances)
37
+ - [Data Fields](#data-fields)
38
+ - [Data Splits](#data-splits)
39
+ - [Dataset Creation](#dataset-creation)
40
+ - [Curation Rationale](#curation-rationale)
41
+ - [Source Data](#source-data)
42
+ - [Annotations](#annotations)
43
+ - [Personal and Sensitive Information](#personal-and-sensitive-information)
44
+ - [Considerations for Using the Data](#considerations-for-using-the-data)
45
+ - [Social Impact of Dataset](#social-impact-of-dataset)
46
+ - [Discussion of Biases](#discussion-of-biases)
47
+ - [Other Known Limitations](#other-known-limitations)
48
+ - [Additional Information](#additional-information)
49
+ - [Dataset Curators](#dataset-curators)
50
+ - [Licensing Information](#licensing-information)
51
+ - [Citation Information](#citation-information)
52
+ - [Contributions](#contributions)
53
+
54
+ ## Dataset Description
55
+
56
+ - **Homepage:** https://sites.google.com/view/quran-qa-2022/home
57
+ - **Repository:** https://gitlab.com/bigirqu/quranqa/-/tree/main/
58
+ - **Paper:** https://dl.acm.org/doi/10.1145/3400396
59
+ - **Leaderboard:**
60
+ - **Point of Contact:** @piraka9011
61
+
62
+ ### Dataset Summary
63
+
64
+ The QRCD (Qur'anic Reading Comprehension Dataset) is composed of 1,093 tuples of question-passage pairs that are
65
+ coupled with their extracted answers to constitute 1,337 question-passage-answer triplets.
66
+
67
+ ### Supported Tasks and Leaderboards
68
+
69
+ This task is evaluated as a ranking task.
70
+ To give credit to a QA system that may retrieve an answer (not necessarily at the first rank) that does not fully
71
+ match one of the gold answers but partially matches it, we use partial Reciprocal Rank (pRR) measure.
72
+ It is a variant of the traditional Reciprocal Rank evaluation metric that considers partial matching.
73
+ pRR is the official evaluation measure of this shared task.
74
+ We will also report Exact Match (EM) and F1@1, which are evaluation metrics applied only on the top predicted answer.
75
+ The EM metric is a binary measure that rewards a system only if the top predicted answer exactly matches one of the
76
+ gold answers.
77
+ Whereas, the F1@1 metric measures the token overlap between the top predicted answer and the best matching gold answer.
78
+ To get an overall evaluation score, each of the above measures is averaged over all questions.
79
+
80
+ ### Languages
81
+
82
+ Qur'anic Arabic
83
+
84
+ ## Dataset Structure
85
+
86
+ ### Data Instances
87
+
88
+ To simplify the structure of the dataset, each tuple contains one passage, one question and a list that may contain
89
+ one or more answers to that question, as shown below:
90
+
91
+ ```json
92
+ {
93
+ "pq_id": "38:41-44_105",
94
+ "passage": "واذكر عبدنا أيوب إذ نادى ربه أني مسني الشيطان بنصب وعذاب. اركض برجلك هذا مغتسل بارد وشراب. ووهبنا له أهله ومثلهم معهم رحمة منا وذكرى لأولي الألباب. وخذ بيدك ضغثا فاضرب به ولا تحنث إنا وجدناه صابرا نعم العبد إنه أواب.",
95
+ "surah": 38,
96
+ "verses": "41-44",
97
+ "question": "من هو النبي المعروف بالصبر؟",
98
+ "answers": [
99
+ {
100
+ "text": "أيوب",
101
+ "start_char": 12
102
+ }
103
+ ]
104
+ }
105
+ ```
106
+
107
+ Each Qur’anic passage in QRCD may have more than one occurrence; and each passage occurrence is paired with a different
108
+ question.
109
+ Likewise, each question in QRCD may have more than one occurrence; and each question occurrence is paired with a
110
+ different Qur’anic passage.
111
+ The source of the Qur'anic text in QRCD is the Tanzil project download page, which provides verified versions of the
112
+ Holy Qur'an in several scripting styles.
113
+ We have chosen the simple-clean text style of Tanzil version 1.0.2.
114
+
115
+ ### Data Fields
116
+
117
+ * `pq_id`: Sample ID
118
+ * `passage`: Context text
119
+ * `surah`: Surah number
120
+ * `verses`: Verse range
121
+ * `question`: Question text
122
+ * `answers`: List of answers and their start character
123
+
124
+ ### Data Splits
125
+
126
+ | **Dataset** | **%** | **# Question-Passage Pairs** | **# Question-Passage-Answer Triplets** |
127
+ |-------------|:-----:|:-----------------------------:|:---------------------------------------:|
128
+ | Training | 65% | 710 | 861 |
129
+ | Development | 10% | 109 | 128 |
130
+ | Test | 25% | 274 | 348 |
131
+ | All | 100% | 1,093 | 1,337 |
132
+
133
+ ## Dataset Creation
134
+
135
+ ### Curation Rationale
136
+
137
+ [More Information Needed]
138
+
139
+ ### Source Data
140
+
141
+ #### Initial Data Collection and Normalization
142
+
143
+ [More Information Needed]
144
+
145
+ #### Who are the source language producers?
146
+
147
+ [More Information Needed]
148
+
149
+ ### Annotations
150
+
151
+ #### Annotation process
152
+
153
+ [More Information Needed]
154
+
155
+ #### Who are the annotators?
156
+
157
+ [More Information Needed]
158
+
159
+ ### Personal and Sensitive Information
160
+
161
+ [More Information Needed]
162
+
163
+ ## Considerations for Using the Data
164
+
165
+ ### Social Impact of Dataset
166
+
167
+ [More Information Needed]
168
+
169
+ ### Discussion of Biases
170
+
171
+ [More Information Needed]
172
+
173
+ ### Other Known Limitations
174
+
175
+ [More Information Needed]
176
+
177
+ ## Additional Information
178
+
179
+ ### Dataset Curators
180
+
181
+ [More Information Needed]
182
+
183
+ ### Licensing Information
184
+
185
+ The QRCD v1.1 dataset is distributed under the CC-BY-ND 4.0 License https://creativecommons.org/licenses/by-nd/4.0/legalcode
186
+ For a human-readable summary of (and not a substitute for) the above CC-BY-ND 4.0 License, please refer to https://creativecommons.org/licenses/by-nd/4.0/
187
+
188
+ ### Citation Information
189
+
190
+ ```
191
+ @article{malhas2020ayatec,
192
+ author = {Malhas, Rana and Elsayed, Tamer},
193
+ title = {AyaTEC: Building a Reusable Verse-Based Test Collection for Arabic Question Answering on the Holy Qur’an},
194
+ year = {2020},
195
+ issue_date = {November 2020},
196
+ publisher = {Association for Computing Machinery},
197
+ address = {New York, NY, USA},
198
+ volume = {19},
199
+ number = {6},
200
+ issn = {2375-4699},
201
+ url = {https://doi.org/10.1145/3400396},
202
+ doi = {10.1145/3400396},
203
+ journal = {ACM Trans. Asian Low-Resour. Lang. Inf. Process.},
204
+ month = {oct},
205
+ articleno = {78},
206
+ numpages = {21},
207
+ keywords = {evaluation, Classical Arabic}
208
+ }
209
+ ```
210
+ ### Contributions
211
+
212
+ Thanks to [@piraka9011](https://github.com/piraka9011) for adding this dataset.
dataset_infos.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"shared_task": {"description": "The absence of publicly available reusable test collections for Arabic question answering on the Holy Qur\u2019an has impeded the possibility of fairly comparing the performance of systems in that domain. In this article, we introduce AyaTEC, a reusable test collection for verse-based question answering on the Holy Qur\u2019an, which serves as a common experimental testbed for this task. AyaTEC includes 207 questions (with their corresponding 1,762 answers) covering 11 topic categories of the Holy Qur\u2019an that target the information needs of both curious and skeptical users. To the best of our effort, the answers to the questions (each represented as a sequence of verses) in AyaTEC were exhaustive\u2014that is, all qur\u2019anic verses that directly answered the questions were exhaustively extracted and annotated. To facilitate the use of AyaTEC in evaluating the systems designed for that task, we propose several evaluation measures to support the different types of questions and the nature of verse-based answers while integrating the concept of partial matching of answers in the evaluation.\n", "citation": "@article{malhas2020ayatec,\n author = {Malhas, Rana and Elsayed, Tamer},\n title = {AyaTEC: Building a Reusable Verse-Based Test Collection for Arabic Question Answering on the Holy Qur\u2019an},\n year = {2020},\n issue_date = {November 2020},\n publisher = {Association for Computing Machinery},\n address = {New York, NY, USA},\n volume = {19},\n number = {6},\n issn = {2375-4699},\n url = {https://doi.org/10.1145/3400396},\n doi = {10.1145/3400396},\n journal = {ACM Trans. Asian Low-Resour. Lang. Inf. Process.},\n month = {oct},\n articleno = {78},\n numpages = {21},\n keywords = {evaluation, Classical Arabic}\n}\n", "homepage": "https://sites.google.com/view/quran-qa-2022/home", "license": "CC-BY-ND 4.0", "features": {"pq_id": {"dtype": "string", "id": null, "_type": "Value"}, "passage": {"dtype": "string", "id": null, "_type": "Value"}, "surah": {"dtype": "int8", "id": null, "_type": "Value"}, "verses": {"dtype": "string", "id": null, "_type": "Value"}, "question": {"dtype": "string", "id": null, "_type": "Value"}, "answers": {"feature": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "start_char": {"dtype": "int32", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "task_templates": [{"task": "question-answering-extractive", "question_column": "question", "context_column": "passage", "answers_column": "answers"}], "builder_name": "quranqa", "config_name": "shared_task", "version": {"version_str": "1.1.0", "description": null, "major": 1, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 692719, "num_examples": 710, "dataset_name": "quranqa"}, "validation": {"name": "validation", "num_bytes": 107785, "num_examples": 109, "dataset_name": "quranqa"}, "test": {"name": "test", "num_bytes": 216975, "num_examples": 238, "dataset_name": "quranqa"}, "test_noAnswers": {"name": "test_noAnswers", "num_bytes": 227799, "num_examples": 274, "dataset_name": "quranqa"}}, "download_checksums": {"https://gitlab.com/bigirqu/quranqa/-/raw/main/datasets/qrcd_v1.1_train.jsonl": {"num_bytes": 756171, "checksum": "3e867fb2c999cdb2bbbbbd5fd1f9f11141106993256bb991b07a524c3e63be83"}, "https://gitlab.com/bigirqu/quranqa/-/raw/main/datasets/qrcd_v1.1_dev.jsonl": {"num_bytes": 117412, "checksum": "20709f850d9eb42e94ffba7190607f43ced485057c73df705a20fd0a71a34dcd"}, "https://gitlab.com/bigirqu/quranqa/-/raw/main/datasets/qrcd_v1.1_test_gold.jsonl": {"num_bytes": 238439, "checksum": "c84cda2227d2f90fb25c91fc6a0611b26b4d02ba6d2c07b7b86f86be90846049"}, "https://gitlab.com/bigirqu/quranqa/-/raw/main/datasets/qrcd_v1.1_test_noAnswers.jsonl": {"num_bytes": 244683, "checksum": "f461e9eee7281edf411566c6322a62f7722ef153fe59d4ee269c783c4ae70e87"}}, "download_size": 1356705, "post_processing_size": null, "dataset_size": 1245278, "size_in_bytes": 2601983}}
quranqa.py ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+
3
+ import datasets
4
+ from datasets.tasks import QuestionAnsweringExtractive
5
+
6
+
7
+ _CITATION = """\
8
+ @article{malhas2020ayatec,
9
+ author = {Malhas, Rana and Elsayed, Tamer},
10
+ title = {AyaTEC: Building a Reusable Verse-Based Test Collection for Arabic Question Answering on the Holy Qur’an},
11
+ year = {2020},
12
+ issue_date = {November 2020},
13
+ publisher = {Association for Computing Machinery},
14
+ address = {New York, NY, USA},
15
+ volume = {19},
16
+ number = {6},
17
+ issn = {2375-4699},
18
+ url = {https://doi.org/10.1145/3400396},
19
+ doi = {10.1145/3400396},
20
+ journal = {ACM Trans. Asian Low-Resour. Lang. Inf. Process.},
21
+ month = {oct},
22
+ articleno = {78},
23
+ numpages = {21},
24
+ keywords = {evaluation, Classical Arabic}
25
+ }
26
+ """
27
+
28
+ _DESCRIPTION = """\
29
+ The absence of publicly available reusable test collections for Arabic question answering on the Holy Qur’an has \
30
+ impeded the possibility of fairly comparing the performance of systems in that domain. In this article, we introduce \
31
+ AyaTEC, a reusable test collection for verse-based question answering on the Holy Qur’an, which serves as a common \
32
+ experimental testbed for this task. AyaTEC includes 207 questions (with their corresponding 1,762 answers) covering 11 \
33
+ topic categories of the Holy Qur’an that target the information needs of both curious and skeptical users. To the best \
34
+ of our effort, the answers to the questions (each represented as a sequence of verses) in AyaTEC were exhaustive—that \
35
+ is, all qur’anic verses that directly answered the questions were exhaustively extracted and annotated. To facilitate \
36
+ the use of AyaTEC in evaluating the systems designed for that task, we propose several evaluation measures to support \
37
+ the different types of questions and the nature of verse-based answers while integrating the concept of partial \
38
+ matching of answers in the evaluation.
39
+ """
40
+
41
+ _HOMEPAGE = "https://sites.google.com/view/quran-qa-2022/home"
42
+
43
+ _LICENSE = "CC-BY-ND 4.0"
44
+
45
+ _URL = "https://gitlab.com/bigirqu/quranqa/-/raw/main/datasets/"
46
+ _URLS = {
47
+ "train": _URL + "qrcd_v1.1_train.jsonl",
48
+ "dev": _URL + "qrcd_v1.1_dev.jsonl",
49
+ "test": _URL + "qrcd_v1.1_test_gold.jsonl",
50
+ "test_noAnswers": _URL + "qrcd_v1.1_test_noAnswers.jsonl",
51
+ }
52
+
53
+
54
+ class QuranQAConfig(datasets.BuilderConfig):
55
+ """BuilderConfig for QuranQA."""
56
+
57
+ def __init__(self, **kwargs):
58
+ """BuilderConfig for QuranQA.
59
+ Args:
60
+ **kwargs: keyword arguments forwarded to super.
61
+ """
62
+ super(QuranQAConfig, self).__init__(**kwargs)
63
+
64
+
65
+ class QuranQA(datasets.GeneratorBasedBuilder):
66
+ """QuranQA: Qur'anic Reading Comprehension Dataset. Version 1.1.0"""
67
+
68
+ VERSION = datasets.Version("1.1.0")
69
+
70
+ BUILDER_CONFIGS = [
71
+ QuranQAConfig(name="shared_task", version=VERSION, description="Shared task (LREC 2022)"),
72
+ ]
73
+
74
+ def _info(self):
75
+ return datasets.DatasetInfo(
76
+ description=_DESCRIPTION,
77
+ features=datasets.Features(
78
+ {
79
+ "pq_id": datasets.Value("string"),
80
+ "passage": datasets.Value("string"),
81
+ "surah": datasets.Value("int8"),
82
+ "verses": datasets.Value("string"),
83
+ "question": datasets.Value("string"),
84
+ "answers": datasets.features.Sequence(
85
+ {
86
+ "text": datasets.Value("string"),
87
+ "answer_start": datasets.Value("int32"), # Originally start_char
88
+ }
89
+ ),
90
+ }
91
+ ),
92
+ homepage=_HOMEPAGE,
93
+ license=_LICENSE,
94
+ citation=_CITATION,
95
+ task_templates=[
96
+ QuestionAnsweringExtractive(
97
+ question_column="question", context_column="passage", answers_column="answers"
98
+ )
99
+ ],
100
+ )
101
+
102
+ def _split_generators(self, dl_manager):
103
+ downloaded_files = dl_manager.download(_URLS)
104
+
105
+ return [
106
+ datasets.SplitGenerator(
107
+ name=datasets.Split.TRAIN,
108
+ gen_kwargs={"filepath": downloaded_files["train"]},
109
+ ),
110
+ datasets.SplitGenerator(
111
+ name=datasets.Split.VALIDATION,
112
+ gen_kwargs={"filepath": downloaded_files["dev"]},
113
+ ),
114
+ datasets.SplitGenerator(
115
+ name=datasets.Split.TEST,
116
+ gen_kwargs={"filepath": downloaded_files["test"]},
117
+ ),
118
+ datasets.SplitGenerator(
119
+ name="test_noAnswers",
120
+ gen_kwargs={"filepath": downloaded_files["test_noAnswers"]},
121
+ ),
122
+ ]
123
+
124
+ def _generate_examples(self, filepath):
125
+ key = 0
126
+ with open(filepath, encoding="utf-8") as f:
127
+ samples = f.readlines()
128
+ samples = [json.loads(s) for s in samples]
129
+ for sample in samples:
130
+ # Remap key names to match HF convention
131
+ sample["answers"] = {
132
+ "text": [answer["text"] for answer in sample["answers"]],
133
+ "answer_start": [answer["start_char"] for answer in sample["answers"]]
134
+ }
135
+ yield key, sample
136
+ key += 1