Datasets:
carlosdanielhernandezmena
commited on
Adding the train split
Browse files
commonvoice_benchmark_catalan_accents.py
CHANGED
@@ -29,6 +29,8 @@ _LICENSE = "CC-BY-4.0, See https://creativecommons.org/licenses/by/4.0/"
|
|
29 |
|
30 |
_BASE_DATA_DIR = "corpus/"
|
31 |
|
|
|
|
|
32 |
_METADATA_BALEARIC_FEM = os.path.join(_BASE_DATA_DIR,"files","balearic_female.tsv")
|
33 |
_METADATA_BALEARIC_MALE = os.path.join(_BASE_DATA_DIR,"files","balearic_male.tsv")
|
34 |
|
@@ -104,6 +106,8 @@ class CommonVoiceBenchmarkCatalanAccents(datasets.GeneratorBasedBuilder):
|
|
104 |
|
105 |
def _split_generators(self, dl_manager):
|
106 |
|
|
|
|
|
107 |
metadata_balearic_fem=dl_manager.download_and_extract(_METADATA_BALEARIC_FEM)
|
108 |
metadata_balearic_male=dl_manager.download_and_extract(_METADATA_BALEARIC_MALE)
|
109 |
|
@@ -122,6 +126,9 @@ class CommonVoiceBenchmarkCatalanAccents(datasets.GeneratorBasedBuilder):
|
|
122 |
tars_repo=dl_manager.download_and_extract(_TARS_REPO)
|
123 |
|
124 |
hash_tar_files=defaultdict(dict)
|
|
|
|
|
|
|
125 |
|
126 |
with open(tars_repo,'r') as f:
|
127 |
hash_tar_files['balearic_fem']=[path.replace('\n','') for path in f]
|
@@ -148,7 +155,8 @@ class CommonVoiceBenchmarkCatalanAccents(datasets.GeneratorBasedBuilder):
|
|
148 |
with open(tars_repo,'r') as f:
|
149 |
hash_tar_files['valencian_male']=[path.replace('\n','') for path in f]
|
150 |
|
151 |
-
hash_meta_paths={"
|
|
|
152 |
"balearic_male":metadata_balearic_male,
|
153 |
"central_female":metadata_central_female,
|
154 |
"central_male":metadata_central_male,
|
@@ -161,7 +169,7 @@ class CommonVoiceBenchmarkCatalanAccents(datasets.GeneratorBasedBuilder):
|
|
161 |
|
162 |
audio_paths = dl_manager.download(hash_tar_files)
|
163 |
|
164 |
-
splits=["balearic_fem","balearic_male","central_female","central_male","northern_female",
|
165 |
"northern_male","northwestern_female","northwestern_male","valencian_female","valencian_male"]
|
166 |
local_extracted_audio_paths = (
|
167 |
dl_manager.extract(audio_paths) if not dl_manager.is_streaming else
|
@@ -171,6 +179,14 @@ class CommonVoiceBenchmarkCatalanAccents(datasets.GeneratorBasedBuilder):
|
|
171 |
)
|
172 |
|
173 |
return [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
174 |
datasets.SplitGenerator(
|
175 |
name="balearic_fem",
|
176 |
gen_kwargs={
|
|
|
29 |
|
30 |
_BASE_DATA_DIR = "corpus/"
|
31 |
|
32 |
+
_METADATA_TRAIN = os.path.join(_BASE_DATA_DIR,"files","train.tsv")
|
33 |
+
|
34 |
_METADATA_BALEARIC_FEM = os.path.join(_BASE_DATA_DIR,"files","balearic_female.tsv")
|
35 |
_METADATA_BALEARIC_MALE = os.path.join(_BASE_DATA_DIR,"files","balearic_male.tsv")
|
36 |
|
|
|
106 |
|
107 |
def _split_generators(self, dl_manager):
|
108 |
|
109 |
+
metadata_train=dl_manager.download_and_extract(_METADATA_TRAIN)
|
110 |
+
|
111 |
metadata_balearic_fem=dl_manager.download_and_extract(_METADATA_BALEARIC_FEM)
|
112 |
metadata_balearic_male=dl_manager.download_and_extract(_METADATA_BALEARIC_MALE)
|
113 |
|
|
|
126 |
tars_repo=dl_manager.download_and_extract(_TARS_REPO)
|
127 |
|
128 |
hash_tar_files=defaultdict(dict)
|
129 |
+
|
130 |
+
with open(tars_repo,'r') as f:
|
131 |
+
hash_tar_files['train']=[path.replace('\n','') for path in f]
|
132 |
|
133 |
with open(tars_repo,'r') as f:
|
134 |
hash_tar_files['balearic_fem']=[path.replace('\n','') for path in f]
|
|
|
155 |
with open(tars_repo,'r') as f:
|
156 |
hash_tar_files['valencian_male']=[path.replace('\n','') for path in f]
|
157 |
|
158 |
+
hash_meta_paths={"train":metadata_train,
|
159 |
+
"balearic_fem":metadata_balearic_fem,
|
160 |
"balearic_male":metadata_balearic_male,
|
161 |
"central_female":metadata_central_female,
|
162 |
"central_male":metadata_central_male,
|
|
|
169 |
|
170 |
audio_paths = dl_manager.download(hash_tar_files)
|
171 |
|
172 |
+
splits=["train","balearic_fem","balearic_male","central_female","central_male","northern_female",
|
173 |
"northern_male","northwestern_female","northwestern_male","valencian_female","valencian_male"]
|
174 |
local_extracted_audio_paths = (
|
175 |
dl_manager.extract(audio_paths) if not dl_manager.is_streaming else
|
|
|
179 |
)
|
180 |
|
181 |
return [
|
182 |
+
datasets.SplitGenerator(
|
183 |
+
name="train",
|
184 |
+
gen_kwargs={
|
185 |
+
"audio_archives":[dl_manager.iter_archive(archive) for archive in audio_paths["train"]],
|
186 |
+
"local_extracted_archives_paths": local_extracted_audio_paths["train"],
|
187 |
+
"metadata_paths": hash_meta_paths["train"],
|
188 |
+
}
|
189 |
+
),
|
190 |
datasets.SplitGenerator(
|
191 |
name="balearic_fem",
|
192 |
gen_kwargs={
|