def greeting(text): loadModel = loadFile('models/dictionary.json') Greeting_Inputs = loadModel['greetings']['inputs'] Greeting_Response = loadModel['greetings']['responses'] for word in text.split(): if word.lower() in Greeting_Inputs: return random.choice(Greeting_Response) return "what's your desire"
def wakeWord(text): words = loadFile('models/dictionary.json') WAKE_WORD = words['wakeAssistance']['inputs'] text = text.lower() for phrase in WAKE_WORD: if (phrase + " " + config['assistant']['name']) in text: return True elif config['assistant']['wakeupJustName'] and config['assistant'][ 'name'] in text: return True return False
from tools.load import loadFile from speech import assistantResponse from voiceRecognize import listen from intents.timedate import timeDate_intent as timeDate from intents.weather import wheather_intent as weather from intents.assistant import assistant_intent as assistant import random, os, sys from multiprocessing import Process loadModel = loadFile('models/dictionary.json') Greeting_Response = loadModel['greetings']['responses'] cancle = ["ok!", "no problem", ""] cancelWords = ['cancel', 'thanks'] intents = [ weather.callActions(), timeDate.callActions(), assistant.callActions() ] STT = listen() #obj to convert speech to text def intentCall(): assistantResponse(random.choice(Greeting_Response)) count = 0 while count < 3: text = STT.listening()
from speech import assistantResponse from voiceRecognize import listen from intents.intent import intentCall from tools.load import loadFile from tools.sounds import beep, beep2 config = loadFile('config.json') STT = listen() def wakeWord(text): words = loadFile('models/dictionary.json') WAKE_WORD = words['wakeAssistance']['inputs'] text = text.lower() for phrase in WAKE_WORD: if (phrase + " " + config['assistant']['name']) in text: return True elif config['assistant']['wakeupJustName'] and config['assistant'][ 'name'] in text: return True return False if __name__ == "__main__": # assistantResponse("hello i'm {0}, i'm your voice assistant, you can call me with hey {0}, ok {0} or just call my name".format(config['assistant']['name'])) while True:
from tools.load import loadFile loadModel = loadFile('config.json') def name(): return "my name is " + loadModel['assistant']['name']