Datasets:
carlosdanielhernandezmena
commited on
Commit
•
5f9fe94
1
Parent(s):
2f8c6ba
Adding all the files for the first time
Browse files- corpus/files/metadata_dev.tsv +11 -0
- corpus/files/metadata_test.tsv +11 -0
- corpus/files/metadata_train.tsv +21 -0
- corpus/files/tars_dev.paths +1 -0
- corpus/files/tars_test.paths +1 -0
- corpus/files/tars_train.paths +1 -0
- corpus/speech/dev.tar.gz +3 -0
- corpus/speech/dev.tar.gz.lock +0 -0
- corpus/speech/test.tar.gz +3 -0
- corpus/speech/test.tar.gz.lock +0 -0
- corpus/speech/train.tar.gz +3 -0
- corpus/speech/train.tar.gz.lock +0 -0
- toy_corpus_asr_es.py +143 -0
corpus/files/metadata_dev.tsv
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
audio_id split gender normalized_text relative_path
|
2 |
+
common_voice_es_18328658 dev male ni siquiera pienses en eso vaquero o sí muchacho rudo corpus/speech/dev/male/common_voice_es_18328658.flac
|
3 |
+
common_voice_es_18549611 dev female invitados del cumpleaños a las tres en punto cálmense todos corpus/speech/dev/female/common_voice_es_18549611.flac
|
4 |
+
common_voice_es_19026674 dev male en la supervivencia de la especie corpus/speech/dev/male/common_voice_es_19026674.flac
|
5 |
+
common_voice_es_19159450 dev male antes de la llegada de los europeos era fue una potencia política en halmahera corpus/speech/dev/male/common_voice_es_19159450.flac
|
6 |
+
common_voice_es_19597257 dev male la liga quedó interrumpida en los últimos años de la segunda guerra mundial corpus/speech/dev/male/common_voice_es_19597257.flac
|
7 |
+
common_voice_es_19603417 dev female desde entonces ha participado en numerosas novilladas sin picadores corpus/speech/dev/female/common_voice_es_19603417.flac
|
8 |
+
common_voice_es_19604077 dev male apareció en la película toma estas alas rotas corpus/speech/dev/male/common_voice_es_19604077.flac
|
9 |
+
common_voice_es_19666365 dev female sin embargo a lo largo del capítulo subyace una gran pregunta corpus/speech/dev/female/common_voice_es_19666365.flac
|
10 |
+
common_voice_es_19738526 dev female fue su reino en su tiempo el más poderoso e influyente de europa occidental corpus/speech/dev/female/common_voice_es_19738526.flac
|
11 |
+
common_voice_es_19942148 dev female en las últimas versiones de final cut pro apple inc corpus/speech/dev/female/common_voice_es_19942148.flac
|
corpus/files/metadata_test.tsv
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
audio_id split gender normalized_text relative_path
|
2 |
+
common_voice_es_18307761 test male y calló tal vez esperando una disculpa amante pero yo preferí guardar silencio corpus/speech/test/male/common_voice_es_18307761.flac
|
3 |
+
common_voice_es_18569707 test male esos hombres son profesionales son los mejores corpus/speech/test/male/common_voice_es_18569707.flac
|
4 |
+
common_voice_es_18831947 test male uno levanta la caza y otro la mata corpus/speech/test/male/common_voice_es_18831947.flac
|
5 |
+
common_voice_es_19131994 test female ante esta situación el oficial mandó prender fuego a la casa corpus/speech/test/female/common_voice_es_19131994.flac
|
6 |
+
common_voice_es_19523672 test male fue vicario apostólico del uruguay corpus/speech/test/male/common_voice_es_19523672.flac
|
7 |
+
common_voice_es_19610763 test male se desempeñó como mediocampista ofensivo corpus/speech/test/male/common_voice_es_19610763.flac
|
8 |
+
common_voice_es_19629310 test female esta pieza se retira del paciente junto con la aguja corpus/speech/test/female/common_voice_es_19629310.flac
|
9 |
+
common_voice_es_19699841 test female el grupo que acabe antes será el ganador corpus/speech/test/female/common_voice_es_19699841.flac
|
10 |
+
common_voice_es_19960886 test female el gobierno estadounidense no la reconoció como representante del pueblo cubano corpus/speech/test/female/common_voice_es_19960886.flac
|
11 |
+
common_voice_es_20260627 test female fue redactor en jefe de la página deportiva de el diario el país corpus/speech/test/female/common_voice_es_20260627.flac
|
corpus/files/metadata_train.tsv
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
audio_id split gender normalized_text relative_path
|
2 |
+
common_voice_es_18306568 train male no me hables acerca de importancia corpus/speech/train/male/common_voice_es_18306568.flac
|
3 |
+
common_voice_es_18320698 train male he restringido el acceso a la cubierta superior corpus/speech/train/male/common_voice_es_18320698.flac
|
4 |
+
common_voice_es_19596707 train male los orígenes precisos de the hood son desconocidos corpus/speech/train/male/common_voice_es_19596707.flac
|
5 |
+
common_voice_es_20501506 train male una vez destruidos se pierden inexorablemente corpus/speech/train/male/common_voice_es_20501506.flac
|
6 |
+
common_voice_es_20507096 train male el resto están todas en inglaterra corpus/speech/train/male/common_voice_es_20507096.flac
|
7 |
+
common_voice_es_20511043 train male las canciones de los comerciales sirvieron como singles para lee entre sus álbumes corpus/speech/train/male/common_voice_es_20511043.flac
|
8 |
+
common_voice_es_20711016 train female los hombres se quedan a jugar a las cartas hasta que amanece sin dormir corpus/speech/train/female/common_voice_es_20711016.flac
|
9 |
+
common_voice_es_20711252 train female con trece años comienza a realizar pequeños papeles para series de televisión y cine corpus/speech/train/female/common_voice_es_20711252.flac
|
10 |
+
common_voice_es_20717545 train female su actividad fuera del campo fue variada corpus/speech/train/female/common_voice_es_20717545.flac
|
11 |
+
common_voice_es_20717953 train female actualmente no está activo corpus/speech/train/female/common_voice_es_20717953.flac
|
12 |
+
common_voice_es_20722210 train female es nativo de farmington hills michigan corpus/speech/train/female/common_voice_es_20722210.flac
|
13 |
+
common_voice_es_20722849 train female incluye el navegador web safari y la aplicación mail de apple corpus/speech/train/female/common_voice_es_20722849.flac
|
14 |
+
common_voice_es_20724424 train female desempeña un papel vital en la promoción del talento nacional e internacional emergente corpus/speech/train/female/common_voice_es_20724424.flac
|
15 |
+
common_voice_es_20725001 train female las grabaciones se extendieron hasta finales del mes de mayo corpus/speech/train/female/common_voice_es_20725001.flac
|
16 |
+
common_voice_es_20931278 train female entre las personas nombradas se encontraba carlos alberto lacoste corpus/speech/train/female/common_voice_es_20931278.flac
|
17 |
+
common_voice_es_20932253 train female hasta el presente ningún vehículo orbital reutilizable real se ha llegado a usar corpus/speech/train/female/common_voice_es_20932253.flac
|
18 |
+
common_voice_es_21469616 train male sus principales producciones fueron escritas para ser representadas ó cantadas corpus/speech/train/male/common_voice_es_21469616.flac
|
19 |
+
common_voice_es_21486095 train male permite eliminar los reflejos luminosos y obtener efectos con las sombras corpus/speech/train/male/common_voice_es_21486095.flac
|
20 |
+
common_voice_es_21543608 train male el número y clase de pájaros varía en cada nivel corpus/speech/train/male/common_voice_es_21543608.flac
|
21 |
+
common_voice_es_21580953 train male la parte norte del brocal es más irregular con una protuberancia hacia el norte noroeste corpus/speech/train/male/common_voice_es_21580953.flac
|
corpus/files/tars_dev.paths
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
corpus/speech/dev.tar.gz
|
corpus/files/tars_test.paths
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
corpus/speech/test.tar.gz
|
corpus/files/tars_train.paths
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
corpus/speech/train.tar.gz
|
corpus/speech/dev.tar.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0ca8794e3e4040107860c1318ff0fdec192e600efed33aa944c8178ecd712e4e
|
3 |
+
size 972680
|
corpus/speech/dev.tar.gz.lock
ADDED
File without changes
|
corpus/speech/test.tar.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6a1733fb9165f78c268196e8f62347a7c1b42a37bb0f0e0b002f4dc924d0a7c5
|
3 |
+
size 805431
|
corpus/speech/test.tar.gz.lock
ADDED
File without changes
|
corpus/speech/train.tar.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7f2e36769938a88c17f3f14c1ecce6bf2f8401a18a28faa2108b049f6d07d02d
|
3 |
+
size 1555654
|
corpus/speech/train.tar.gz.lock
ADDED
File without changes
|
toy_corpus_asr_es.py
ADDED
@@ -0,0 +1,143 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from collections import defaultdict
|
2 |
+
import os
|
3 |
+
import json
|
4 |
+
import csv
|
5 |
+
|
6 |
+
import datasets
|
7 |
+
|
8 |
+
_NAME="toy_corpus_asr_es"
|
9 |
+
_VERSION="1.0.0"
|
10 |
+
_AUDIO_EXTENSIONS=".flac"
|
11 |
+
|
12 |
+
_DESCRIPTION = """
|
13 |
+
An extremely small corpus of 40 audio files taken from Common Voice (es) with the objective of testing how to share datasets in Hugging Face.
|
14 |
+
"""
|
15 |
+
|
16 |
+
_CITATION = """
|
17 |
+
@misc{toy-corpus-asr-es,
|
18 |
+
title={Toy Corpus for ASR in Spanish.},
|
19 |
+
author={Hernandez Mena, Carlos Daniel},
|
20 |
+
year={2022},
|
21 |
+
url={https://huggingface.co/datasets/carlosdanielhernandezmena/toy_corpus_asr_es},
|
22 |
+
}
|
23 |
+
"""
|
24 |
+
|
25 |
+
_HOMEPAGE = "https://huggingface.co/datasets/carlosdanielhernandezmena/toy_corpus_asr_es"
|
26 |
+
|
27 |
+
_LICENSE = "CC-BY-4.0, See https://creativecommons.org/licenses/by/4.0/"
|
28 |
+
|
29 |
+
_BASE_DATA_DIR = "corpus/"
|
30 |
+
_METADATA_TRAIN = os.path.join(_BASE_DATA_DIR,"files","metadata_train.tsv")
|
31 |
+
_METADATA_TEST = os.path.join(_BASE_DATA_DIR,"files", "metadata_test.tsv")
|
32 |
+
_METADATA_DEV = os.path.join(_BASE_DATA_DIR,"files", "metadata_dev.tsv")
|
33 |
+
|
34 |
+
_TARS_TRAIN = os.path.join(_BASE_DATA_DIR,"files","tars_train.paths")
|
35 |
+
_TARS_TEST = os.path.join(_BASE_DATA_DIR,"files", "tars_test.paths")
|
36 |
+
_TARS_DEV = os.path.join(_BASE_DATA_DIR,"files", "tars_dev.paths")
|
37 |
+
|
38 |
+
class ToyCorpusAsrEsConfig(datasets.BuilderConfig):
|
39 |
+
"""BuilderConfig for Toy Corpus ASR ES."""
|
40 |
+
|
41 |
+
def __init__(self, name, **kwargs):
|
42 |
+
name=_NAME
|
43 |
+
super().__init__(name=name, **kwargs)
|
44 |
+
|
45 |
+
class ToyCorpusAsrEs(datasets.GeneratorBasedBuilder):
|
46 |
+
"""The Toy Corpus ASR ES dataset."""
|
47 |
+
|
48 |
+
VERSION = datasets.Version(_VERSION)
|
49 |
+
BUILDER_CONFIGS = [
|
50 |
+
ToyCorpusAsrEsConfig(
|
51 |
+
name=_NAME,
|
52 |
+
version=datasets.Version(_VERSION),
|
53 |
+
)
|
54 |
+
]
|
55 |
+
|
56 |
+
def _info(self):
|
57 |
+
features = datasets.Features(
|
58 |
+
{
|
59 |
+
"audio_id": datasets.Value("string"),
|
60 |
+
"audio": datasets.Audio(sampling_rate=16000),
|
61 |
+
"split": datasets.Value("string"),
|
62 |
+
"gender": datasets.Value("string"),
|
63 |
+
"normalized_text": datasets.Value("string"),
|
64 |
+
"relative_path": datasets.Value("string"),
|
65 |
+
}
|
66 |
+
)
|
67 |
+
return datasets.DatasetInfo(
|
68 |
+
description=_DESCRIPTION,
|
69 |
+
features=features,
|
70 |
+
homepage=_HOMEPAGE,
|
71 |
+
license=_LICENSE,
|
72 |
+
citation=_CITATION,
|
73 |
+
)
|
74 |
+
|
75 |
+
def _split_generators(self, dl_manager):
|
76 |
+
|
77 |
+
metadata_train=dl_manager.download_and_extract(_METADATA_TRAIN)
|
78 |
+
metadata_test=dl_manager.download_and_extract(_METADATA_TEST)
|
79 |
+
metadata_dev=dl_manager.download_and_extract(_METADATA_DEV)
|
80 |
+
|
81 |
+
tars_train=dl_manager.download_and_extract(_TARS_TRAIN)
|
82 |
+
tars_test=dl_manager.download_and_extract(_TARS_TEST)
|
83 |
+
tars_dev=dl_manager.download_and_extract(_TARS_DEV)
|
84 |
+
|
85 |
+
hash_tar_files=defaultdict(dict)
|
86 |
+
with open(tars_train,'r') as f:
|
87 |
+
hash_tar_files['train']=[path.replace('\n','') for path in f]
|
88 |
+
|
89 |
+
with open(tars_test,'r') as f:
|
90 |
+
hash_tar_files['test']=[path.replace('\n','') for path in f]
|
91 |
+
|
92 |
+
with open(tars_dev,'r') as f:
|
93 |
+
hash_tar_files['dev']=[path.replace('\n','') for path in f]
|
94 |
+
|
95 |
+
hash_meta_paths={"train":metadata_train,"test":metadata_test,"dev":metadata_dev}
|
96 |
+
audio_paths = dl_manager.download(hash_tar_files)
|
97 |
+
local_extracted_audio_paths = dl_manager.extract(audio_paths)
|
98 |
+
|
99 |
+
return [
|
100 |
+
datasets.SplitGenerator(
|
101 |
+
name=datasets.Split.TRAIN,
|
102 |
+
gen_kwargs={
|
103 |
+
"audio_archives":[dl_manager.iter_archive(archive) for archive in audio_paths["train"]],
|
104 |
+
"local_extracted_archives_paths": local_extracted_audio_paths["train"],
|
105 |
+
"metadata_paths": hash_meta_paths["train"],
|
106 |
+
}
|
107 |
+
),
|
108 |
+
datasets.SplitGenerator(
|
109 |
+
name=datasets.Split.VALIDATION,
|
110 |
+
gen_kwargs={
|
111 |
+
"audio_archives": [dl_manager.iter_archive(archive) for archive in audio_paths["dev"]],
|
112 |
+
"local_extracted_archives_paths": local_extracted_audio_paths["dev"],
|
113 |
+
"metadata_paths": hash_meta_paths["dev"],
|
114 |
+
}
|
115 |
+
),
|
116 |
+
datasets.SplitGenerator(
|
117 |
+
name=datasets.Split.TEST,
|
118 |
+
gen_kwargs={
|
119 |
+
"audio_archives": [dl_manager.iter_archive(archive) for archive in audio_paths["test"]],
|
120 |
+
"local_extracted_archives_paths": local_extracted_audio_paths["test"],
|
121 |
+
"metadata_paths": hash_meta_paths["test"],
|
122 |
+
}
|
123 |
+
),
|
124 |
+
]
|
125 |
+
|
126 |
+
def _generate_examples(self, audio_archives, local_extracted_archives_paths, metadata_paths):
|
127 |
+
|
128 |
+
features = ["normalized_text","gender","split","relative_path"]
|
129 |
+
|
130 |
+
with open(metadata_paths) as f:
|
131 |
+
metadata = {x["audio_id"]: x for x in csv.DictReader(f, delimiter="\t")}
|
132 |
+
|
133 |
+
for audio_archive, local_extracted_archive_path in zip(audio_archives, local_extracted_archives_paths):
|
134 |
+
for audio_filename, audio_file in audio_archive:
|
135 |
+
audio_id = audio_filename.split(os.sep)[-1].split(_AUDIO_EXTENSIONS)[0]
|
136 |
+
path = os.path.join(local_extracted_archive_path, audio_filename) if local_extracted_archive_path else audio_filename
|
137 |
+
|
138 |
+
yield audio_id, {
|
139 |
+
"audio_id": audio_id,
|
140 |
+
**{feature: metadata[audio_id][feature] for feature in features},
|
141 |
+
"audio": {"path": path},
|
142 |
+
}
|
143 |
+
|