Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions examples/audio/transformer_asr.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
- [LJSpeech Dataset](https://keithito.com/LJ-Speech-Dataset/)
"""


import re
import os

os.environ["KERAS_BACKEND"] = "tensorflow"
Expand Down Expand Up @@ -289,6 +289,8 @@ def generate(self, source, target_start_token_idx):
takes ~5 minutes for the extraction of files.
"""

pattern_wav_name = re.compile(r'([^/\\\.]+)')

keras.utils.get_file(
os.path.join(os.getcwd(), "data.tar.gz"),
"https://data.keithito.com/data/speech/LJSpeech-1.1.tar.bz2",
Expand All @@ -313,7 +315,7 @@ def get_data(wavs, id_to_text, maxlen=50):
"""returns mapping of audio paths and transcription texts"""
data = []
for w in wavs:
id = w.split("/")[-1].split(".")[0]
id = pattern_wav_name.split(test)[-4]
if len(id_to_text[id]) < maxlen:
data.append({"audio": w, "text": id_to_text[id]})
return data
Expand Down
Loading