def re_run(self, utt):
if 'wavpath' not in utt:
return
k = Kaldi(
get_resource('data/nnet_a_gpu_online'),
self.gen_hclg_filename,
get_resource('PROTO_LANGDIR'))
audio = numm3.sound2np(
os.path.join(self.resources['attach'].attachdir, utt['wavpath']),
nchannels=1,
R=8000)
k.push_chunk(audio.tostring())
wds = k.get_final()
k.stop()
for wd in wds:
del wd['phones']
utt['command_words'] = wds
utt['command'] = ' '.join([X['word'] for X in wds])
reactor.callFromThread(self.db.onchange, None, {"type": "change",
"id": utt["_id"],
"doc": utt})
评论列表
文章目录