def fetch_fruitspeech_softmax():
fs, d, wav_names = fetch_sample_speech_fruit()
def matcher(name):
return name.split("/")[1]
classes = [matcher(wav_name) for wav_name in wav_names]
all_chars = [c for c in sorted(list(set("".join(classes))))]
char2code = {v: k for k, v in enumerate(all_chars)}
vocabulary_size = len(char2code.keys())
y = []
for n, cl in enumerate(classes):
y.append(tokenize_ind(cl, char2code))
# Is it kosher to kmeans on all the data?
X, _apply, _re = apply_lpc_softmax_preproc(d)
"""
for n, Xi in enumerate(X[::8]):
di = _re(Xi)
wavfile.write("t_%i.wav" % n, fs, soundsc(di))
raise ValueError()
"""
speech = {}
speech["vocabulary_size"] = vocabulary_size
speech["vocabulary"] = char2code
speech["sample_rate"] = fs
speech["data"] = X
speech["target"] = y
speech["reconstruct"] = _re
return speech
评论列表
文章目录