class DefaultRecognizer: def __init__(self): self.r = sr.Recognizer(language = "de-DE") self.r.dynamic_energy_threshold = True self.voice = JarviceVoice("de"); def listen(self): with sr.Microphone() as source: audio = self.r.listen(source) try: text = self.r.recognize(audio).lower() if(text == "leck mich am arsch"): self.voice.say("Alles Klar! Hose runter!") except LookupError: self.voice.say("Entschuldige! Das habe ich" " nicht verstanden!") self.listen()
__author__ = 'daniel' from voice.JarviceVoice import JarviceVoice from recognition.DefaultRecognizer import DefaultRecognizer voice = JarviceVoice("de"); recognizer = DefaultRecognizer(); voice.say("Guten Tag ich bin Jarvis und hoere von jetzt an auf deine Befehle!") recognizer.listen();
def __init__(self): self.r = sr.Recognizer(language = "de-DE") self.r.dynamic_energy_threshold = True self.voice = JarviceVoice("de");