serve.py 文件源码

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

项目:earmark 作者: lowerquality 项目源码 文件源码
def onchange(self, sender, change_doc):
        update = False
        if change_doc.get("doc", {}).get("type") == "command":
            # Save kaldi-sequence from the text
            seq = metasentence.MetaSentence(change_doc["doc"].get("text", ""), vocab).get_kaldi_sequence()
            change_doc["doc"]["_ks"] = seq
            self._command_seqs[change_doc["id"]] = seq
            # Set "sender" to None so that all peers get a change update
            sender = None
            update = True
        elif change_doc["type"] == 'delete' and change_doc["id"] in self._command_seqs:
            del self._command_seqs[change_doc["id"]]
            update = True
        elif change_doc.get("doc", {}).get("type") == "audio-command":
            print 'got new audio command', change_doc['doc']
            self._pending_audio_commands.append(change_doc["doc"])

            self.subdir_resources['factory'].check_pending_audio_commands()

        minidb.DBFactory.onchange(self, sender, change_doc)

        if update:
            self.create_language_model()
            reactor.callInThread(
                self.subdir_resources['factory'].re_run_everything)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号