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)
def getskills(self, intent, text, tok): 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': music.start(tok) elif intent == 'mail': mail.start(tok) elif intent == 'joke': joke.start(tok) elif intent == 'news': news.start(tok) elif intent == 'tuling': tuling.start(text, tok) elif intent == 'snowboytrain': snowboytrain.start(tok) elif intent == 'raspberrypi-gpio': raspberrypigpio.start(tok) elif intent == 'respeaker': speaker.speak() elif intent == 'no': sconvenstation() elif intent == 'reintent': intent = nlp.do_intent(text, tok) s.getskills(intent, text, tok)
def main(): init_logging(MAIN_CONFIGURATION) (source_screen_names, polling_interval, names, ckey, csecret, akey, asecret, dry_run) = load_configuration(MAIN_CONFIGURATION) logging.info(u"source_screen_names:<{}> polling_interval:<{}>" .format(source_screen_names, polling_interval)) logging.info(u"names:<{}>".format(names)) logging.info(u"ck:{} cs:{} ak:{} as:{}".format(ckey, csecret, akey, csecret)) news.start(source_screen_names, polling_interval, names, ckey, csecret, akey, asecret, dry_run)
def __init__(self): self.skillsdef = { 'weather': ['weather', weather.start()], 'clock': ['clock', clock.start()], 'joke': ['joke', joke.start()], 'smarthome': ['smarthome', self.sm.main()], 'news': ['news', news.start()]
class skills(Xiaolan): def __init__(self): self.skillsdef = { 'weather': weather.start(), 'clock': clock.start(), 'joke': joke.start(), 'smarthome': self.sm.main(), 'news': news.start() }
REMOTE_SERVER = "www.google.com" speakmodule.wifi() rand = ['We are connected'] speakmodule.speak(rand, n, mixer) if ('.com') in message or ('.net') in message or('.org') in message: rand = ['Opening' + message] Chrome = ("C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s") speakmodule.speak(rand, n, mixer) webbrowser.get(Chrome).open('http://www.'+message) print ('') if('news') in message or ('neus') in message or ('nyus') in message: rand = ['Fetching the latest india and world news'] speakmodule.speak(rand, n, mixer) news.start() if ('stock') in message or ('stok') in message: rand = ['Fetching wall street data'] speakmodule.speak(rand, n, mixer) news.stockmkt() if ('google maps') in message: query = message stopwords = ['google', 'maps'] querywords = query.split() resultwords = [word for word in querywords if word.lower() not in stopwords] result = ' '.join(resultwords) Chrome = ("C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s") webbrowser.get(Chrome).open("https://www.google.be/maps/place/"+result+"/") rand = [result+'on google maps']
def news(self, tok): news.start(tok)
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()