Updating callout to recognize specific words

 for variable checking.

So next thing right now is to split the speech variable to try and recognize events through words.

For this I'm gonna try to use the split() method in the str variable and test times of response, and since the program this far is already generating a str variable we can easily split it through the spaces between words.

# Separate string variable into words

            splitrecon=recognized_speech.split(" ")

            

# Reognize if there are any elements of the keyword list within the speech

            if any(x in splitrecon for x in trial):

                print(1)

For this example I'm generating a trial list of words to check if when I say the words on the list, the program does an action (in this case just printing 1)

For now this system seems to work out pretty nicely

Comments

Popular Posts