default commonvoice py script, bn bundleurltemplate
Browse files- CommonVoiceBangla.py +24 -8
CommonVoiceBangla.py
CHANGED
@@ -18,7 +18,7 @@
|
|
18 |
import csv
|
19 |
import os
|
20 |
import urllib
|
21 |
-
|
22 |
import datasets
|
23 |
import requests
|
24 |
from datasets.utils.py_utils import size_str
|
@@ -37,7 +37,7 @@ _CITATION = """\
|
|
37 |
}
|
38 |
"""
|
39 |
|
40 |
-
_HOMEPAGE = "https://commonvoice.mozilla.org/
|
41 |
|
42 |
_LICENSE = "https://creativecommons.org/publicdomain/zero/1.0/"
|
43 |
|
@@ -71,7 +71,7 @@ class CommonVoiceConfig(datasets.BuilderConfig):
|
|
71 |
|
72 |
|
73 |
class CommonVoice(datasets.GeneratorBasedBuilder):
|
74 |
-
DEFAULT_CONFIG_NAME = "
|
75 |
DEFAULT_WRITER_BATCH_SIZE = 1000
|
76 |
|
77 |
BUILDER_CONFIGS = [
|
@@ -165,10 +165,6 @@ class CommonVoice(datasets.GeneratorBasedBuilder):
|
|
165 |
path_to_data = "/".join([bundle_version, self.config.name])
|
166 |
path_to_clips = "/".join([path_to_data, "clips"]) if path_to_data else "clips"
|
167 |
|
168 |
-
train_tsv="/".join([path_to_data, "train.tsv"])
|
169 |
-
os.remove(train_tsv)
|
170 |
-
shutil.move("train.tsv",train_tsv)
|
171 |
-
|
172 |
return [
|
173 |
datasets.SplitGenerator(
|
174 |
name=datasets.Split.TRAIN,
|
@@ -197,6 +193,26 @@ class CommonVoice(datasets.GeneratorBasedBuilder):
|
|
197 |
"path_to_clips": path_to_clips,
|
198 |
},
|
199 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
200 |
]
|
201 |
|
202 |
def _generate_examples(
|
@@ -241,4 +257,4 @@ class CommonVoice(datasets.GeneratorBasedBuilder):
|
|
241 |
# set path to None if the audio file doesn't exist locally (i.e. in streaming mode)
|
242 |
result["path"] = path if local_extracted_archive else None
|
243 |
|
244 |
-
yield path, result
|
|
|
18 |
import csv
|
19 |
import os
|
20 |
import urllib
|
21 |
+
|
22 |
import datasets
|
23 |
import requests
|
24 |
from datasets.utils.py_utils import size_str
|
|
|
37 |
}
|
38 |
"""
|
39 |
|
40 |
+
_HOMEPAGE = "https://commonvoice.mozilla.org/en/datasets"
|
41 |
|
42 |
_LICENSE = "https://creativecommons.org/publicdomain/zero/1.0/"
|
43 |
|
|
|
71 |
|
72 |
|
73 |
class CommonVoice(datasets.GeneratorBasedBuilder):
|
74 |
+
DEFAULT_CONFIG_NAME = "en"
|
75 |
DEFAULT_WRITER_BATCH_SIZE = 1000
|
76 |
|
77 |
BUILDER_CONFIGS = [
|
|
|
165 |
path_to_data = "/".join([bundle_version, self.config.name])
|
166 |
path_to_clips = "/".join([path_to_data, "clips"]) if path_to_data else "clips"
|
167 |
|
|
|
|
|
|
|
|
|
168 |
return [
|
169 |
datasets.SplitGenerator(
|
170 |
name=datasets.Split.TRAIN,
|
|
|
193 |
"path_to_clips": path_to_clips,
|
194 |
},
|
195 |
),
|
196 |
+
datasets.SplitGenerator(
|
197 |
+
name="other",
|
198 |
+
gen_kwargs={
|
199 |
+
"local_extracted_archive": local_extracted_archive,
|
200 |
+
"archive_iterator": dl_manager.iter_archive(archive_path),
|
201 |
+
"metadata_filepath": "/".join([path_to_data, "other.tsv"]) if path_to_data else "other.tsv",
|
202 |
+
"path_to_clips": path_to_clips,
|
203 |
+
},
|
204 |
+
),
|
205 |
+
datasets.SplitGenerator(
|
206 |
+
name="invalidated",
|
207 |
+
gen_kwargs={
|
208 |
+
"local_extracted_archive": local_extracted_archive,
|
209 |
+
"archive_iterator": dl_manager.iter_archive(archive_path),
|
210 |
+
"metadata_filepath": "/".join([path_to_data, "invalidated.tsv"])
|
211 |
+
if path_to_data
|
212 |
+
else "invalidated.tsv",
|
213 |
+
"path_to_clips": path_to_clips,
|
214 |
+
},
|
215 |
+
),
|
216 |
]
|
217 |
|
218 |
def _generate_examples(
|
|
|
257 |
# set path to None if the audio file doesn't exist locally (i.e. in streaming mode)
|
258 |
result["path"] = path if local_extracted_archive else None
|
259 |
|
260 |
+
yield path, result
|