serve.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:earmark 作者: lowerquality 项目源码 文件源码
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()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号