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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""madlad-400 dataset"""
|
2 |
+
|
3 |
+
|
4 |
+
import gzip
|
5 |
+
import json
|
6 |
+
|
7 |
+
import datasets
|
8 |
+
|
9 |
+
|
10 |
+
logger = datasets.logging.get_logger(__name__)
|
11 |
+
|
12 |
+
|
13 |
+
_DESCRIPTION = """\
|
14 |
+
|
15 |
+
"""
|
16 |
+
|
17 |
+
_CITATION = """
|
18 |
+
|
19 |
+
"""
|
20 |
+
|
21 |
+
# _URL = "https://github.com/allenai/allennlp/discussions/5056"
|
22 |
+
|
23 |
+
_DATA_URL = "https://huggingface.co/datasets/drschwenk/MADLAD-400/resolve/ecd71297d60c1eb996cd3d7c44c60ad5b55adfc6/data/{language}/{language}_{split}_{index:04d}.jsonl.gz"
|
24 |
+
|
25 |
+
|
26 |
+
|
27 |
+
|
28 |
+
_N_SHARDS_PER_SPLIT = {
|
29 |
+
'abt': {'clean': 1, 'noisy': 1},
|
30 |
+
'ace': {'clean': 1, 'noisy': 1},
|
31 |
+
'acf': {'clean': 1, 'noisy': 1},
|
32 |
+
'ach': {'clean': 1, 'noisy': 1},
|
33 |
+
'ada': {'clean': 1, 'noisy': 1},
|
34 |
+
'adh': {'clean': 1, 'noisy': 1},
|
35 |
+
'ady': {'clean': 1, 'noisy': 1},
|
36 |
+
'af': {'clean': 1, 'noisy': 2},
|
37 |
+
'agr': {'clean': 1, 'noisy': 1},
|
38 |
+
'ahk': {'clean': 1, 'noisy': 1},
|
39 |
+
'ak': {'clean': 1, 'noisy': 1},
|
40 |
+
'akb': {'clean': 1, 'noisy': 1},
|
41 |
+
'alt': {'clean': 1, 'noisy': 1},
|
42 |
+
'alz': {'clean': 1, 'noisy': 1},
|
43 |
+
'am': {'clean': 1, 'noisy': 1},
|
44 |
+
'amu': {'clean': 1, 'noisy': 1},
|
45 |
+
'ang': {'clean': 1, 'noisy': 1},
|
46 |
+
'ann': {'clean': 1, 'noisy': 1},
|
47 |
+
'ape': {'clean': 1, 'noisy': 1},
|
48 |
+
'ar': {'clean': 8, 'noisy': 44},
|
49 |
+
'arn': {'clean': 1, 'noisy': 1},
|
50 |
+
'as': {'clean': 1, 'noisy': 1},
|
51 |
+
'av': {'clean': 1, 'noisy': 1},
|
52 |
+
'awa': {'clean': 1, 'noisy': 1},
|
53 |
+
'ay': {'clean': 1, 'noisy': 1},
|
54 |
+
'az': {'clean': 2, 'noisy': 3},
|
55 |
+
'az_RU': {'clean': 1, 'noisy': 1},
|
56 |
+
'ba': {'clean': 1, 'noisy': 1},
|
57 |
+
'ban': {'clean': 1, 'noisy': 1},
|
58 |
+
'bas': {'clean': 1, 'noisy': 1},
|
59 |
+
'bbc': {'clean': 1, 'noisy': 1},
|
60 |
+
'bci': {'clean': 1, 'noisy': 1},
|
61 |
+
'be': {'clean': 1, 'noisy': 2},
|
62 |
+
'ber': {'clean': 1, 'noisy': 1},
|
63 |
+
'ber_Latn': {'clean': 1, 'noisy': 1},
|
64 |
+
'bew': {'clean': 1, 'noisy': 1},
|
65 |
+
'bg': {'clean': 10, 'noisy': 16},
|
66 |
+
'bg_Latn': {'clean': 1, 'noisy': 1},
|
67 |
+
'bgp': {'clean': 1, 'noisy': 1},
|
68 |
+
'bho': {'clean': 1, 'noisy': 1},
|
69 |
+
'bi': {'clean': 1, 'noisy': 1},
|
70 |
+
'bik': {'clean': 1, 'noisy': 1},
|
71 |
+
'bim': {'clean': 1, 'noisy': 1},
|
72 |
+
'bm': {'clean': 1, 'noisy': 1},
|
73 |
+
'bn': {'clean': 1, 'noisy': 4},
|
74 |
+
'bn_Latn': {'clean': 1, 'noisy': 1},
|
75 |
+
'bo': {'clean': 1, 'noisy': 1},
|
76 |
+
'bqc': {'clean': 1, 'noisy': 1},
|
77 |
+
'br': {'clean': 1, 'noisy': 1},
|
78 |
+
'bru': {'clean': 1, 'noisy': 1},
|
79 |
+
'brx': {'clean': 1, 'noisy': 1},
|
80 |
+
'bs': {'clean': 1, 'noisy': 6},
|
81 |
+
'bts': {'clean': 1, 'noisy': 1},
|
82 |
+
'btx': {'clean': 1, 'noisy': 1},
|
83 |
+
'bua': {'clean': 1, 'noisy': 1},
|
84 |
+
'bum': {'clean': 1, 'noisy': 1},
|
85 |
+
'bus': {'clean': 1, 'noisy': 1},
|
86 |
+
'bzj': {'clean': 1, 'noisy': 1},
|
87 |
+
'ca': {'clean': 5, 'noisy': 8},
|
88 |
+
'cab': {'clean': 1, 'noisy': 1},
|
89 |
+
'cac': {'clean': 1, 'noisy': 1},
|
90 |
+
'cak': {'clean': 1, 'noisy': 1},
|
91 |
+
'cbk': {'clean': 1, 'noisy': 1},
|
92 |
+
'cce': {'clean': 1, 'noisy': 1},
|
93 |
+
'ce': {'clean': 1, 'noisy': 1},
|
94 |
+
'ceb': {'clean': 1, 'noisy': 1},
|
95 |
+
'cfm': {'clean': 1, 'noisy': 1},
|
96 |
+
'ch': {'clean': 1, 'noisy': 1},
|
97 |
+
'chk': {'clean': 1, 'noisy': 1},
|
98 |
+
'chm': {'clean': 1, 'noisy': 1},
|
99 |
+
'chr': {'clean': 1, 'noisy': 1},
|
100 |
+
'ckb': {'clean': 1, 'noisy': 1},
|
101 |
+
'cnh': {'clean': 1, 'noisy': 1},
|
102 |
+
'co': {'clean': 1, 'noisy': 1},
|
103 |
+
'cr_Latn': {'clean': 1, 'noisy': 1},
|
104 |
+
'crh': {'clean': 1, 'noisy': 1},
|
105 |
+
'crs': {'clean': 1, 'noisy': 1},
|
106 |
+
'cs': {'clean': 23, 'noisy': 44},
|
107 |
+
'ctd_Latn': {'clean': 1, 'noisy': 1},
|
108 |
+
'ctu': {'clean': 1, 'noisy': 1},
|
109 |
+
'cuk': {'clean': 1, 'noisy': 1},
|
110 |
+
'cv': {'clean': 1, 'noisy': 1},
|
111 |
+
'cy': {'clean': 1, 'noisy': 4},
|
112 |
+
'da': {'clean': 11, 'noisy': 36},
|
113 |
+
'de': {'clean': 133, 'noisy': 293},
|
114 |
+
'din': {'clean': 1, 'noisy': 1},
|
115 |
+
'dje': {'clean': 1, 'noisy': 1},
|
116 |
+
'djk': {'clean': 1, 'noisy': 1},
|
117 |
+
'dln': {'clean': 1, 'noisy': 1},
|
118 |
+
'doi': {'clean': 1, 'noisy': 1},
|
119 |
+
'dov': {'clean': 1, 'noisy': 1},
|
120 |
+
'dtp': {'clean': 1, 'noisy': 1},
|
121 |
+
'dv': {'clean': 1, 'noisy': 1},
|
122 |
+
'dwr': {'clean': 1, 'noisy': 1},
|
123 |
+
'dyu': {'clean': 1, 'noisy': 1},
|
124 |
+
'dz': {'clean': 1, 'noisy': 1},
|
125 |
+
'ee': {'clean': 1, 'noisy': 1},
|
126 |
+
'el': {'clean': 14, 'noisy': 29},
|
127 |
+
'el_Latn': {'clean': 1, 'noisy': 1},
|
128 |
+
'emp': {'clean': 1, 'noisy': 1},
|
129 |
+
'en': {'clean': 947, 'noisy': 1555},
|
130 |
+
'enq': {'clean': 1, 'noisy': 1},
|
131 |
+
'eo': {'clean': 1, 'noisy': 1},
|
132 |
+
'es': {'clean': 137, 'noisy': 269},
|
133 |
+
'et': {'clean': 4, 'noisy': 6},
|
134 |
+
'eu': {'clean': 1, 'noisy': 1},
|
135 |
+
'fa': {'clean': 16, 'noisy': 35},
|
136 |
+
'ff': {'clean': 1, 'noisy': 1},
|
137 |
+
'ffm': {'clean': 1, 'noisy': 1},
|
138 |
+
'fi': {'clean': 14, 'noisy': 27},
|
139 |
+
'fil': {'clean': 1, 'noisy': 2},
|
140 |
+
'fip': {'clean': 1, 'noisy': 1},
|
141 |
+
'fj': {'clean': 1, 'noisy': 1},
|
142 |
+
'fo': {'clean': 1, 'noisy': 1},
|
143 |
+
'fon': {'clean': 1, 'noisy': 1},
|
144 |
+
'fr': {'clean': 133, 'noisy': 251},
|
145 |
+
'frp': {'clean': 1, 'noisy': 1},
|
146 |
+
'fy': {'clean': 1, 'noisy': 1},
|
147 |
+
'ga': {'clean': 1, 'noisy': 4},
|
148 |
+
'gag': {'clean': 1, 'noisy': 1},
|
149 |
+
'gbm': {'clean': 1, 'noisy': 1},
|
150 |
+
'gd': {'clean': 1, 'noisy': 1},
|
151 |
+
'gl': {'clean': 1, 'noisy': 2},
|
152 |
+
'gn': {'clean': 1, 'noisy': 1},
|
153 |
+
'gof': {'clean': 1, 'noisy': 1},
|
154 |
+
'gom': {'clean': 1, 'noisy': 1},
|
155 |
+
'gom_Latn': {'clean': 1, 'noisy': 1},
|
156 |
+
'gor': {'clean': 1, 'noisy': 1},
|
157 |
+
'grc': {'clean': 1, 'noisy': 1},
|
158 |
+
'gsw': {'clean': 1, 'noisy': 5},
|
159 |
+
'gu': {'clean': 1, 'noisy': 1},
|
160 |
+
'gu_Latn': {'clean': 1, 'noisy': 1},
|
161 |
+
'gub': {'clean': 1, 'noisy': 1},
|
162 |
+
'guc': {'clean': 1, 'noisy': 1},
|
163 |
+
'guh': {'clean': 1, 'noisy': 1},
|
164 |
+
'gui': {'clean': 1, 'noisy': 1},
|
165 |
+
'gv': {'clean': 1, 'noisy': 1},
|
166 |
+
'gvl': {'clean': 1, 'noisy': 1},
|
167 |
+
'gym': {'clean': 1, 'noisy': 1},
|
168 |
+
'ha': {'clean': 1, 'noisy': 1},
|
169 |
+
'haw': {'clean': 1, 'noisy': 1},
|
170 |
+
'he': {'clean': 6, 'noisy': 10},
|
171 |
+
'hi': {'clean': 4, 'noisy': 8},
|
172 |
+
'hi_Latn': {'clean': 1, 'noisy': 1},
|
173 |
+
'hif': {'clean': 1, 'noisy': 2},
|
174 |
+
'hil': {'clean': 1, 'noisy': 1},
|
175 |
+
'hmn': {'clean': 1, 'noisy': 1},
|
176 |
+
'hne': {'clean': 1, 'noisy': 1},
|
177 |
+
'ho': {'clean': 1, 'noisy': 1},
|
178 |
+
'hr': {'clean': 2, 'noisy': 13},
|
179 |
+
'ht': {'clean': 1, 'noisy': 1},
|
180 |
+
'hu': {'clean': 20, 'noisy': 34},
|
181 |
+
'hui': {'clean': 1, 'noisy': 1},
|
182 |
+
'hus': {'clean': 1, 'noisy': 1},
|
183 |
+
'hvn': {'clean': 1, 'noisy': 1},
|
184 |
+
'hy': {'clean': 1, 'noisy': 2},
|
185 |
+
'iba': {'clean': 1, 'noisy': 1},
|
186 |
+
'ibb': {'clean': 1, 'noisy': 1},
|
187 |
+
'id': {'clean': 18, 'noisy': 54},
|
188 |
+
'ify': {'clean': 1, 'noisy': 1},
|
189 |
+
'ig': {'clean': 1, 'noisy': 1},
|
190 |
+
'ilo': {'clean': 1, 'noisy': 1},
|
191 |
+
'inb': {'clean': 1, 'noisy': 1},
|
192 |
+
'is': {'clean': 1, 'noisy': 3},
|
193 |
+
'iso': {'clean': 1, 'noisy': 1},
|
194 |
+
'it': {'clean': 72, 'noisy': 170},
|
195 |
+
'iu': {'clean': 1, 'noisy': 1},
|
196 |
+
'ium': {'clean': 1, 'noisy': 1},
|
197 |
+
'izz': {'clean': 1, 'noisy': 1},
|
198 |
+
'ja': {'clean': 36, 'noisy': 36},
|
199 |
+
'jac': {'clean': 1, 'noisy': 1},
|
200 |
+
'jam': {'clean': 1, 'noisy': 1},
|
201 |
+
'jiv': {'clean': 1, 'noisy': 1},
|
202 |
+
'jv': {'clean': 1, 'noisy': 1},
|
203 |
+
'jvn': {'clean': 1, 'noisy': 1},
|
204 |
+
'ka': {'clean': 1, 'noisy': 2},
|
205 |
+
'kaa': {'clean': 1, 'noisy': 1},
|
206 |
+
'kaa_Latn': {'clean': 1, 'noisy': 1},
|
207 |
+
'kac': {'clean': 1, 'noisy': 1},
|
208 |
+
'kbd': {'clean': 1, 'noisy': 1},
|
209 |
+
'kbp': {'clean': 1, 'noisy': 1},
|
210 |
+
'kek': {'clean': 1, 'noisy': 1},
|
211 |
+
'kg': {'clean': 1, 'noisy': 1},
|
212 |
+
'kha': {'clean': 1, 'noisy': 1},
|
213 |
+
'kj': {'clean': 1, 'noisy': 1},
|
214 |
+
'kjg': {'clean': 1, 'noisy': 1},
|
215 |
+
'kjh': {'clean': 1, 'noisy': 1},
|
216 |
+
'kk': {'clean': 2, 'noisy': 3},
|
217 |
+
'kl': {'clean': 1, 'noisy': 1},
|
218 |
+
'km': {'clean': 1, 'noisy': 1},
|
219 |
+
'kmb': {'clean': 1, 'noisy': 1},
|
220 |
+
'kmz_Latn': {'clean': 1, 'noisy': 1},
|
221 |
+
'kn': {'clean': 1, 'noisy': 1},
|
222 |
+
'kn_Latn': {'clean': 1, 'noisy': 1},
|
223 |
+
'knj': {'clean': 1, 'noisy': 1},
|
224 |
+
'ko': {'clean': 13, 'noisy': 19},
|
225 |
+
'koi': {'clean': 1, 'noisy': 1},
|
226 |
+
'kos': {'clean': 1, 'noisy': 1},
|
227 |
+
'krc': {'clean': 1, 'noisy': 1},
|
228 |
+
'kri': {'clean': 1, 'noisy': 1},
|
229 |
+
'ksd': {'clean': 1, 'noisy': 1},
|
230 |
+
'ksw': {'clean': 1, 'noisy': 1},
|
231 |
+
'ktu': {'clean': 1, 'noisy': 1},
|
232 |
+
'ku': {'clean': 1, 'noisy': 1},
|
233 |
+
'kum': {'clean': 1, 'noisy': 1},
|
234 |
+
'kv': {'clean': 1, 'noisy': 1},
|
235 |
+
'kw': {'clean': 1, 'noisy': 1},
|
236 |
+
'kwi': {'clean': 1, 'noisy': 1},
|
237 |
+
'ky': {'clean': 1, 'noisy': 1},
|
238 |
+
'la': {'clean': 1, 'noisy': 2},
|
239 |
+
'laj': {'clean': 1, 'noisy': 1},
|
240 |
+
'lb': {'clean': 1, 'noisy': 8},
|
241 |
+
'lg': {'clean': 1, 'noisy': 1},
|
242 |
+
'lhu': {'clean': 1, 'noisy': 1},
|
243 |
+
'ln': {'clean': 1, 'noisy': 1},
|
244 |
+
'lo': {'clean': 1, 'noisy': 1},
|
245 |
+
'lrc': {'clean': 1, 'noisy': 1},
|
246 |
+
'lt': {'clean': 6, 'noisy': 9},
|
247 |
+
'ltg': {'clean': 1, 'noisy': 1},
|
248 |
+
'lu': {'clean': 1, 'noisy': 1},
|
249 |
+
'lus': {'clean': 1, 'noisy': 1},
|
250 |
+
'lv': {'clean': 4, 'noisy': 5},
|
251 |
+
'mad': {'clean': 1, 'noisy': 1},
|
252 |
+
'mag': {'clean': 1, 'noisy': 1},
|
253 |
+
'mai': {'clean': 1, 'noisy': 1},
|
254 |
+
'mak': {'clean': 1, 'noisy': 1},
|
255 |
+
'mam': {'clean': 1, 'noisy': 1},
|
256 |
+
'mas': {'clean': 1, 'noisy': 1},
|
257 |
+
'maz': {'clean': 1, 'noisy': 1},
|
258 |
+
'mbt': {'clean': 1, 'noisy': 1},
|
259 |
+
'mdf': {'clean': 1, 'noisy': 1},
|
260 |
+
'meo': {'clean': 1, 'noisy': 1},
|
261 |
+
'meu': {'clean': 1, 'noisy': 1},
|
262 |
+
'mfe': {'clean': 1, 'noisy': 1},
|
263 |
+
'mg': {'clean': 1, 'noisy': 1},
|
264 |
+
'mgh': {'clean': 1, 'noisy': 1},
|
265 |
+
'mh': {'clean': 1, 'noisy': 1},
|
266 |
+
'mi': {'clean': 1, 'noisy': 1},
|
267 |
+
'min': {'clean': 1, 'noisy': 1},
|
268 |
+
'miq': {'clean': 1, 'noisy': 1},
|
269 |
+
'mk': {'clean': 1, 'noisy': 2},
|
270 |
+
'mkn': {'clean': 1, 'noisy': 1},
|
271 |
+
'ml': {'clean': 2, 'noisy': 2},
|
272 |
+
'ml_Latn': {'clean': 1, 'noisy': 1},
|
273 |
+
'mn': {'clean': 1, 'noisy': 2},
|
274 |
+
'mni': {'clean': 1, 'noisy': 1},
|
275 |
+
'mps': {'clean': 1, 'noisy': 1},
|
276 |
+
'mqy': {'clean': 1, 'noisy': 1},
|
277 |
+
'mr': {'clean': 1, 'noisy': 2},
|
278 |
+
'mrj': {'clean': 1, 'noisy': 1},
|
279 |
+
'mrw': {'clean': 1, 'noisy': 1},
|
280 |
+
'ms': {'clean': 2, 'noisy': 8},
|
281 |
+
'ms_Arab': {'clean': 1, 'noisy': 1},
|
282 |
+
'ms_Arab_BN': {'clean': 1, 'noisy': 1},
|
283 |
+
'msb': {'clean': 1, 'noisy': 1},
|
284 |
+
'msi': {'clean': 1, 'noisy': 1},
|
285 |
+
'msm': {'clean': 1, 'noisy': 1},
|
286 |
+
'mt': {'clean': 1, 'noisy': 1},
|
287 |
+
'my': {'clean': 1, 'noisy': 1},
|
288 |
+
'myv': {'clean': 1, 'noisy': 1},
|
289 |
+
'nan_Latn_TW': {'clean': 1, 'noisy': 1},
|
290 |
+
'ndc_ZW': {'clean': 1, 'noisy': 1},
|
291 |
+
'ne': {'clean': 1, 'noisy': 1},
|
292 |
+
'new': {'clean': 1, 'noisy': 1},
|
293 |
+
'ngu': {'clean': 1, 'noisy': 1},
|
294 |
+
'nhe': {'clean': 1, 'noisy': 1},
|
295 |
+
'nia': {'clean': 1, 'noisy': 1},
|
296 |
+
'nij': {'clean': 1, 'noisy': 1},
|
297 |
+
'niq': {'clean': 1, 'noisy': 1},
|
298 |
+
'nl': {'clean': 43, 'noisy': 95},
|
299 |
+
'nnb': {'clean': 1, 'noisy': 1},
|
300 |
+
'no': {'clean': 10, 'noisy': 40},
|
301 |
+
'noa': {'clean': 1, 'noisy': 1},
|
302 |
+
'nog': {'clean': 1, 'noisy': 1},
|
303 |
+
'nr': {'clean': 1, 'noisy': 1},
|
304 |
+
'nso': {'clean': 1, 'noisy': 1},
|
305 |
+
'nut': {'clean': 1, 'noisy': 1},
|
306 |
+
'nv': {'clean': 1, 'noisy': 1},
|
307 |
+
'ny': {'clean': 1, 'noisy': 1},
|
308 |
+
'nyu': {'clean': 1, 'noisy': 1},
|
309 |
+
'nzi': {'clean': 1, 'noisy': 1},
|
310 |
+
'oc': {'clean': 1, 'noisy': 1},
|
311 |
+
'oj': {'clean': 1, 'noisy': 1},
|
312 |
+
'om': {'clean': 1, 'noisy': 1},
|
313 |
+
'or': {'clean': 1, 'noisy': 1},
|
314 |
+
'os': {'clean': 1, 'noisy': 1},
|
315 |
+
'otq': {'clean': 1, 'noisy': 1},
|
316 |
+
'pa': {'clean': 1, 'noisy': 1},
|
317 |
+
'pag': {'clean': 1, 'noisy': 1},
|
318 |
+
'pap': {'clean': 1, 'noisy': 1},
|
319 |
+
'pau': {'clean': 1, 'noisy': 1},
|
320 |
+
'pck': {'clean': 1, 'noisy': 1},
|
321 |
+
'pis': {'clean': 1, 'noisy': 1},
|
322 |
+
'pl': {'clean': 51, 'noisy': 74},
|
323 |
+
'pon': {'clean': 1, 'noisy': 1},
|
324 |
+
'ppk': {'clean': 1, 'noisy': 1},
|
325 |
+
'ps': {'clean': 1, 'noisy': 1},
|
326 |
+
'pt': {'clean': 66, 'noisy': 104},
|
327 |
+
'qu': {'clean': 1, 'noisy': 1},
|
328 |
+
'qub': {'clean': 1, 'noisy': 1},
|
329 |
+
'quc': {'clean': 1, 'noisy': 1},
|
330 |
+
'quf': {'clean': 1, 'noisy': 1},
|
331 |
+
'quh': {'clean': 1, 'noisy': 1},
|
332 |
+
'qup': {'clean': 1, 'noisy': 1},
|
333 |
+
'quy': {'clean': 1, 'noisy': 1},
|
334 |
+
'qvc': {'clean': 1, 'noisy': 1},
|
335 |
+
'qvi': {'clean': 1, 'noisy': 1},
|
336 |
+
'qvz': {'clean': 1, 'noisy': 1},
|
337 |
+
'qxr': {'clean': 1, 'noisy': 1},
|
338 |
+
'raj': {'clean': 1, 'noisy': 1},
|
339 |
+
'rcf': {'clean': 1, 'noisy': 1},
|
340 |
+
'rki': {'clean': 1, 'noisy': 1},
|
341 |
+
'rm': {'clean': 1, 'noisy': 1},
|
342 |
+
'rmc': {'clean': 1, 'noisy': 1},
|
343 |
+
'rn': {'clean': 1, 'noisy': 1},
|
344 |
+
'ro': {'clean': 20, 'noisy': 33},
|
345 |
+
'rom': {'clean': 1, 'noisy': 1},
|
346 |
+
'ru': {'clean': 299, 'noisy': 512},
|
347 |
+
'ru_Latn': {'clean': 1, 'noisy': 1},
|
348 |
+
'rw': {'clean': 1, 'noisy': 1},
|
349 |
+
'rwo': {'clean': 1, 'noisy': 1},
|
350 |
+
'sa': {'clean': 1, 'noisy': 1},
|
351 |
+
'sah': {'clean': 1, 'noisy': 1},
|
352 |
+
'sat_Latn': {'clean': 1, 'noisy': 1},
|
353 |
+
'sd': {'clean': 1, 'noisy': 1},
|
354 |
+
'sda': {'clean': 1, 'noisy': 1},
|
355 |
+
'se': {'clean': 1, 'noisy': 1},
|
356 |
+
'seh': {'clean': 1, 'noisy': 1},
|
357 |
+
'sg': {'clean': 1, 'noisy': 1},
|
358 |
+
'shn': {'clean': 1, 'noisy': 1},
|
359 |
+
'shp': {'clean': 1, 'noisy': 1},
|
360 |
+
'si': {'clean': 1, 'noisy': 1},
|
361 |
+
'sja': {'clean': 1, 'noisy': 1},
|
362 |
+
'sk': {'clean': 7, 'noisy': 12},
|
363 |
+
'skr': {'clean': 1, 'noisy': 1},
|
364 |
+
'sl': {'clean': 5, 'noisy': 7},
|
365 |
+
'sm': {'clean': 1, 'noisy': 1},
|
366 |
+
'smt': {'clean': 1, 'noisy': 1},
|
367 |
+
'sn': {'clean': 1, 'noisy': 2},
|
368 |
+
'so': {'clean': 1, 'noisy': 1},
|
369 |
+
'spp': {'clean': 1, 'noisy': 1},
|
370 |
+
'sq': {'clean': 2, 'noisy': 3},
|
371 |
+
'sr': {'clean': 2, 'noisy': 4},
|
372 |
+
'srm': {'clean': 1, 'noisy': 1},
|
373 |
+
'srn': {'clean': 1, 'noisy': 1},
|
374 |
+
'ss': {'clean': 1, 'noisy': 1},
|
375 |
+
'st': {'clean': 1, 'noisy': 1},
|
376 |
+
'stq': {'clean': 1, 'noisy': 1},
|
377 |
+
'su': {'clean': 1, 'noisy': 1},
|
378 |
+
'sus': {'clean': 1, 'noisy': 1},
|
379 |
+
'suz': {'clean': 1, 'noisy': 1},
|
380 |
+
'sv': {'clean': 21, 'noisy': 55},
|
381 |
+
'sw': {'clean': 1, 'noisy': 1},
|
382 |
+
'sxn': {'clean': 1, 'noisy': 1},
|
383 |
+
'syr': {'clean': 1, 'noisy': 1},
|
384 |
+
'ta': {'clean': 2, 'noisy': 4},
|
385 |
+
'ta_Latn': {'clean': 1, 'noisy': 1},
|
386 |
+
'tab': {'clean': 1, 'noisy': 1},
|
387 |
+
'taj': {'clean': 1, 'noisy': 1},
|
388 |
+
'tbz': {'clean': 1, 'noisy': 1},
|
389 |
+
'tca': {'clean': 1, 'noisy': 1},
|
390 |
+
'tcy': {'clean': 1, 'noisy': 1},
|
391 |
+
'tdx': {'clean': 1, 'noisy': 1},
|
392 |
+
'te': {'clean': 1, 'noisy': 2},
|
393 |
+
'te_Latn': {'clean': 1, 'noisy': 1},
|
394 |
+
'teo': {'clean': 1, 'noisy': 1},
|
395 |
+
'tet': {'clean': 1, 'noisy': 1},
|
396 |
+
'tg': {'clean': 1, 'noisy': 1},
|
397 |
+
'th': {'clean': 21, 'noisy': 22},
|
398 |
+
'ti': {'clean': 1, 'noisy': 1},
|
399 |
+
'tiv': {'clean': 1, 'noisy': 1},
|
400 |
+
'tk': {'clean': 1, 'noisy': 1},
|
401 |
+
'tks': {'clean': 1, 'noisy': 1},
|
402 |
+
'tlh': {'clean': 1, 'noisy': 1},
|
403 |
+
'tll': {'clean': 1, 'noisy': 1},
|
404 |
+
'tly_IR': {'clean': 1, 'noisy': 1},
|
405 |
+
'tn': {'clean': 1, 'noisy': 1},
|
406 |
+
'to': {'clean': 1, 'noisy': 1},
|
407 |
+
'toj': {'clean': 1, 'noisy': 1},
|
408 |
+
'tr': {'clean': 27, 'noisy': 50},
|
409 |
+
'trp': {'clean': 1, 'noisy': 1},
|
410 |
+
'ts': {'clean': 1, 'noisy': 1},
|
411 |
+
'tsc': {'clean': 1, 'noisy': 1},
|
412 |
+
'tsg': {'clean': 1, 'noisy': 1},
|
413 |
+
'tt': {'clean': 1, 'noisy': 2},
|
414 |
+
'tuc': {'clean': 1, 'noisy': 1},
|
415 |
+
'tvl': {'clean': 1, 'noisy': 1},
|
416 |
+
'twu': {'clean': 1, 'noisy': 1},
|
417 |
+
'tyv': {'clean': 1, 'noisy': 1},
|
418 |
+
'tyz': {'clean': 1, 'noisy': 1},
|
419 |
+
'tzh': {'clean': 1, 'noisy': 1},
|
420 |
+
'tzj': {'clean': 1, 'noisy': 1},
|
421 |
+
'tzo': {'clean': 1, 'noisy': 1},
|
422 |
+
'ubu': {'clean': 1, 'noisy': 1},
|
423 |
+
'udm': {'clean': 1, 'noisy': 1},
|
424 |
+
'ug': {'clean': 1, 'noisy': 1},
|
425 |
+
'uk': {'clean': 17, 'noisy': 28},
|
426 |
+
'ur': {'clean': 1, 'noisy': 1},
|
427 |
+
'uz': {'clean': 1, 'noisy': 1},
|
428 |
+
've': {'clean': 1, 'noisy': 1},
|
429 |
+
'vec': {'clean': 1, 'noisy': 1},
|
430 |
+
'vi': {'clean': 32, 'noisy': 49},
|
431 |
+
'wa': {'clean': 1, 'noisy': 1},
|
432 |
+
'wal': {'clean': 1, 'noisy': 1},
|
433 |
+
'war': {'clean': 1, 'noisy': 1},
|
434 |
+
'wo': {'clean': 1, 'noisy': 1},
|
435 |
+
'xal': {'clean': 1, 'noisy': 1},
|
436 |
+
'xh': {'clean': 1, 'noisy': 1},
|
437 |
+
'yap': {'clean': 1, 'noisy': 1},
|
438 |
+
'yi': {'clean': 1, 'noisy': 1},
|
439 |
+
'yo': {'clean': 1, 'noisy': 1},
|
440 |
+
'yua': {'clean': 1, 'noisy': 1},
|
441 |
+
'zap': {'clean': 1, 'noisy': 1},
|
442 |
+
'zh': {'clean': 40, 'noisy': 69},
|
443 |
+
'zh_Latn': {'clean': 1, 'noisy': 1},
|
444 |
+
'zne': {'clean': 1, 'noisy': 1},
|
445 |
+
'zu': {'clean': 1, 'noisy': 1},
|
446 |
+
'zxx_xx_dtynoise': {'clean': 1, 'noisy': 1},
|
447 |
+
'zza': {'clean': 1, 'noisy': 1}
|
448 |
+
}
|
449 |
+
|
450 |
+
_LANGUAGES = list(_N_SHARDS_PER_SPLIT.keys())
|
451 |
+
|
452 |
+
class Madlad400Config(datasets.BuilderConfig):
|
453 |
+
"""BuilderConfig for madlad-400."""
|
454 |
+
|
455 |
+
def __init__(self, *args, languages, **kwargs):
|
456 |
+
"""BuilderConfig for Madlad400.
|
457 |
+
Args:
|
458 |
+
languages (:obj:`List[str]`): list of languages to load
|
459 |
+
**kwargs: keyword arguments forwarded to super.
|
460 |
+
"""
|
461 |
+
super().__init__(
|
462 |
+
*args,
|
463 |
+
name="+".join(languages),
|
464 |
+
**kwargs,
|
465 |
+
)
|
466 |
+
self.languages = languages
|
467 |
+
|
468 |
+
|
469 |
+
class Madlad400(datasets.GeneratorBasedBuilder):
|
470 |
+
"""Madlad400,"""
|
471 |
+
|
472 |
+
BUILDER_CONFIGS = [Madlad400Config(languages=[lang]) for lang in _LANGUAGES]
|
473 |
+
BUILDER_CONFIG_CLASS = Madlad400Config
|
474 |
+
|
475 |
+
def _info(self):
|
476 |
+
return datasets.DatasetInfo(
|
477 |
+
description=_DESCRIPTION,
|
478 |
+
features=datasets.Features(
|
479 |
+
{
|
480 |
+
"text": datasets.Value("string"),
|
481 |
+
}
|
482 |
+
),
|
483 |
+
supervised_keys=None,
|
484 |
+
homepage='',
|
485 |
+
citation=_CITATION,
|
486 |
+
)
|
487 |
+
|
488 |
+
def _split_generators(self, dl_manager):
|
489 |
+
data_urls = {}
|
490 |
+
for split in ["clean", "noisy"]:
|
491 |
+
data_urls[split] = [
|
492 |
+
_DATA_URL.format(
|
493 |
+
split=split,
|
494 |
+
language=lang,
|
495 |
+
index=index,
|
496 |
+
)
|
497 |
+
for lang in self.config.languages
|
498 |
+
for index in range(_N_SHARDS_PER_SPLIT[lang][split])
|
499 |
+
]
|
500 |
+
clean_downloaded_files = dl_manager.download(data_urls['clean'])
|
501 |
+
noisy_downloaded_files = dl_manager.download(data_urls['noisy'])
|
502 |
+
return [
|
503 |
+
datasets.SplitGenerator(name="clean", gen_kwargs={"filepaths": clean_downloaded_files}),
|
504 |
+
datasets.SplitGenerator(
|
505 |
+
name="noisy", gen_kwargs={"filepaths": noisy_downloaded_files}
|
506 |
+
),
|
507 |
+
]
|
508 |
+
|
509 |
+
def _generate_examples(self, filepaths):
|
510 |
+
"""This function returns the examples in the raw (text) form by iterating over the provided files."""
|
511 |
+
id_ = 0
|
512 |
+
for filepath in filepaths:
|
513 |
+
logger.info("generating examples from = %s", filepath)
|
514 |
+
with gzip.open(open(filepath, "rb"), "rt", encoding="utf-8") as f:
|
515 |
+
for line in f:
|
516 |
+
if line:
|
517 |
+
example = json.loads(line)
|
518 |
+
yield id_, example
|
519 |
+
id_ += 1
|