speech recognition applicaiton [closed]
i want my robot to ask a question and then series of question followed ny it but after how r u next series of statements don't work please help below is the snippet of my code in talkback.py
elif command == 'how are you':
self.soundhandle.say("i am fine, please Can i ask you a question", self.voice)
if command == 'no':
self.soundhandle.say("ok some time latter then", self.voice)
elif command == 'yes':
self.soundhandle.say("when will i start recognising thing", self.voice)
elif command == 'ok ask':
self.soundhandle.say("thanks when will i start recognising thing", self.voice)
else:
pass
Your question is ambiguous. Did you put this snippet of code in talkback.py?
yes i have sir, i have tried some other things after elif command == 'how are you': self.soundhandle.say("i am fine, please Can i ask you a question", self.voice) that worked fine but the series of command mentioned here does not work
What exactly does not work? I can imagine that some external process needs to fill the variable 'command' with the users speech converted to text. You'll also need to wait for the user to give a reply and not continue with the program directly.
yes its command = msg.data
its not following the nested structure where as all indents seem to be ok
OK, so commands are being received. But what I miss is updating the variable 'command' between saying something (with soundhandle etc) and checking the value of command. You'll need to do something like [Ask question] --> [Wait for new command i.e. receive new msg.data] --> [Act on command]
ok thanks i try