numeric_level = getattr(logging, args.loglevel.upper(), None) FORMAT = '%(asctime)-15s %(levelname)s - %(name)s - %(message)s' logging.basicConfig(format=FORMAT,level=numeric_level) logger = logging.getLogger('wAlpha') logger.debug("__main__: Starting ervers: %s ",Version) # Read Configurations yaml config file yconfig = readyaml(ymlfile) logger.info("main - yaml read [\033[0;32mOK\033[0m] %s " ,yconfig['pyvonna']['user_key']) logger.info("main - yaml read [\033[0;32mOK\033[0m] %s " ,yconfig['pyvonna']['cert_key']) logger.info("main - yaml read [\033[0;32mOK\033[0m] %s " ,yconfig['translate']['google_api_key']) logger.info("main - yaml read [\033[0;32mOK\033[0m] %s " ,yconfig['wolframalpha']['alpha_api_key']) #exit(0) v = pyvona.create_voice(yconfig['pyvonna']['user_key'], yconfig['pyvonna']['cert_key']) v.voice_name = 'Astrid' q_message = alphaquest() #print (q_message) trans = translator_class.translator(yconfig['translate']['google_api_key']) testout = trans.svtoen(q_message) print (testout) alphao = walpha_question_class.alpha(yconfig['wolframalpha']['alpha_api_key']) eanswer = alphao.ask(testout) print (eanswer) sanswer = trans.entosv(eanswer) v.speak(sanswer)
logger.info("main - yaml read [\033[0;32mOK\033[0m] %s " ,yconfig['pyvonna']['cert_key']) # Create the kernel and learn AIML files kernel = aiml.Kernel() kernel.learn("../etc/std-alpha.xml") kernel.respond("load aiml t") if yconfig['bot']['alice']: alicekernel = aiml.Kernel() alicekernel.learn("../etc/std-alice.xml") alicekernel.respond("load aiml alice") if yconfig['bot']['translate']: translate = translator_class.translator(yconfig['translate']['api_key'],yconfig['translate']['service']) ESPEAK = "/usr/bin/espeak -v swedish " ONTELLSTICKTEST = "ssh life " + "'" + "/usr/bin/tdtool --on vardagsrum" + "'" OFFTELLSTICKTEST = "ssh life " + "'" + "/usr/bin/tdtool --off vardagsrum" + "'" TELLSTICKTEMP = "ssh life /usr/local/bin/temperatur.sh" if not args.textonly: v = pyvona.create_voice(yconfig['pyvonna']['user_key'], yconfig['pyvonna']['cert_key']) v.voice_name = 'Astrid' piled = led_class.led() #piled.on('blue') #time.sleep(1) #piled.off() run_sasha(args.textonly,args.ttsonly)