Datasets:
Commit
•
9341178
0
Parent(s):
Update files from the datasets library (from 1.2.0)
Browse filesRelease notes: https://github.com/huggingface/datasets/releases/tag/1.2.0
- .gitattributes +27 -0
- README.md +177 -0
- dataset_infos.json +1 -0
- dummy/xor-full/1.0.0/dummy_data.zip +3 -0
- dummy/xor-retrieve/1.0.0/dummy_data.zip +3 -0
- xor_tydi_qa.py +129 -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,177 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
annotations_creators:
|
3 |
+
- crowdsourced
|
4 |
+
language_creators:
|
5 |
+
- expert-generated
|
6 |
+
- found
|
7 |
+
languages:
|
8 |
+
- ar
|
9 |
+
- bn
|
10 |
+
- fi
|
11 |
+
- ja
|
12 |
+
- ko
|
13 |
+
- ru
|
14 |
+
- te
|
15 |
+
licenses:
|
16 |
+
- mit
|
17 |
+
multilinguality:
|
18 |
+
- multilingual
|
19 |
+
size_categories:
|
20 |
+
- 10K<n<100K
|
21 |
+
source_datasets:
|
22 |
+
- original
|
23 |
+
- extended|tydiqa
|
24 |
+
task_categories:
|
25 |
+
- question-answering
|
26 |
+
task_ids:
|
27 |
+
- open-domain-qa
|
28 |
+
---
|
29 |
+
|
30 |
+
# Dataset Card for XOR QA
|
31 |
+
|
32 |
+
## Table of Contents
|
33 |
+
- [Dataset Description](#dataset-description)
|
34 |
+
- [Dataset Summary](#dataset-summary)
|
35 |
+
- [Supported Tasks](#supported-tasks-and-leaderboards)
|
36 |
+
- [Languages](#languages)
|
37 |
+
- [Dataset Structure](#dataset-structure)
|
38 |
+
- [Data Instances](#data-instances)
|
39 |
+
- [Data Fields](#data-instances)
|
40 |
+
- [Data Splits](#data-instances)
|
41 |
+
- [Dataset Creation](#dataset-creation)
|
42 |
+
- [Curation Rationale](#curation-rationale)
|
43 |
+
- [Source Data](#source-data)
|
44 |
+
- [Annotations](#annotations)
|
45 |
+
- [Personal and Sensitive Information](#personal-and-sensitive-information)
|
46 |
+
- [Considerations for Using the Data](#considerations-for-using-the-data)
|
47 |
+
- [Social Impact of Dataset](#social-impact-of-dataset)
|
48 |
+
- [Discussion of Biases](#discussion-of-biases)
|
49 |
+
- [Other Known Limitations](#other-known-limitations)
|
50 |
+
- [Additional Information](#additional-information)
|
51 |
+
- [Dataset Curators](#dataset-curators)
|
52 |
+
- [Licensing Information](#licensing-information)
|
53 |
+
- [Citation Information](#citation-information)
|
54 |
+
|
55 |
+
## Dataset Description
|
56 |
+
|
57 |
+
- **Homepage:** [XOR QA Homepage](https://nlp.cs.washington.edu/xorqa/)
|
58 |
+
- **Repository:** [XOR QA Repository](https://github.com/AkariAsai/XORQA)
|
59 |
+
- **Paper:** [XOR QA Paper](https://arxiv.org/abs/2010.11856)
|
60 |
+
- **Leaderboard:** [XOR QA Leaderboard](https://nlp.cs.washington.edu/xorqa/)
|
61 |
+
- **Point of Contact:** [Akari Asai](akari@cs.washington.edu)
|
62 |
+
|
63 |
+
### Dataset Summary
|
64 |
+
|
65 |
+
XOR-TyDi QA brings together for the first time information-seeking questions, open-retrieval QA, and multilingual QA to create a multilingual open-retrieval QA dataset that enables cross-lingual answer retrieval. It consists of questions written by information-seeking native speakers in 7 typologically diverse languages and answer annotations that are retrieved from multilingual document collections.
|
66 |
+
|
67 |
+
### Supported Tasks and Leaderboards
|
68 |
+
|
69 |
+
There are three sub-tasks: XOR-Retrieve, XOR-EnglishSpan, and XOR-Full.
|
70 |
+
|
71 |
+
- `XOR-retrieve`: XOR-Retrieve is a cross-lingual retrieval task where a question is written in a target language (e.g., Japanese) and a system is required to retrieve English paragraphs that answer the question. The dataset can be used to train a model for cross-lingual retrieval. Success on this task is typically measured by R@5kt, R@2kt (the recall by computing the fraction of the questions for which the minimal answer is contained in the top 5,000 / 2,000 tokens selected). This task has an active leaderboard which can be found at [leaderboard url](https://nlp.cs.washington.edu/xorqa/)
|
72 |
+
|
73 |
+
- `XOR-English Span`: XOR-English Span is a cross-lingual retrieval task where a question is written in a target language (e.g., Japanese) and a system is required to output a short answer in English. The dataset can be used to train a model for cross-lingual retrieval. Success on this task is typically measured by F1, EM. This task has an active leaderboard which can be found at [leaderboard url](https://nlp.cs.washington.edu/xorqa/)
|
74 |
+
|
75 |
+
- `XOR-Full`: XOR-Full is a cross-lingual retrieval task where a question is written in the target language (e.g., Japanese) and a system is required to output a short answer in a target language. Success on this task is typically measured by F1, EM, BLEU This task has an active leaderboard which can be found at [leaderboard url](https://nlp.cs.washington.edu/xorqa/)
|
76 |
+
### Languages
|
77 |
+
|
78 |
+
The text in the dataset is available in 7 languages: Arabic `ar`, Bengali `bn`, Finnish `fi`, Japanese `ja`, Korean `ko`, Russian `ru`, Telugu `te`
|
79 |
+
|
80 |
+
## Dataset Structure
|
81 |
+
|
82 |
+
### Data Instances
|
83 |
+
|
84 |
+
A typical data point comprises a `question`, it's `answer` the `language` of the question text and the split to which it belongs.
|
85 |
+
|
86 |
+
```
|
87 |
+
{
|
88 |
+
"id": "-3979399588609321314",
|
89 |
+
"question": "Сколько детей было у Наполео́на I Бонапа́рта?",
|
90 |
+
"answers": ["сын"],
|
91 |
+
"lang": "ru",
|
92 |
+
"split": "train"
|
93 |
+
}
|
94 |
+
```
|
95 |
+
|
96 |
+
### Data Fields
|
97 |
+
|
98 |
+
- `id`: An identifier for each example in the dataset
|
99 |
+
- `question`: Open domain question
|
100 |
+
- `answers`: The corresponding answer to the question posed
|
101 |
+
- `lang`: BCP-47 language tag
|
102 |
+
- `split`: identifier to differentiate train, validation and test splits
|
103 |
+
|
104 |
+
### Data Splits
|
105 |
+
|
106 |
+
The data is split into a training, validation and test set for each of the two configurations.
|
107 |
+
|
108 |
+
| | Tain | Valid | Test |
|
109 |
+
| ----- | ------ | ----- | ---- |
|
110 |
+
| XOR Retrieve | 15250| 2113| 2501|
|
111 |
+
| XOR Full | 61360| 3179| 8177|
|
112 |
+
|
113 |
+
## Dataset Creation
|
114 |
+
|
115 |
+
### Curation Rationale
|
116 |
+
|
117 |
+
This task framework reflects well real-world scenarios where a QA system uses multilingual document collections and answers questions asked by users with diverse linguistic and cultural backgrounds. Despite the common assumption that we can find answers in the target language, web re- sources in non-English languages are largely lim- ited compared to English (information scarcity), or the contents are biased towards their own cul- tures (information asymmetry). To solve these issues, XOR-TYDI QA (Asai et al., 2020) provides a benchmark for developing a multilingual QA system that finds answers in multiple languages.
|
118 |
+
|
119 |
+
### Source Data
|
120 |
+
|
121 |
+
annotation pipeline consists of four steps: 1) collection of realistic questions that require cross-lingual ref- erences by annotating questions from TYDI QA without a same-language answer; 2) question translation from a target language to the pivot language of English where the missing informa- tion may exist; 3) answer span selection in the pivot language given a set of candidate documents; 4) answer verification and translation from the pivot language back to the original language.
|
122 |
+
|
123 |
+
#### Initial Data Collection and Normalization
|
124 |
+
|
125 |
+
[More Information Needed]
|
126 |
+
|
127 |
+
#### Who are the source language producers?
|
128 |
+
|
129 |
+
The Dataset is created by extending TyDiQA dataset and translating the questions into other languages. The answers are obtained by crowdsourcing the questions to Mechanical Turk workders
|
130 |
+
|
131 |
+
### Annotations
|
132 |
+
|
133 |
+
#### Annotation process
|
134 |
+
|
135 |
+
The English questions from TyDiQA are translated into other languages. The languages are chosen based on the availability of wikipedia data and the availability of tranlators.
|
136 |
+
|
137 |
+
#### Who are the annotators?
|
138 |
+
|
139 |
+
The translations are carried out using the professionla tranlation service (Gengo)[https://gengo.com] and the answers are annotated by MechanicalTurk workers
|
140 |
+
|
141 |
+
### Personal and Sensitive Information
|
142 |
+
|
143 |
+
The dataset is created from wikipedia content and the QA task requires preserving the named entities, there by all the Wikipedia Named Entities are preserved in the data. Not much information has been provided about masking sensitive information.
|
144 |
+
|
145 |
+
## Considerations for Using the Data
|
146 |
+
|
147 |
+
### Social Impact of Dataset
|
148 |
+
|
149 |
+
[More Information Needed]
|
150 |
+
|
151 |
+
### Discussion of Biases
|
152 |
+
|
153 |
+
[More Information Needed]
|
154 |
+
|
155 |
+
### Other Known Limitations
|
156 |
+
|
157 |
+
[More Information Needed]
|
158 |
+
|
159 |
+
## Additional Information
|
160 |
+
|
161 |
+
### Dataset Curators
|
162 |
+
|
163 |
+
The people associated with the creation of the dataset are Akari Asai, Jungo Kasai, Jonathan H. Clark, Kenton Lee, Eunsol Choi, Hannaneh Hajishirzi
|
164 |
+
|
165 |
+
### Licensing Information
|
166 |
+
|
167 |
+
XOR-TyDi QA is distributed under the [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/legalcode) license
|
168 |
+
|
169 |
+
### Citation Information
|
170 |
+
|
171 |
+
```
|
172 |
+
@article{xorqa,
|
173 |
+
title = {XOR QA: Cross-lingual Open-Retrieval Question Answering},
|
174 |
+
author = {Akari Asai and Jungo Kasai and Jonathan H. Clark and Kenton Lee and Eunsol Choi and Hannaneh Hajishirzi}
|
175 |
+
year = {2020}
|
176 |
+
}
|
177 |
+
```
|
dataset_infos.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"xor-retrieve": {"description": " XOR-TyDi QA brings together for the first time information-seeking questions,\n open-retrieval QA, and multilingual QA to create a multilingual open-retrieval\n QA dataset that enables cross-lingual answer retrieval. It consists of questions\n written by information-seeking native speakers in 7 typologically diverse languages\n and answer annotations that are retrieved from multilingual document collections.\n There are three sub-tasks: XOR-Retrieve, XOR-EnglishSpan, and XOR-Full.\n\nXOR-Retrieve is a cross-lingual retrieval task where a question is written in the target\nlanguage (e.g., Japanese) and a system is required to retrieve English document that answers the question.\n", "citation": " @misc{asai2020xor,\n title={XOR QA: Cross-lingual Open-Retrieval Question Answering}, \n author={Akari Asai and Jungo Kasai and Jonathan H. Clark and Kenton Lee and Eunsol Choi and Hannaneh Hajishirzi},\n year={2020},\n eprint={2010.11856},\n archivePrefix={arXiv},\n primaryClass={cs.CL}\n}\n", "homepage": "https://nlp.cs.washington.edu/xorqa/", "license": "", "features": {"question": {"dtype": "string", "id": null, "_type": "Value"}, "lang": {"num_classes": 7, "names": ["ar", "bn", "fi", "ja", "ko", "ru", "te"], "names_file": null, "id": null, "_type": "ClassLabel"}, "answers": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "builder_name": "xor_ty_di", "config_name": "xor-retrieve", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 1698662, "num_examples": 15250, "dataset_name": "xor_ty_di"}, "validation": {"name": "validation", "num_bytes": 259887, "num_examples": 2113, "dataset_name": "xor_ty_di"}, "test": {"name": "test", "num_bytes": 219284, "num_examples": 2501, "dataset_name": "xor_ty_di"}}, "download_checksums": {"https://nlp.cs.washington.edu/xorqa/XORQA_site/data/xor_train_retrieve_eng_span.jsonl": {"num_bytes": 2912848, "checksum": "f0c8202eebcef9fc129c9bb8e7a12fae1a7648163b249dc0a06df4318923f70b"}, "https://nlp.cs.washington.edu/xorqa/XORQA_site/data/xor_dev_retrieve_eng_span.jsonl": {"num_bytes": 427653, "checksum": "4e6118cd647fd90c7c810dd3041d9c2f0ee1e3816a6a09a0568c93e23f0c938d"}, "https://nlp.cs.washington.edu/xorqa/XORQA_site/data/xor_test_retrieve_eng_span_q_only.jsonl": {"num_bytes": 362804, "checksum": "7aaa11939a3c08c113c61c7e6fe663018cb6ad46f516bc8aba1f0bc378a28624"}}, "download_size": 3703305, "post_processing_size": null, "dataset_size": 2177833, "size_in_bytes": 5881138}, "xor-full": {"description": " XOR-TyDi QA brings together for the first time information-seeking questions,\n open-retrieval QA, and multilingual QA to create a multilingual open-retrieval\n QA dataset that enables cross-lingual answer retrieval. It consists of questions\n written by information-seeking native speakers in 7 typologically diverse languages\n and answer annotations that are retrieved from multilingual document collections.\n There are three sub-tasks: XOR-Retrieve, XOR-EnglishSpan, and XOR-Full.\n\nXOR-Full is a cross-lingual retrieval task where a question is written in the target\nlanguage (e.g., Japanese) and a system is required to output a short answer in the target language.", "citation": " @misc{asai2020xor,\n title={XOR QA: Cross-lingual Open-Retrieval Question Answering}, \n author={Akari Asai and Jungo Kasai and Jonathan H. Clark and Kenton Lee and Eunsol Choi and Hannaneh Hajishirzi},\n year={2020},\n eprint={2010.11856},\n archivePrefix={arXiv},\n primaryClass={cs.CL}\n}\n", "homepage": "https://nlp.cs.washington.edu/xorqa/", "license": "", "features": {"question": {"dtype": "string", "id": null, "_type": "Value"}, "lang": {"num_classes": 7, "names": ["ar", "bn", "fi", "ja", "ko", "ru", "te"], "names_file": null, "id": null, "_type": "ClassLabel"}, "answers": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "builder_name": "xor_ty_di", "config_name": "xor-full", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 7250913, "num_examples": 61360, "dataset_name": "xor_ty_di"}, "validation": {"name": "validation", "num_bytes": 394531, "num_examples": 3179, "dataset_name": "xor_ty_di"}, "test": {"name": "test", "num_bytes": 706832, "num_examples": 8177, "dataset_name": "xor_ty_di"}}, "download_checksums": {"https://nlp.cs.washington.edu/xorqa/XORQA_site/data/xor_train_full.jsonl": {"num_bytes": 12126903, "checksum": "7bb3b97f0ff57a39df21289102cc4e278406074c460310f4a22ff50ed578f315"}, "https://nlp.cs.washington.edu/xorqa/XORQA_site/data/xor_dev_full.jsonl": {"num_bytes": 640875, "checksum": "eb53a0ce73c5c7b7d76a99aa8a3548f01ff7788f8a969c27390f1a3938689185"}, "https://nlp.cs.washington.edu/xorqa/XORQA_site/data/xor_test_full_q_only.jsonl": {"num_bytes": 1176124, "checksum": "eac4ecb847b16037c6410c5bbcf64c10be3500d64082eef532852a98c5593cbf"}}, "download_size": 13943902, "post_processing_size": null, "dataset_size": 8352276, "size_in_bytes": 22296178}}
|
dummy/xor-full/1.0.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1762159ab4505274f4c3adeaf68dec8d7a33d454f40844ef568827011f603992
|
3 |
+
size 1916
|
dummy/xor-retrieve/1.0.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f94513b29daf0623f3f5dd81e5c597faaaf3b9e2951d9efcc48ddf6ee775e2ac
|
3 |
+
size 2000
|
xor_tydi_qa.py
ADDED
@@ -0,0 +1,129 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""XOR QA: Cross-lingual Open-Retrieval Question Answering"""
|
2 |
+
|
3 |
+
from __future__ import absolute_import, division, print_function
|
4 |
+
|
5 |
+
import json
|
6 |
+
import textwrap
|
7 |
+
|
8 |
+
import datasets
|
9 |
+
|
10 |
+
|
11 |
+
_XOR_TYDI_QA_CITATION = """\
|
12 |
+
@misc{asai2020xor,
|
13 |
+
title={XOR QA: Cross-lingual Open-Retrieval Question Answering},
|
14 |
+
author={Akari Asai and Jungo Kasai and Jonathan H. Clark and Kenton Lee and Eunsol Choi and Hannaneh Hajishirzi},
|
15 |
+
year={2020},
|
16 |
+
eprint={2010.11856},
|
17 |
+
archivePrefix={arXiv},
|
18 |
+
primaryClass={cs.CL}
|
19 |
+
}
|
20 |
+
"""
|
21 |
+
|
22 |
+
_XOR_TYDI_QA_DESCRIPTION = """\
|
23 |
+
XOR-TyDi QA brings together for the first time information-seeking questions,
|
24 |
+
open-retrieval QA, and multilingual QA to create a multilingual open-retrieval
|
25 |
+
QA dataset that enables cross-lingual answer retrieval. It consists of questions
|
26 |
+
written by information-seeking native speakers in 7 typologically diverse languages
|
27 |
+
and answer annotations that are retrieved from multilingual document collections.
|
28 |
+
There are three sub-tasks: XOR-Retrieve, XOR-EnglishSpan, and XOR-Full.
|
29 |
+
"""
|
30 |
+
|
31 |
+
_DESCRIPTIONS = {
|
32 |
+
"xor-retrieve": textwrap.dedent(
|
33 |
+
"""\
|
34 |
+
XOR-Retrieve is a cross-lingual retrieval task where a question is written in the target
|
35 |
+
language (e.g., Japanese) and a system is required to retrieve English document that answers the question.
|
36 |
+
"""
|
37 |
+
),
|
38 |
+
"xor-full": textwrap.dedent(
|
39 |
+
"""\
|
40 |
+
XOR-Full is a cross-lingual retrieval task where a question is written in the target
|
41 |
+
language (e.g., Japanese) and a system is required to output a short answer in the target language."""
|
42 |
+
),
|
43 |
+
}
|
44 |
+
|
45 |
+
_DATA_URLS = {
|
46 |
+
"xor-retrieve": {
|
47 |
+
"train": "https://nlp.cs.washington.edu/xorqa/XORQA_site/data/xor_train_retrieve_eng_span.jsonl",
|
48 |
+
"dev": "https://nlp.cs.washington.edu/xorqa/XORQA_site/data/xor_dev_retrieve_eng_span.jsonl",
|
49 |
+
"test": "https://nlp.cs.washington.edu/xorqa/XORQA_site/data/xor_test_retrieve_eng_span_q_only.jsonl",
|
50 |
+
},
|
51 |
+
"xor-full": {
|
52 |
+
"train": "https://nlp.cs.washington.edu/xorqa/XORQA_site/data/xor_train_full.jsonl",
|
53 |
+
"dev": "https://nlp.cs.washington.edu/xorqa/XORQA_site/data/xor_dev_full.jsonl",
|
54 |
+
"test": "https://nlp.cs.washington.edu/xorqa/XORQA_site/data/xor_test_full_q_only.jsonl",
|
55 |
+
},
|
56 |
+
}
|
57 |
+
|
58 |
+
_XOR_TYDI_QA_URL = "https://nlp.cs.washington.edu/xorqa/"
|
59 |
+
|
60 |
+
|
61 |
+
class XORTyDiConfig(datasets.BuilderConfig):
|
62 |
+
"BuilderConfig for XOR-TyDi Dataset"
|
63 |
+
|
64 |
+
def __init__(self, data_url, citation, url, **kwargs):
|
65 |
+
"""
|
66 |
+
Args:
|
67 |
+
|
68 |
+
data_url: `dictionary`, dict with url for each split of data.
|
69 |
+
citation: `string`, citation for the dataset.
|
70 |
+
url: `string`, url for information about the dataset.
|
71 |
+
**kwargs: keyword arguments forwarded to super.
|
72 |
+
"""
|
73 |
+
super(XORTyDiConfig, self).__init__(version=datasets.Version("1.0.0", ""), **kwargs)
|
74 |
+
self.data_url = data_url
|
75 |
+
self.citation = citation
|
76 |
+
self.url = url
|
77 |
+
|
78 |
+
|
79 |
+
class XORTyDi(datasets.GeneratorBasedBuilder):
|
80 |
+
|
81 |
+
BUILDER_CONFIGS = [
|
82 |
+
XORTyDiConfig(
|
83 |
+
name=name,
|
84 |
+
description=_DESCRIPTIONS[name],
|
85 |
+
data_url=_DATA_URLS[name],
|
86 |
+
citation=_XOR_TYDI_QA_CITATION,
|
87 |
+
url=_XOR_TYDI_QA_URL,
|
88 |
+
)
|
89 |
+
for name in ["xor-retrieve", "xor-full"]
|
90 |
+
]
|
91 |
+
|
92 |
+
def _info(self):
|
93 |
+
features = {}
|
94 |
+
features["question"] = datasets.Value("string")
|
95 |
+
features["lang"] = datasets.features.ClassLabel(names=["ar", "bn", "fi", "ja", "ko", "ru", "te"])
|
96 |
+
features["answers"] = datasets.Value("string")
|
97 |
+
|
98 |
+
return datasets.DatasetInfo(
|
99 |
+
description=_XOR_TYDI_QA_DESCRIPTION + "\n" + self.config.description,
|
100 |
+
features=datasets.Features(features),
|
101 |
+
homepage=self.config.url,
|
102 |
+
citation=_XOR_TYDI_QA_CITATION,
|
103 |
+
)
|
104 |
+
|
105 |
+
def _split_generators(self, dl_manager):
|
106 |
+
train = dl_manager.download_and_extract(self.config.data_url["train"])
|
107 |
+
dev = dl_manager.download_and_extract(self.config.data_url["dev"])
|
108 |
+
test = dl_manager.download_and_extract(self.config.data_url["test"])
|
109 |
+
|
110 |
+
return [
|
111 |
+
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": train, "split": "train"}),
|
112 |
+
datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": dev, "split": "dev"}),
|
113 |
+
datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": test, "split": "test"}),
|
114 |
+
]
|
115 |
+
|
116 |
+
def _generate_examples(self, filepath, split):
|
117 |
+
with open(filepath, encoding="utf-8") as f:
|
118 |
+
jlines = f.read()
|
119 |
+
result = [json.loads(jline) for jline in jlines.splitlines()]
|
120 |
+
if split == "test":
|
121 |
+
for id_, row in enumerate(result):
|
122 |
+
yield id_, {"question": row["question"], "answers": "None", "lang": row["lang"].strip()}
|
123 |
+
else:
|
124 |
+
for id_, row in enumerate(result):
|
125 |
+
yield id_, {
|
126 |
+
"question": row["question"],
|
127 |
+
"answers": " ".join(row["answers"]),
|
128 |
+
"lang": row["lang"].strip(),
|
129 |
+
}
|