def collectInput(self,isSilent): if (self.inputType=="VocalInput"): r = sr.Recognizer() r.energy_threshold = 3000 r.pause_threshold = 1.5 with sr.Microphone() as source: audio = r.listen(source) try: userInput = r.recognize(audio) except KeyError: userInput = "N01nt3rn31" except LookupError: userInput = "##--(system)error: did not understand response.--##" else: userInput = "" userInput=str(input()) mabUtilities.logInput(userInput) userInput=userInput.capitalize() return mabResponses.respondInput(self,userInput,isSilent)
def collectInput(isSilent): r = sr.Recognizer() r.energy_threshold = 3000 r.pause_threshold = 1.5 with sr.Microphone() as source: audio = r.listen(source) try: userInput = r.recognize(audio) except KeyError: userInput = "No internet" except LookupError: userInput = "##--(system)error: did not understand response.--##" #userInput = "" #userInput=str(input()) mabUtilities.logInput(userInput) userInput=userInput.capitalize() return mabResponses.respondInput(userInput,isSilent)