Hi people i'm new to speech development and i'm learning as i
go forward. i'm developing an application using system.speech
namespace with some simple functionality. i'm using the following
method to display what is recognized in a text box, this part works
fine:
void spRecognizer_SpeechRecognized(object
sender, SpeechRecognizedEventArgs e) {
textBox2.Text = e.Result.Text; } also, i'm using this
method to create a grammar builder to create some grammars (commands)
private Grammar CreateSampleGrammar() {
Choices commandChoices = new Choices("Wikipedia", "Google", "Yahoo",
"MSN"); GrammarBuilder grammarBuilder = new
GrammarBuilder("Search");
grammarBuilder.Append(commandChoices); Grammar g = new
Grammar(grammarBuilder); g.Name = "Available programs";
return g; } and when i click on the button, the
grammar is loaded: private void button3_Click(object
sender, EventArgs e) { SpeechRecognizer
spRecognizer = new SpeechRecognizer(); Grammar g =
CreateSampleGrammar();
spRecognizer.LoadGrammar(g);
} i should mention that before i click on this button, when i
say , for example: Search Google, in the text box it appears search
google ( not all of the time, but most of the times its something
similar). but after i click the button, when the grammar is loaded,
then, when i say for example search google, on the speech recognition
bar ( on the top of screen) it displays "Search Google", but nothing is
typed in the text box. it seems to me that, the second time when i
say "search wikipeda", the engine recognize the phrase as a command, a
command like "Open Notepad" (which opens notepad). correct me if i'm
wrong... if that's the case, that's what want, i'd like the
application to take an action upon recognizing my command, like when i
say "Search Google", with the grammar loaded, google.com should be
opened in the system's default web explorer. how can i achieve
this? appreciating any help in advance
Ali.B
|