INNER CODE UNIT · Python
get_speakers
flashlight/wav2letter · data/ami/utils.py:80
def get_speakers(train_file):
cache = {}
all_speakers = []
with open(train_file) as f:
for line in f:
spl = line.split()
speaker_id = spl[0].split("_")[2]
gender = speaker_id[0]
if gender not in ["M", "F"]:
continue
if speaker_id not in cache:
cache[speaker_id] = 1
speaker = Speaker(id=speaker_id, gender=gender)
all_speakers.append(speaker)
return all_speakers
def get_fid2length(train_file):