Update czech_parliament_plenary_hearings.py
Browse files
czech_parliament_plenary_hearings.py
CHANGED
@@ -63,25 +63,23 @@ class CzechParliamentPlenaryHearings(GeneratorBasedBuilder):
|
|
63 |
|
64 |
def _generate_examples(self, split, data_dir):
|
65 |
split_dir = os.path.join(data_dir, split)
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
audio_path = os.path.join(
|
76 |
-
folder_path, audio_file)
|
77 |
-
transcription_path = os.path.join(
|
78 |
-
folder_path, audio_file + '.trn')
|
79 |
-
transcription = open(
|
80 |
-
transcription_path).read().strip()
|
81 |
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
|
|
|
|
|
|
|
|
|
63 |
|
64 |
def _generate_examples(self, split, data_dir):
|
65 |
split_dir = os.path.join(data_dir, split)
|
66 |
+
for folder_name in os.listdir(split_dir):
|
67 |
+
folder_path = os.path.join(split_dir, folder_name)
|
68 |
+
if os.path.isdir(folder_path):
|
69 |
+
for audio_file in os.listdir(folder_path):
|
70 |
+
if audio_file.endswith('.wav'):
|
71 |
+
audio_path = os.path.join(folder_path, audio_file)
|
72 |
+
transcription_path = os.path.join(
|
73 |
+
folder_path, audio_file + '.trn')
|
74 |
+
transcription = open(transcription_path).read().strip()
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
|
76 |
+
audio, sr = librosa.load(audio_path, sr=16000)
|
77 |
+
id = f"{folder_name}/{audio_file}"
|
78 |
+
yield id, {
|
79 |
+
'id': id,
|
80 |
+
'audio': {
|
81 |
+
'path': audio_path,
|
82 |
+
'bytes': audio.tobytes()
|
83 |
+
},
|
84 |
+
'transcription': transcription,
|
85 |
+
}
|