Esempio n. 1
0
    def getskills(self, intent, text, tok):

        s = skills()
        m = xlMusic()
        if intent == 'clock':
            clock.start(tok)
        elif intent == 'camera':
            camera.start(tok)
        elif intent == 'smarthome':
            smarthome.start(tok)
        elif intent == 'weather':
            weather.start(tok)
        elif intent == 'music':
            m.start(tok)
        elif intent == 'translate':
            ts.start(tok)
        elif intent == 'email':
            mail.start(tok)
        elif intent == 'joke':
            joke.start(tok)
        elif intent == 'news':
            news.start(tok)
        elif intent == 'express':
            express.start(tok)
        elif intent == 'reintent':
            nlu.do_intent(text, tok)
        elif intent == 'no':
            speaker.speacilrecorder()
        else:
            nlu.do_intent(text, tok)
Esempio n. 2
0
    def __init__(self):

        self.awaken = Xiaolan.awaken()
        self.selfset = setting.setting()
        self.r = recorder()
        self.bt = baidu_tts()
        self.yt = youdao_tts()
        self.bs = baidu_stt(1, 2, 3, 4)
        self.sk = Skills()
        self.sm = hass()
        self.mu = xlMusic()
        self.ma = maps()
        self.xlnlu = Nlu()
        self.tok = bt.get_token()
Esempio n. 3
0
def do_intent(text, tok):

    sm = hass()
    m = xlMusic()
    services = {
        'musicurl_get': 'method=baidu.ting.song.play&songid=',
        'search': 'method=baidu.ting.search.catalogSug&query=',
        'hot':
        'method=baidu.ting.song.getRecommandSongList&song_id=877578&num=12'
    }

    if text != None:
        if '闹钟' in text:
            intent = 'clock'
            return intent
        elif '打开' in text:
            cortolthings = text[6:-2]
            print cortolthings
            cortolmode = 'turn_on'
            sm.cortol(cortolmode, cortolthings, tok)
        elif '关闭' in text:
            cortolthings = text[6:-2]
            cortolmode = 'turn_off'
            sm.cortol(cortolmode, cortolthings, tok)
        elif '天气' in text:
            intent = 'weather'
            return intent
        elif '重新说' in text or '重复' in text:
            intent = 'respeaker'
            return intent
        elif '翻译' in text:
            intent = 'translate'
            return intent
        elif '搜索' in text:
            intent = 'ser'
            return intent
        elif '闲聊' in text:
            intent = 'tuling'
            return intent
        elif '怎么走' in text:
            intent = 'map'
            return intent
        elif '酒店' in text:
            intent = 'hotel'
            return intent
        elif '旅游' in text:
            intent = 'travel'
            return intent
        elif '做游戏' in text:
            intent = 'minigame'
            return intent
        elif '新闻' in text:
            intent = 'news'
            return intent
        elif '拍照' in text:
            intent = 'camera'
            return intent
        elif '邮件' in text or '邮件助手' in text:
            intent = 'mail'
            return intent
        elif '快递' in text:
            intent = 'experss'
            return intent
        elif '笑话' in text:
            intent = 'joke'
            return intent
        elif '训练' in text:
            intent = 'snowboytrain'
            return intent
        elif '播放' in text:
            if '音乐' in text:
                m.sui_ji(services, tok)
            else:
                songname = text[2:-1]
                m.sou_suo(services, songname, tok)
        elif '我想听' in text:
            if '音乐' in text:
                m.sui_ji(services, tok)
            else:
                songname = text[3:-1]
                m.sou_suo(services, songname, tok)
        else:
            intent = 'tuling'
            return intent
    else:
        intent = 'no'
        return intent
Esempio n. 4
0
def do_intent(text, tok=""):
    sm = hass()
    m = xlMusic()
    services = {'musicurl_get': 'method=baidu.ting.song.play&songid=', 'search': 'method=baidu.ting.search.catalogSug&query=', 'hot': 'method=baidu.ting.song.getRecommandSongList&song_id=877578&num=12'}
    if text is not None:

        if '闹钟' in text:
                intent = 'clock'
                return intent
        elif '打开' in text:
                cortolthings = text[6:-2]
                print cortolthings
                cortolmode = 'turn_on'
                sm.cortol(cortolthings, cortolmode, tok)
        elif '关闭' in text:
                cortolthings = text[6:-2]
                cortolmode = 'turn_off'
                sm.cortol(cortolthings, cortolmode, tok)
        elif '天气' in text:
                intent = 'weather'
                return intent
        elif '重新说' in text or '重复' in text:
                intent = 'respeaker'
                return intent
        elif '翻译' in text:
                intent = 'translate'
                return intent
        elif '搜索' in text:
                intent = 'ser'
                return intent
        elif '闲聊' in text:
                intent = 'tuling'
                return intent
        elif '关机' in text:
                print ('SHUTDOWING...')
                os.system('sudo poweroff')
        elif '重启' in text:
                print ('REBOOTING...')
                os.system('sudo reboot')
        elif '怎么走' in text:
                intent = 'map'
                return intent
        elif '酒店' in text:
                intent = 'hotel'
                return intent
        elif '旅游' in text:
                intent = 'travel'
                return intent
        elif '做游戏' in text:
                intent = 'minigame'
                return intent
        elif '新闻' in text:
                intent = 'news'
                return intent
        elif '傻逼' in text:
                speaker.falu()
        elif '拍照' in text:
                intent = 'camera'
                return intent
        elif '邮件' in text or '邮件助手' in text:
                intent = 'mail'
                return intent
        elif '快递' in text:
                intent = 'experss'
                return intent
        elif '笑话' in text:
                intent = 'joke'
                return intent
        elif '训练' in text:
                intent= 'snowboytrain'
                return intent
        elif '播放' in text:
            if '音乐' in text:
                m.sui_ji(services, tok)
            else:
                songname = text[2:-1]
                m.sou_suo(services, songname, tok)
        elif "你知道我们现在在哪里" in text:
            baidu_tts().tts("我们现在在《中国少年说》的舞台上,如果我没记错的话,你回深圳的飞机票还没有买吧?", tok)
        elif "你要帮我买" in text:
            baidu_tts().tts("我可没有你的账户,但是我可以帮你查一下从北京到深圳的航班哦", tok)
            return "flight"
        elif '我想听' in text:
            if '音乐' in text:
                m.sui_ji(services, tok)
            else:
                songname = text[3:-1]
                m.sou_suo(services, songname, tok)
        else:
                tuling.start(text, tok)
    else:
        intent = 'no'
        return intent
Esempio n. 5
0
def do_intent(text, tok):

    sm = hass()
    m = xlMusic()
    services = {
        'musicurl_get': 'method=baidu.ting.song.play&songid=',
        'search': 'method=baidu.ting.search.catalogSug&query=',
        'hot':
        'method=baidu.ting.song.getRecommandSongList&song_id=877578&num=12'
    }

    if text != None:
        if '闹钟' in text:
            clock.start(tok)
        elif '打开' in text:
            sm.cortol('turn_on', text[6:-1], tok)
        elif '关闭' in text:
            sm.cortol('turn_off', text[6:-1], tok)
        elif '获取' in text:
            if '传感器' in text or '温度' in text:
                sm.sensor('sensor', text[6:-1], tok)
            elif '湿度' in text:
                sm.sensor('sensor', text[6:-1], tok)
            else:
                sm.sensor('switch', text[6:-1], tok)
        elif '天气' in text:
            weather.main(tok)
        elif '重新说' in text or '重复' in text:
            speaker.speak()
        elif '翻译' in text:
            ts.main(tok)
        elif '搜索' in text:
            tuling.main(text, tok)
        elif '闲聊' in text:
            tuling.main(text, tok)
        elif '怎么走' in text:
            maps.start(tok)
        elif '酒店' in text:
            tuling.main(text, tok)
        elif '旅游' in text:
            tuling.main(text, tok)
        elif '新闻' in text:
            news.start(tok)
        elif '拍照' in text:
            camera.start(tok)
        elif '邮件' in text or '邮件助手' in text:
            mail.start(tok)
        elif '快递' in text:
            express.start(tok)
        elif '笑话' in text:
            joke.main(tok)
        elif '训练' in text:
            snowboytrain.start(tok)
        elif '播放' in text:
            if '音乐' in text:
                m.sui_ji(services, tok)
            else:
                songname = text[2:-1]
                m.sou_suo(services, songname, tok)
        elif '我想听' in text:
            if '音乐' in text:
                m.sui_ji(services, tok)
            else:
                songname = text[3:-1]
                m.sou_suo(services, songname, tok)
        else:
            tuling.start(text, tok)
    else:
        speaker.speacilrecorder()