Datasets:
mariosasko
commited on
Commit
•
23b4059
1
Parent(s):
e095840
Make `path` valid file path in non-streaming mode (#9)
Browse files- Make `path` valid file path in non-streaming mode (a1c4251fa6e60b748424e710c5add1f13829b6c9)
- 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
|