I just started testing Windows Speech to Text features in C # .Net. I am currently working on the basics (IE - Say something and it will provide output based on what you say). However, I'm struggling to figure out how to really get user input as a variable.
What I mean by this is, for example. If the user says:
"Call me John"
Then I want to be able to take the word John as a variable, and then save that, as they say, the username.
My current SpeechRecognized event is as follows:
void zeusSpeechRecognised(object sender, SpeechRecognizedEventArgs e) { writeConsolas(e.Result.Text, username); switch (e.Result.Grammar.RuleName) { case "settingsRules": switch (e.Result.Text) { case "test": writeConsolas("What do you want me to test?", me); break; case "change username": writeConsolas("What do you want to be called?", me); break; case "exit": writeConsolas("Do you wish me to exit?", me); break; } break; } }
NB: writeConsolas is just an illustrious line of adding to RichTextBox .
I would like to add another case that does the following:
case "call me" username = e.Result.GetWordFollowingCallMe()
Obviously, there is no such method, but this is a general idea that I want to implement. Is there a way to search for specific phrases (IE: Call me ) and take the next word?
EDIT: I should note that e.Result.Text only returns words that can match Text in the dictionary.
JosephGarrone
source share