Datasets:
Make `path` valid file path in non-streaming mode
#9
by
mariosasko
- opened
- common_voice_11_0.py +4 -6
common_voice_11_0.py
CHANGED
@@ -186,14 +186,12 @@ class CommonVoice(datasets.GeneratorBasedBuilder):
|
|
186 |
metadata[row["path"]] = row
|
187 |
|
188 |
for i, audio_archive in enumerate(archives):
|
189 |
-
for
|
190 |
-
_, filename = os.path.split(
|
191 |
if filename in metadata:
|
192 |
result = dict(metadata[filename])
|
193 |
# set the audio feature and the path to the extracted file
|
194 |
-
path = os.path.join(local_extracted_archive_paths[i],
|
195 |
result["audio"] = {"path": path, "bytes": file.read()}
|
196 |
-
|
197 |
-
result["path"] = path if local_extracted_archive_paths else filename
|
198 |
-
|
199 |
yield path, result
|
|
|
186 |
metadata[row["path"]] = row
|
187 |
|
188 |
for i, audio_archive in enumerate(archives):
|
189 |
+
for path, file in audio_archive:
|
190 |
+
_, filename = os.path.split(path)
|
191 |
if filename in metadata:
|
192 |
result = dict(metadata[filename])
|
193 |
# set the audio feature and the path to the extracted file
|
194 |
+
path = os.path.join(local_extracted_archive_paths[i], path) if local_extracted_archive_paths else path
|
195 |
result["audio"] = {"path": path, "bytes": file.read()}
|
196 |
+
result["path"] = path
|
|
|
|
|
197 |
yield path, result
|