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