Commit ·
8c8c9ab
1
Parent(s): 0ed9fb0
fix generator script
Browse files- transcribed_calls.py +2 -6
transcribed_calls.py
CHANGED
|
@@ -71,19 +71,15 @@ class TranscribedCalls(datasets.GeneratorBasedBuilder):
|
|
| 71 |
def _generate_examples(self, metadata_path, local_extracted_archive, audio_files, split):
|
| 72 |
print(f"generating examples for split {split}")
|
| 73 |
with open(metadata_path) as f:
|
| 74 |
-
for _ in range(5):
|
| 75 |
-
print(next(f))
|
| 76 |
metadata_reader = csv.reader(f)
|
| 77 |
# skip headers
|
| 78 |
print(next(metadata_reader))
|
| 79 |
-
for (
|
| 80 |
-
print(f"processing row {row}")
|
| 81 |
-
id_, example_split, words, phonemes = row
|
| 82 |
if example_split != split:
|
| 83 |
continue
|
| 84 |
|
| 85 |
audio_path = os.path.join(local_extracted_archive, audio_path) if local_extracted_archive else audio_path
|
| 86 |
-
yield
|
| 87 |
"audio": {"path": audio_path, "bytes": audio_file.read()},
|
| 88 |
"path": audio_path,
|
| 89 |
"words": words,
|
|
|
|
| 71 |
def _generate_examples(self, metadata_path, local_extracted_archive, audio_files, split):
|
| 72 |
print(f"generating examples for split {split}")
|
| 73 |
with open(metadata_path) as f:
|
|
|
|
|
|
|
| 74 |
metadata_reader = csv.reader(f)
|
| 75 |
# skip headers
|
| 76 |
print(next(metadata_reader))
|
| 77 |
+
for ((id_, example_split, words, phonemes), (audio_path, audio_file)) in zip(metadata_reader, audio_files):
|
|
|
|
|
|
|
| 78 |
if example_split != split:
|
| 79 |
continue
|
| 80 |
|
| 81 |
audio_path = os.path.join(local_extracted_archive, audio_path) if local_extracted_archive else audio_path
|
| 82 |
+
yield id_, {
|
| 83 |
"audio": {"path": audio_path, "bytes": audio_file.read()},
|
| 84 |
"path": audio_path,
|
| 85 |
"words": words,
|