Print Page | Close Window

Action after recognizing a command

Printed From: MSSpeech-Forum
Category: Windows™ Speech Recognition Forums
Forum Name: New Users & General Questions
Forum Description: Ask questions, give and get answers.
URL: https://www.msspeech-forum.com/forum_posts.asp?TID=167
Printed Date: 24/Nov/2024 at 1:53am
Software Version: Web Wiz Forums 12.02 - http://www.webwizforums.com


Topic: Action after recognizing a command
Posted By: Guests
Subject: Action after recognizing a command
Date Posted: 04/Mar/2010 at 5:46am

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



Replies:
Posted By: mmarkoe_admin
Date Posted: 04/Mar/2010 at 10:50am
This forum is for users of WSR, Windows Speech Recognition, built into the Vista and Window 7 operating systems.
 
http://msdn.microsoft.com/en-us/library/ee431825%28VS.85%29.aspx - CLICK HERE for Microsoft Developer Support.
 
Marty Markoe, eMicrophones, Inc.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.02 - http://www.webwizforums.com
Copyright ©2001-2019 Web Wiz Ltd. - https://www.webwiz.net