예제 #1
0
def wakeUp(self):
    print 'Waiting to be waked up'
    cacheAudio = Audio.startAccord(self)
    status, txt = BD.audio2txt(self, cacheAudio)
    if status:
        print "you have said:%s" % (txt)
        if txt in self.wakeUpIns:
            BD.txt2audio(self, '您好, 有什么可以帮助的吗')
            return 1
    return -1
예제 #2
0
def listen(self, times=90):
    print 'I\'m listening.....'
    cacheAudio = Audio.startAccord(self, times)
    if not cacheAudio:
        return False
    status, txt = BD.audio2txt(self, cacheAudio)

    if status == 1:
        print txt
        if txt in ExitIns:
            BD.txt2audio(self, '即将退出')
            exit()
        response = TuLing.getTuLingRes(self, txt)
    else:
        response = txt
    BD.txt2audio(self, response)
    return True