请问如何解决使用speech sdk v11.0时的”The language of the grammar does not match the speech recognizer"的问题? RRS feed

  • 问题

  • 以下是微软speech sdk v11.0的帮助文档中给出的示例程序:

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

    namespace SDKHP_01
        public partial class Form1 : Form
            public Form1()

            private void Form1_Load(object sender, EventArgs e)
                // Create a new SpeechRecognitionEngine instance.
                sre = new SpeechRecognitionEngine(new System.Globalization.CultureInfo("en-US"));

                // Create a simple grammar that recognizes "red", "green", or "blue".
                Choices colors = new Choices();
                colors.Add(new string[] { "red", "green", "blue" });

                // Create a GrammarBuilder object and append the Choices object.
                GrammarBuilder gb = new GrammarBuilder();

                // Create the Grammar instance and load it into the speech recognition engine.
                Grammar g = new Grammar(gb);

                // Register a handler for the SpeechRecognized event.
                sre.SpeechRecognized +=
                  new EventHandler<SpeechRecognizedEventArgs>(sre_SpeechRecognized);

            // Create a simple handler for the SpeechRecognized event.
            void sre_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)

            SpeechRecognitionEngine sre;



    2013年5月26日 8:07