Speech Recognizer -After getting text, i wanna use the converted text to compare to predefined word and perform some action if it matches.

161 views
Skip to first unread message

pavan pavan

unread,
Sep 22, 2019, 8:12:44 AM9/22/19
to MIT App Inventor Forum
Hi,

Speech Recognizer -After getting text, i wanna use the text to compare to predefined word and perform some action if it matches.
example :
Attached the screen shot for word "middle"
what am trying to achieve is after converting speech to text ,i wanna use the converted text and compare it with predefined word and perform some action if it matches.
am not able to compare the converted text ,i tried many ways ...please help me in this to compare the converted text with predefined word.

Thanks in advance :-)
speech to text.PNG

TimAI2

unread,
Sep 22, 2019, 8:40:37 AM9/22/19
to MIT App Inventor Forum
Try setting:

"global rao2" to "Label1.Text" (which = "middle")

(in your blocks you are setting global rao2 to Label1 component, which does not = "middle")

SteveJG

unread,
Sep 22, 2019, 8:45:02 AM9/22/19
to MIT App Inventor Forum
You might try code similar to this Pavan

SRCommands.PNG

Code like the above might work for you; be aware, a second Web call, immediately following a Web call might not execute.  The above performs an action if the SpeechRecognizer finds a command that is in the pirateVocabulary.   PirateVocabulary is a List (created from a csv file) and is used to 'screen' your voice commands and exclude words that are mispronounced or not valid commands.

Regards,
Steve

Chris Ward

unread,
Sep 22, 2019, 11:48:38 AM9/22/19
to MIT App Inventor Forum
Hi Pavan

Also, if comparing text, use a Compare Text Block, not a Logic Block.

blocks.png


pavan

unread,
Sep 22, 2019, 12:00:47 PM9/22/19
to MIT App Inventor Forum
Thank you TimAI2 ,SteveJG and Chris Ward for your quick reponse .
It worked,I was using wrong block .
Reply all
Reply to author
Forward
0 new messages