speech recognition applicaiton [closed]

asked 2012-11-11 20:30:14 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

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
edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by tfoote
close date 2015-09-01 00:39:00.655011

Comments

Your question is ambiguous. Did you put this snippet of code in talkback.py?

Po-Jen Lai gravatar image Po-Jen Lai  ( 2012-11-12 16:30:28 -0600 )edit

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

karan4515 gravatar image karan4515  ( 2012-11-14 22:26:26 -0600 )edit

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.

Loy gravatar image Loy  ( 2012-11-24 21:59:20 -0600 )edit

yes its command = msg.data

karan4515 gravatar image karan4515  ( 2012-11-25 00:15:06 -0600 )edit

its not following the nested structure where as all indents seem to be ok

karan4515 gravatar image karan4515  ( 2012-11-25 00:15:59 -0600 )edit

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]

Loy gravatar image Loy  ( 2012-11-25 00:34:23 -0600 )edit

ok thanks i try

karan4515 gravatar image karan4515  ( 2012-11-25 02:06:43 -0600 )edit