def sendResult(self, res, utt_idx, session_id):
utt_id = "utt-%s-%d" % (session_id, utt_idx)
# Update the preview doc
doc = self.db[utt_id]
#print 'got utt alignment'
doc[res["type"] + "_words"] = res["words"]
#del doc[res["type"]]
if 'duration' in res:
doc['duration'] = res['duration']
# having a duration also implies that the wave file is
# ready; import to the database
reactor.callInThread(self._put_attachment, doc)
else:
self.db.onchange(None, {"type": "change",
"id": utt_id,
"doc": doc})
# make sure "start" time is set on utterances
self.ensure_start_times(session_id)
self.check_pending_audio_commands()
评论列表
文章目录