1
Answer

Windows 7 Desktop Speech Recognition C#

Ask a question

Hi please help me...

this is my code for  Speech Recognation it's work fine

but i have problem with the speech itself like when i say

"start menu" or something default for Speech Recognation it's open the start menu

and i don't want this in my program ,i need it only to recogize what i wrote to him in the code

just the grammar

 

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Speech.Recognition;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        SpeechRecognizer speechReco = new SpeechRecognizer();

        List<string> grammerList = new List<string>();

        public Form1()
        {
            InitializeComponent();
            this.grammerList.Add("one");
            this.grammerList.Add("two");
            Choices myChoices = new Choices(grammerList.ToArray());

            GrammarBuilder builder = new GrammarBuilder(myChoices);

            Grammar gram = new Grammar(builder);

            speechReco.LoadGrammar(gram);
            gram.Enabled = true;

            speechReco.Enabled = true;

            speechReco.SpeechRecognized += new EventHandler<SpeechRecognizedEventArgs>(speechReco_SpeechRecognized);


        }
        void speechReco_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
        {
            String speech = e.Result.Text;
            lblSpeech.Text = speech;
        }
    }
}

 thanks


Answers (1)