Update tydiqa-goldp.py
Browse files- tydiqa-goldp.py +8 -31
tydiqa-goldp.py
CHANGED
@@ -28,44 +28,21 @@ the use of translation (unlike MLQA and XQuAD).
|
|
28 |
|
29 |
_LANG = ["arabic", "bengali", "english", "finnish", "indonesian", "japanese", "korean", "russian", "swahili", "telugu", "thai"]
|
30 |
|
31 |
-
|
32 |
-
_Secondary_URLS = "https://huggingface.co/datasets/khalidalt/tydiqa-goldp/resolve/main/{split}/{language}-{split}.jsonl"
|
33 |
-
|
34 |
_VERSION = datasets.Version("1.1.0", "")
|
35 |
|
36 |
|
37 |
class tydiqa_GoldP(datasets.GeneratorBasedBuilder):
|
38 |
BUILDER_CONFIGS = [
|
39 |
-
|
40 |
-
name=
|
41 |
-
description=
|
42 |
-
|
43 |
-
Passage selection task (SelectP): Given a list of the passages in the article, return either (a) the index of
|
44 |
-
the passage that answers the question or (b) NULL if no such passage exists.
|
45 |
-
Minimal answer span task (MinSpan): Given the full text of an article, return one of (a) the start and end
|
46 |
-
byte indices of the minimal span that completely answers the question; (b) YES or NO if the question requires
|
47 |
-
a yes/no answer and we can draw a conclusion from the passage; (c) NULL if it is not possible to produce a
|
48 |
-
minimal answer for this question."""
|
49 |
-
),
|
50 |
-
),
|
51 |
-
TydiqaConfig(
|
52 |
-
name="secondary_task",
|
53 |
-
description=textwrap.dedent(
|
54 |
-
"""Gold passage task (GoldP): Given a passage that is guaranteed to contain the
|
55 |
-
answer, predict the single contiguous span of characters that answers the question. This is more similar to
|
56 |
-
existing reading comprehension datasets (as opposed to the information-seeking task outlined above).
|
57 |
-
This task is constructed with two goals in mind: (1) more directly comparing with prior work and (2) providing
|
58 |
-
a simplified way for researchers to use TyDi QA by providing compatibility with existing code for SQuAD 1.1,
|
59 |
-
XQuAD, and MLQA. Toward these goals, the gold passage task differs from the primary task in several ways:
|
60 |
-
only the gold answer passage is provided rather than the entire Wikipedia article;
|
61 |
-
unanswerable questions have been discarded, similar to MLQA and XQuAD;
|
62 |
-
we evaluate with the SQuAD 1.1 metrics like XQuAD; and
|
63 |
-
Thai and Japanese are removed since the lack of whitespace breaks some tools.
|
64 |
-
"""
|
65 |
-
),
|
66 |
)
|
67 |
for lang in _LANG
|
68 |
]
|
|
|
|
|
69 |
def _info(self):
|
70 |
# TODO(tydiqa): Specifies the datasets.DatasetInfo object
|
71 |
|
@@ -108,7 +85,7 @@ class tydiqa_GoldP(datasets.GeneratorBasedBuilder):
|
|
108 |
splits = {datasets.Split.TRAIN: "train", datasets.Split.VALIDATION: "dev"}
|
109 |
|
110 |
data_urls = {
|
111 |
-
split:
|
112 |
}
|
113 |
|
114 |
dl_paths = dl_manager.download(data_urls)
|
|
|
28 |
|
29 |
_LANG = ["arabic", "bengali", "english", "finnish", "indonesian", "japanese", "korean", "russian", "swahili", "telugu", "thai"]
|
30 |
|
31 |
+
_URL = "https://huggingface.co/datasets/khalidalt/tydiqa-goldp/resolve/main/{split}/{language}-{split}.jsonl"
|
|
|
|
|
32 |
_VERSION = datasets.Version("1.1.0", "")
|
33 |
|
34 |
|
35 |
class tydiqa_GoldP(datasets.GeneratorBasedBuilder):
|
36 |
BUILDER_CONFIGS = [
|
37 |
+
datasets.BuilderConfig(
|
38 |
+
name=lang,
|
39 |
+
description=f"tydiqa-GoldP language {lang}",
|
40 |
+
version=_VERSION,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
)
|
42 |
for lang in _LANG
|
43 |
]
|
44 |
+
|
45 |
+
|
46 |
def _info(self):
|
47 |
# TODO(tydiqa): Specifies the datasets.DatasetInfo object
|
48 |
|
|
|
85 |
splits = {datasets.Split.TRAIN: "train", datasets.Split.VALIDATION: "dev"}
|
86 |
|
87 |
data_urls = {
|
88 |
+
split: _URL.format(language=language, split=splits[split]) for split in splits
|
89 |
}
|
90 |
|
91 |
dl_paths = dl_manager.download(data_urls)
|