INNER CODE UNIT · Python
parse_speakers_gender
flashlight/wav2letter · data/librispeech/utils.py:25
def parse_speakers_gender(spk_file):
ret = {}
with open(spk_file, "r") as f:
for line in f:
if line.startswith(";"):
continue
sample_id, gen, _ = line.split("|", 2)
ret[sample_id.strip()] = gen.strip()
return ret
def transcript_to_list(file):
audio_path = os.path.dirname(file)
ret = []
with open(file, "r") as f:
for line in f:
file_id, trans = line.strip().split(" ", 1)
audio_file = os.path.abspath(os.path.join(audio_path, file_id + ".flac"))