Update jv_id_asr_split.py
#1
by
bryanjeshua
- opened
- jv_id_asr_split.py +36 -27
jv_id_asr_split.py
CHANGED
@@ -130,33 +130,42 @@ class JvIdASR(datasets.GeneratorBasedBuilder):
|
|
130 |
|
131 |
def _generate_examples(self, filepath: str):
|
132 |
tsv_file = os.path.join(filepath, "asr_javanese", "utt_spk_text.tsv")
|
|
|
|
|
|
|
|
|
|
|
133 |
with open(tsv_file, "r") as f:
|
134 |
-
|
135 |
-
for line in
|
136 |
audio_id, sp_id, text = line[0], line[1], line[2]
|
137 |
-
wav_path = os.path.join(filepath, "asr_javanese", "data", "{}
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
|
|
|
|
|
|
|
|
162 |
f.close()
|
|
|
130 |
|
131 |
def _generate_examples(self, filepath: str):
|
132 |
tsv_file = os.path.join(filepath, "asr_javanese", "utt_spk_text.tsv")
|
133 |
+
|
134 |
+
# Debugging: Cek apakah tsv_file ada
|
135 |
+
if not os.path.isfile(tsv_file):
|
136 |
+
raise FileNotFoundError(f"File tidak ditemukan: {tsv_file}")
|
137 |
+
|
138 |
with open(tsv_file, "r") as f:
|
139 |
+
tsv_reader = csv.reader(f, delimiter="\t")
|
140 |
+
for line in tsv_reader:
|
141 |
audio_id, sp_id, text = line[0], line[1], line[2]
|
142 |
+
wav_path = os.path.join(filepath, "asr_javanese", "data", "{}.flac".format(audio_id))
|
143 |
+
|
144 |
+
# Debugging: Cek apakah wav_path ada
|
145 |
+
if not os.path.isfile(wav_path):
|
146 |
+
print(f"File audio tidak ditemukan: {wav_path}")
|
147 |
+
continue
|
148 |
+
|
149 |
+
if self.config.schema == "source":
|
150 |
+
ex = {
|
151 |
+
"id": audio_id,
|
152 |
+
"speaker_id": sp_id,
|
153 |
+
"path": wav_path,
|
154 |
+
"audio": wav_path,
|
155 |
+
"text": text,
|
156 |
+
}
|
157 |
+
yield audio_id, ex
|
158 |
+
elif self.config.schema == "seacrowd_sptext":
|
159 |
+
ex = {
|
160 |
+
"id": audio_id,
|
161 |
+
"speaker_id": sp_id,
|
162 |
+
"path": wav_path,
|
163 |
+
"audio": wav_path,
|
164 |
+
"text": text,
|
165 |
+
"metadata": {
|
166 |
+
"speaker_age": None,
|
167 |
+
"speaker_gender": None,
|
168 |
+
},
|
169 |
+
}
|
170 |
+
yield audio_id, ex
|
171 |
f.close()
|