Datasets:
Modalities:
Text
Size:
10K - 100K
dvoice-darija4
Browse files- dvoice-darija.py +1 -28
dvoice-darija.py
CHANGED
@@ -61,31 +61,4 @@ class CommonVoice(datasets.GeneratorBasedBuilder):
|
|
61 |
description=description,
|
62 |
features=features,
|
63 |
supervised_keys=None,
|
64 |
-
)
|
65 |
-
|
66 |
-
def _generate_examples(self, local_extracted_archive_paths, archives, meta_path):
|
67 |
-
data_fields = list(self._info().features.keys())
|
68 |
-
metadata = {}
|
69 |
-
with open(meta_path, encoding="utf-8") as f:
|
70 |
-
reader = csv.DictReader(f, delimiter="\t", quoting=csv.QUOTE_NONE)
|
71 |
-
for row in tqdm(reader, desc="Reading metadata..."):
|
72 |
-
if not row["path"].endswith(".wav"):
|
73 |
-
row["path"] += ".wav"
|
74 |
-
# accent -> accents in CV 8.0alues
|
75 |
-
for field in data_fields:
|
76 |
-
if field not in row:
|
77 |
-
row[field] = ""
|
78 |
-
metadata[row["path"]] = row
|
79 |
-
|
80 |
-
for i, audio_archive in enumerate(archives):
|
81 |
-
for filename, file in audio_archive:
|
82 |
-
_, filename = os.path.split(filename)
|
83 |
-
if filename in metadata:
|
84 |
-
result = dict(metadata[filename])
|
85 |
-
# set the audio feature and the path to the extracted file
|
86 |
-
path = os.path.join(local_extracted_archive_paths[i], filename) if local_extracted_archive_paths else filename
|
87 |
-
result["audio"] = {"path": path, "bytes": file.read()}
|
88 |
-
# set path to None if the audio file doesn't exist locally (i.e. in streaming mode)
|
89 |
-
result["path"] = path if local_extracted_archive_paths else filename
|
90 |
-
|
91 |
-
yield path, result
|
|
|
61 |
description=description,
|
62 |
features=features,
|
63 |
supervised_keys=None,
|
64 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|