Update hyvoxpopuli.py
Browse files- hyvoxpopuli.py +4 -4
hyvoxpopuli.py
CHANGED
@@ -80,13 +80,13 @@ class Hyvoxpopuli(datasets.GeneratorBasedBuilder):
|
|
80 |
]
|
81 |
|
82 |
def _generate_examples(self, audio_archives, local_extracted_archives_paths, metadata_paths):
|
83 |
-
|
84 |
|
85 |
-
|
86 |
with open(meta_path) as f:
|
87 |
metadata = {x["id"]: x for x in csv.DictReader(f, delimiter="\t")}
|
88 |
|
89 |
-
for audio_archive, local_extracted_archive_path in zip(audio_archives, local_extracted_archives_paths):
|
90 |
for audio_filename, audio_file in audio_archive:
|
91 |
audio_id = audio_filename.split(os.sep)[-1].split(".wav")[0]
|
92 |
path = os.path.join(local_extracted_archive_path, audio_filename) if local_extracted_archive_path else audio_filename
|
@@ -95,4 +95,4 @@ class Hyvoxpopuli(datasets.GeneratorBasedBuilder):
|
|
95 |
"audio_id": audio_id,
|
96 |
**{feature: metadata[audio_id][feature] for feature in features},
|
97 |
"audio": {"path": path, "bytes": audio_file.read()},
|
98 |
-
}
|
|
|
80 |
]
|
81 |
|
82 |
def _generate_examples(self, audio_archives, local_extracted_archives_paths, metadata_paths):
|
83 |
+
features = ["raw_text", "normalized_text", "speaker_id", "gender", "is_gold_transcript", "accent"]
|
84 |
|
85 |
+
for split, meta_path in metadata_paths.items():
|
86 |
with open(meta_path) as f:
|
87 |
metadata = {x["id"]: x for x in csv.DictReader(f, delimiter="\t")}
|
88 |
|
89 |
+
for audio_archive, local_extracted_archive_path in zip(audio_archives[split], local_extracted_archives_paths[split]):
|
90 |
for audio_filename, audio_file in audio_archive:
|
91 |
audio_id = audio_filename.split(os.sep)[-1].split(".wav")[0]
|
92 |
path = os.path.join(local_extracted_archive_path, audio_filename) if local_extracted_archive_path else audio_filename
|
|
|
95 |
"audio_id": audio_id,
|
96 |
**{feature: metadata[audio_id][feature] for feature in features},
|
97 |
"audio": {"path": path, "bytes": audio_file.read()},
|
98 |
+
}
|