Datasets:
ToluClassics
commited on
Commit
·
bbcd3c1
1
Parent(s):
20a75c8
modify file to enable different splits per language
Browse files- afriqa-gold-passages.py +26 -6
afriqa-gold-passages.py
CHANGED
@@ -29,11 +29,23 @@ _LANG_2_PIVOT = {
|
|
29 |
"kin": "en",
|
30 |
"swa": "en",
|
31 |
"twi": "en",
|
32 |
-
"wol": "fr",
|
33 |
"yor": "en",
|
34 |
"zul": "en",
|
35 |
}
|
36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
class AfriQAConfig(datasets.BuilderConfig):
|
38 |
"""BuilderConfig for AfriQA"""
|
39 |
|
@@ -90,11 +102,19 @@ class AfriQA(datasets.GeneratorBasedBuilder):
|
|
90 |
}
|
91 |
downloaded_files = dl_manager.download_and_extract(urls_to_download)
|
92 |
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
|
99 |
def _generate_examples(self, filepath):
|
100 |
"""Yields examples."""
|
|
|
29 |
"kin": "en",
|
30 |
"swa": "en",
|
31 |
"twi": "en",
|
|
|
32 |
"yor": "en",
|
33 |
"zul": "en",
|
34 |
}
|
35 |
|
36 |
+
_LANG_2_SPLITS = {
|
37 |
+
"bem": ["train", "dev", "test"],
|
38 |
+
"fon": ["train", "dev", "test"],
|
39 |
+
"hau": ["train", "dev", "test"],
|
40 |
+
"ibo": ["train", "dev", "test"],
|
41 |
+
"kin": ["train", "dev", "test"],
|
42 |
+
"swa": ["test"],
|
43 |
+
"twi": ["train", "dev", "test"],
|
44 |
+
"yor": ["train", "test"],
|
45 |
+
"zul": ["train", "dev", "test"],
|
46 |
+
|
47 |
+
}
|
48 |
+
|
49 |
class AfriQAConfig(datasets.BuilderConfig):
|
50 |
"""BuilderConfig for AfriQA"""
|
51 |
|
|
|
102 |
}
|
103 |
downloaded_files = dl_manager.download_and_extract(urls_to_download)
|
104 |
|
105 |
+
splits_list = []
|
106 |
+
|
107 |
+
for split in _LANG_2_SPLITS[self.config.name]:
|
108 |
+
|
109 |
+
if split == "train":
|
110 |
+
splits_list.append(datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_files["train"]}))
|
111 |
+
elif split == "dev":
|
112 |
+
splits_list.append(datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": downloaded_files["dev"]}))
|
113 |
+
elif split == "test":
|
114 |
+
splits_list.append(datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": downloaded_files["test"]}))
|
115 |
+
|
116 |
+
|
117 |
+
return splits_list
|
118 |
|
119 |
def _generate_examples(self, filepath):
|
120 |
"""Yields examples."""
|