marveleverthard
commited on
Update jv_id_asr_split.py
Browse files- jv_id_asr_split.py +2 -8
jv_id_asr_split.py
CHANGED
@@ -142,17 +142,11 @@ class JvIdASR(datasets.GeneratorBasedBuilder):
|
|
142 |
tsv_file = os.path.join(filepath, "asr_javanese", "utt_spk_text.tsv")
|
143 |
print(f"Looking for TSV file: {tsv_file}")
|
144 |
with open(tsv_file, "r") as f:
|
145 |
-
|
146 |
-
for line in
|
147 |
audio_id, sp_id, text = line[0], line[1], line[2]
|
148 |
wav_path = os.path.join(filepath, "asr_javanese", "data", "{}".format(audio_id[:2]), "{}.flac".format(audio_id))
|
149 |
|
150 |
-
if not os.path.exists(tsv_file):
|
151 |
-
print(f"TSV file not found at: {tsv_file}")
|
152 |
-
return
|
153 |
-
|
154 |
-
print(f"Yielding example: {audio_id}, {sp_id}, {wav_path}, {text}")
|
155 |
-
|
156 |
if os.path.exists(wav_path):
|
157 |
if self.config.schema == "source":
|
158 |
ex = {
|
|
|
142 |
tsv_file = os.path.join(filepath, "asr_javanese", "utt_spk_text.tsv")
|
143 |
print(f"Looking for TSV file: {tsv_file}")
|
144 |
with open(tsv_file, "r") as f:
|
145 |
+
tsv_reader = csv.reader(f, delimiter="\t")
|
146 |
+
for line in tsv_reader:
|
147 |
audio_id, sp_id, text = line[0], line[1], line[2]
|
148 |
wav_path = os.path.join(filepath, "asr_javanese", "data", "{}".format(audio_id[:2]), "{}.flac".format(audio_id))
|
149 |
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
if os.path.exists(wav_path):
|
151 |
if self.config.schema == "source":
|
152 |
ex = {
|