File size: 28,750 Bytes
bc4eb78 |
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 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 |
# coding=utf-8
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""TODO: Add a description here."""
from __future__ import absolute_import, division, print_function
import os
import datasets
# TODO: Add BibTeX citation
# Find for instance the citation on arxiv or on the dataset repo/website
_CITATION = """\
@inproceedings{commonvoice:2020,
author = {Ardila, R. and Branson, M. and Davis, K. and Henretty, M. and Kohler, M. and Meyer, J. and Morais, R. and Saunders, L. and Tyers, F. M. and Weber, G.},
title = {Common Voice: A Massively-Multilingual Speech Corpus},
booktitle = {Proceedings of the 12th Conference on Language Resources and Evaluation (LREC 2020)},
pages = {4211--4215},
year = 2020
}
"""
# TODO: Add description of the dataset here
# You can copy an official description
_DESCRIPTION = """\
Common Voice is Mozilla's initiative to help teach machines how real people speak.
The dataset currently consists of 7,335 validated hours of speech in 60 languages, but we’re always adding more voices and languages.
"""
# TODO: Add a link to an official homepage for the dataset here
_HOMEPAGE = "https://commonvoice.mozilla.org/en/datasets"
# TODO: Add the licence for the dataset here if you can find it
_LICENSE = "https://github.com/common-voice/common-voice/blob/main/LICENSE"
# TODO: Add link to the official dataset URLs here
# The HuggingFace dataset library don't host the datasets but only point to the original files
# This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
_URLs = {
'first_domain': "https://mozilla-common-voice-datasets.s3.dualstack.us-west-2.amazonaws.com/cv-corpus-6.1-2020-12-11/en.tar.gz?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIAQ3GQRTO3CAFSOHXG%2F20210212%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20210212T082132Z&X-Amz-Expires=43200&X-Amz-Security-Token=FwoGZXIvYXdzEOr%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaDDBRxPQbFwld%2BrOewCKSBOR7k7VaqtnM0zucItVC0gdXyV4Uh5qtOx0vhTzhGRJ2r0mKkJ5FNL8bMe5TWtcX0IEH8HHTs28S%2BDerVhBD%2FGKfxy6J4BQCjhR0J8AoqwEYm0qRVm5b7tbWBNYetD5c8HxYGWWRppvaYxRxdnRbupfKuGpMEf3eYskfH8tAA739HbcKj44LGe4lkKsGvI1avxrxrNugcrNF%2BOccEdNInU%2F%2BVQvoFUu93oAEhJWl8dWXswDtZSCmuvfTjCbsZjphoSfTz5t0T25qXwP3PpcZTRVrYm9rQ4GGwaiva9qs0Q0nA0mC0skcMLF%2BZMxfo4wtaDfneDoPgNITqHtLyXLKeXRwIhHUzjNriniNNTp3XJyivc6qr6uNJ23IysUKfqNfQ2EiZC07VEQlVcYoSBKNHvGEIHsXfICaQ4MyHSl7dJa0CaSOAjBytNMxxhqCCLylJ%2BEgnO45VS5X12z8D3vTyyjR67hqXKDHwdTioVTlK3j%2FTXWRHDw31EbikSkhDKubD%2F2VDJLMul7cXjpCWygmJXHKG%2BNQKM09vP3pdmuVuQ1Z8an8OPMTnGKJEOsKXkrCJTOjvQVAl7z4KKlA9UW0Hp0u%2FoZnT%2Fxgi7dvqwu1Fq7%2BRQ%2BkXi3LT6lA%2B%2BJfO2HEOnlcsg1TFompSGp0dD12F3iTQNmKAuakCdunLyQRd%2Bgi2vRmwfsPyHOnRiJVbyghoEWyKLHtmIEGMir%2B01wURSgc46vtaXqBOz5Gtj4bF5wkpw6TCh%2FiHFn7Fx6igw69uJmKtpI%3D&X-Amz-Signature=573df56b8f6aa8e13b2fa26fa0763718e25f2d7a33e0be97ea5ff82680d82474&X-Amz-SignedHeaders=host"
}
#_FILES = {
# "dev.tsv": "fields": {
# "client_id": "client_id",
# "path": "path to sound file"
# "sentence": "sentence pronounced",
# "up_votes": "upvotes by reviewers",
# "down_votes": "down votes by reviewers"
# "age": "Age of the speaker":
# "gender" "Gender of the speaker",
# "accent": "accent of the speaker",
# "locale": "location of the speaker",
# "segment": "segment",
# }
# "invalidated.tsv": {
# "client_id": "client_id",
# "path": "path to sound file"
# "sentence": "sentence pronounced",
# "up_votes": "upvotes by reviewers",
# "down_votes": "down votes by reviewers"
# "age": "Age of the speaker":
# "gender" "Gender of the speaker",
# "accent": "accent of the speaker",
# "locale": "location of the speaker",
# "segment": "segment"}
# "other.tsv":
# {
# "client_id": "client_id",
# "path": "path to sound file"
# "sentence": "sentence pronounced",
# "up_votes": "upvotes by reviewers",
# "down_votes": "down votes by reviewers"
# "age": "Age of the speaker":
# "gender" "Gender of the speaker",
# "accent": "accent of the speaker",
# "locale": "location of the speaker",
# "segment": "segment", }
# "reported.tsv": {
# {
# "sentence": "sentence",
# "senetence_id": "sentence_id"
# "locale": "location of the speakr",
# "reason": "reason for report"
# }
# "test.tsv": {
# {
# "client_id": "client_id",
# "path": "path to sound file"
# "sentence": "sentence pronounced",
# "up_votes": "upvotes by reviewers",
# "down_votes": "down votes by reviewers"
# "age": "Age of the speaker":
# "gender" "Gender of the speaker",
# "accent": "accent of the speaker",
# "locale": "location of the speaker",
# "segment": "segment", }
# }
# "train.tsv": {
# {
# "client_id": "client_id",
# "path": "path to sound file"
# "sentence": "sentence pronounced",
# "up_votes": "upvotes by reviewers",
# "down_votes": "down votes by reviewers"
# "age": "Age of the speaker":
# "gender" "Gender of the speaker",
# "accent": "accent of the speaker",
# "locale": "location of the speaker",
# "segment": "segment", }
# }
# "validated.tsv": {
# {
# "client_id": "client_id",
# "path": "path to sound file"
# "sentence": "sentence pronounced",
# "up_votes": "upvotes by reviewers",
# "down_votes": "down votes by reviewers"
# "age": "Age of the speaker":
# "gender" "Gender of the speaker",
# "accent": "accent of the speaker",
# "locale": "location of the speaker",
# "segment": "segment", }
# }
#}
_LANGUAGES = {
"Abkhaz": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},
"Arabic": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},
"Assamese": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},
"Breton": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},
"Catalan": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},
"Hakha Chin": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},
"Czech": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},
"Chuvash": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},
"Welsh": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},
"Abkhaz": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},
"German": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},
"Dhivehi": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},
"Greek": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},
"English": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},
"Esperanto": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},
"Spanish": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},
"Estonian": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},
"Basque": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},
"Persian": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},
"Finnish": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},
"French": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},
"Frisian": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},
"Irish": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},
"Hindi": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},
"Sorbian, Upper": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},
"Hungarian": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},
"InterLinguia": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},
"Indonesian": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},
"Italian": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},
"Japanese": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},"Georgian": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},
"Kabyle": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},
"Kyrgyz": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},
"Luganda": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},
"German": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},
"Lithuanian": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},
"Latvian": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},
"Mongolian": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},
"Maltese": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},"Dutch": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14,
"Download_Link": "https://mozilla-common-voice-datasets.s3.dualstack.us-west-2.amazonaws.com/cv-corpus-6.1-2020-12-11/nl.tar.gz?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIAQ3GQRTO3ND4UAQXB%2F20210217%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20210217T080740Z&X-Amz-Expires=43200&X-Amz-Security-Token=FwoGZXIvYXdzEGIaDCC6ALh%2FwIK9ovvRdCKSBCs5WaSJNsZ2h0SnhpnWFv4yiAJHJTe%2BY6pBcCqadRMs0RABHeQ2n1QDACJ5V9WOqIHfMfT0AI%2Bfe6iFkTGLgRrJOMYpgV%2FmIBcXCjeb72r4ZvudMA8tprkSxZsEh53bJkIDQx1tXqfpz0yoefM0geD3461suEGhHnLIyiwffrUpRg%2BkNZN9%2FLZZXpF5F2pogieKKV533Jetkd1xlWOR%2Bem9R2bENu2RV563XX3JvbWxSYN9IHkVT1xwd4ZiOpUtX7%2F2RoluJUKw%2BUPpyml3J%2FOPPGdr7CyPLjqNxdq9ceRi8lRybty64XvNYZGt45VNTQ3pkTTz4VpUCJAGkgxq95Ve%2BOwW%2Fsc8JtblTFKrH11vej62NB7C0n7JPPS4SLKXHKW%2B7ZbybcNf3BnsAVouPdsGTMslcgkD81b9trnjyXJdOZkzdHUf2KcWVXVceEsZnMhcCZQ1cJpI7qXPEk8QrKCQcNByPLHmPIEdHpj9IrIBKDkl2qO7VX7CCB65WDt2eZRltOcNHXWVFXFktMdQOQztI1j0XSZz2iOX4jPKKaqz193VEytlAqmehNi8pePOnxkP9Z1SP7d3I6rayuBF3phmpHxw499tY3ECYYgoCnJ6QSFa3KxMjFmEpQlmjxuwEMHd4CDL2FJYGcCiIxbCcL1r8ZE3%2BbGdcu7PRsVCHX3Huh%2FqGIaF4h40FgteN6teyKCHKOebs4EGMipb9xmEMZ9ZbVopz4bkhLdMTrjKon9w624Xem0MTPqN7XY%2BB6lRgrW8rd4%3D&X-Amz-Signature=28eabdfce72a472a70b0f9e1e2c37fe1471b5ec8ed60614fbe900bfa97ae1ac8&X-Amz-SignedHeaders=host"
},"Odia": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},
"Punjabi": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},
"Polish": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},"Portuguese": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},"Romansh Sursilvan": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},"Romansh Vallader": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},"Romanian": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},"Russian": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},"Kinyarwanda": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},"Sakha": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},"Slovenian": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},"Swedish": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},"Tamil": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},"Thai": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},"Turkish": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},"Tatar": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},"Ukrainian": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},"Vietnamese": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},"Votic": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},"Chinese (China)": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},"Chinese (Hong Kong)": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
},"Chinese (Taiwan": {
"Date": "2020-12-11",
"Size": "39 MB",
"Version": "ab_1h_2020-12-11",
"Validated_Hr_Total": 0.05,
"Overall_Hr_Total": 1,
"Number_Of_Voice": 14
}
}
class CommonVoiceConfig(datasets.BuilderConfig):
"""BuilderConfig for CommonVoice."""
def __init__(self, name, sub_version, **kwargs):
"""
Args:
data_dir: `string`, the path to the folder containing the files in the
downloaded .tar
citation: `string`, citation for the data set
url: `string`, url for information about the data set
**kwargs: keyword arguments forwarded to super.
"""
self.language = name
self.sub_version = sub_version
self.date_of_snapshot = kwargs.pop("date", None)
self.size = kwargs.pop("size", None)
self.validated_hr_total = kwargs.pop("val_hrs", None)
self.total_hr_total = kwargs.pop("total_hrs", None)
self.num_of_voice = kwargs.pop("num_of_voice", None)
description = f"Common Voice speech to text dataset in {self.language} version {self.sub_version} of {self.date_of_snapshot}. The dataset comprises {self.validated_hr_total} of validated transcribed speech data from {self.num_of_voice} speakers. The dataset has a size of {self.size}"
super(CommonVoiceConfig, self).__init__(name=name, version=datasets.Version("6.1.0", ""), description=description, **kwargs)
# TODO: Name of the dataset usually match the script name with CamelCase instead of snake_case
class CommonVoice(datasets.GeneratorBasedBuilder):
"""TODO: Short description of my dataset."""
@property
def manual_download_instructions(self):
return """\
You need to go to https://commonvoice.mozilla.org/en/datasets,
and manually download the dataset as a .tar file. Once it is completed,
a folder will be made containing the files, validated.tsv, train.tsv, test.tsv, reported.tsv, other.tsv, invalidated.tsv, dev.tsv
and the folder clips containing audiofiles sampled at 48khz. Each clip is around 3-4 seconds in duration with a size of around 20-50 khz"""
BUILDER_CONFIGS = [
CommonVoiceConfig(
name=lang,
sub_version=_LANGUAGES[lang]["Version"],
date=_LANGUAGES[lang]["Date"],
size=_LANGUAGES[lang]["Size"],
val_hrs=_LANGUAGES[lang]["Validated_Hr_Total"],
total_hrs=_LANGUAGES[lang]["Overall_Hr_Total"],
num_of_voice=_LANGUAGES[lang]["Number_Of_Voice"],
)
for lang in _LANGUAGES.keys()
]
# DEFAULT_CONFIG_NAME = "first_domain" # It's not mandatory to have a default configuration. Just use one if it make sense.
def _info(self):
# TODO: This method specifies the datasets.DatasetInfo object which contains informations and typings for the dataset
# if self.config.name == "first_domain": # This is the name of the configuration selected in BUILDER_CONFIGS above
# features = datasets.Features(
# {
# "client_id": datasets.Value("string"),
# "path": datasets.Value("string"),
# "sentence": datasets.Value("string"),
# "up_votes": datasets.Value("int64"),
# "down_votes": datasets.Value("int64"),
# "age": datasets.Value("string"),
# "gender": datasets.Value("string"),
# "locale": datasets.Value("string"),
# "segmet": datasets.Value("string"),
#
# These are the features of your dataset like images, labels ...
# }
# )
#
# else: # This is an example to show how to have different features for "first_domain" and "second_domain"
features = datasets.Features(
{
"client_id": datasets.Value("string"),
"path": datasets.Value("string"),
"sentence": datasets.Value("string"),
"up_votes": datasets.Value("int64"),
"down_votes": datasets.Value("int64"),
"age": datasets.Value("string"),
"gender": datasets.Value("string"),
"accent": datasets.Value("string"),
"locale": datasets.Value("string"),
"segment": datasets.Value("string"),
}
)
return datasets.DatasetInfo(
# This is the description that will appear on the datasets page.
description=_DESCRIPTION,
# This defines the different columns of the dataset and their types
features=features, # Here we define them above because they are different between the two configurations
# If there's a common (input, target) tuple from the features,
# specify them here. They'll be used if as_supervised=True in
# builder.as_dataset.
supervised_keys=None,
# Homepage of the dataset for documentation
homepage=_HOMEPAGE,
# License for the dataset if available
license=_LICENSE,
# Citation for the dataset
citation=_CITATION,
)
def _split_generators(self, dl_manager):
"""Returns SplitGenerators."""
# TODO: This method is tasked with downloading/extracting the data and defining the splits depending on the configuration
# If several configurations are possible (listed in BUILDER_CONFIGS), the configuration selected by the user is in self.config.name
# dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLs
# It can accept any type or nested list/dict and will give back the same structure with the url replaced with path to local files.
# By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
abs_path_to_data = os.path.abspath(dl_manager.manual_dir)
abs_path_to_clips = os.path.join(abs_path_to_data, "clips")
return [
datasets.SplitGenerator(
name=datasets.Split.TRAIN,
gen_kwargs={
"filepath": os.path.join(abs_path_to_data, "train.tsv"),
"path_to_clips": abs_path_to_clips,
},
),
datasets.SplitGenerator(
name=datasets.Split.TEST,
gen_kwargs={
"filepath": os.path.join(abs_path_to_data, "test.tsv"),
"path_to_clips": abs_path_to_clips,
},
),
datasets.SplitGenerator(
name=datasets.Split.VALIDATION,
gen_kwargs={
"filepath": os.path.join(abs_path_to_data, "dev.tsv"),
"path_to_clips": abs_path_to_clips,
},
),
datasets.SplitGenerator(
name="other",
gen_kwargs={
"filepath": os.path.join(abs_path_to_data, "other.tsv"),
"path_to_clips": abs_path_to_clips,
},
),
datasets.SplitGenerator(
name="invalidated",
gen_kwargs={
"filepath": os.path.join(abs_path_to_data, "invalidated.tsv"),
"path_to_clips": abs_path_to_clips,
},
),
]
def _generate_examples(self, filepath, path_to_clips):
""" Yields examples. """
# TODO: This method will receive as arguments the `gen_kwargs` defined in the previous `_split_generators` method.
# It is in charge of opening the given file and yielding (key, example) tuples from the dataset
# The key is not important, it's more here for legacy reason (legacy from tfds)
data_fields = list(self._info().features.keys())
path_idx = data_fields.index("path")
with open(filepath, encoding="utf-8") as f:
lines = f.readlines()
headline = lines[0]
column_names = headline.strip().split("\t")
assert column_names == data_fields, f"The file should have {data_fields} as column names, but has {column_names}"
for id_, line in enumerate(lines[1:]):
field_values = line.strip().split("\t")
# set absolute path for mp3 audio file
field_values[path_idx] = os.path.join(path_to_clips, field_values[path_idx])
# if data is incomplete, fill with empty values
if len(field_values) < len(data_fields):
field_values += (len(data_fields) - len(field_values)) * ["''"]
yield id_, {
key: value for key, value in zip(data_fields, field_values)
}
|