I am using an Chinese Windows 7 with speech recognition working fine if I use the grammar to recognize English sentences which is constructed with the object of Choice.But the object of SpeechRecognitionEngine only can arise SpeechDetectedEventArgs and doesn't arise LoadGrammarCompletedEventArgs or RecognizeCompletedEventArgs when the the object of Grammar is constructed with the object of SrgsDocement.There is my fragement of the project.
SpeechRecognitionEngine recognizer = new SpeechRecognitionEngine ( System.Globalization.CultureInfo.CreateSpecificCulture("zh-CN"));
SrgsDocument srgsdoc = new SrgsDocument(./commongreetingGrammar.grxml");
recognizer.MaxAlternates = 5;
recognizer.LoadGrammarCompleted += new EventHandler<LoadGrammarCompletedEventArgs>(recognizer_LoadGrammarCompleted);
recognizer.SpeechDetected += new EventHandler<SpeechDetectedEventArgs>(recognizer_SpeechDetected);
recognizer.RecognizeCompleted += new EventHandler<RecognizeCompletedEventArgs>(recognizer_RecognizeCompleted);
recognizer.LoadGrammar(new Grammar(srgsdoc));
recognizer.SetInputToDefaultAudioDevice();
recognizer.RecognizeAsync (RecognizeMode .Multiple);
}
catch (Exception ex)
{ Console.WriteLine(ex.Message); }
Console.ReadKey();
}
static void recognizer_SpeechDetected(object sender, SpeechDetectedEventArgs e)
{
Console.WriteLine("Detect that someone is speeching");
}
static void recognizer_LoadGrammarCompleted(object sender, LoadGrammarCompletedEventArgs e)
{
if (e.Error == null)
Console.WriteLine("complete to load grammar ");
else
Console.WriteLine("Fail to load grammar");
}
static void recognizer_RecognizeCompleted(object sender, RecognizeCompletedEventArgs e)
{
if (e.Result.Semantics["step"].Value.ToString() == "A1")
{
Console.WriteLine("A start to speak:{0}", e.Result.Text);
}
}
And there is the file named commongreetingGrammar.grxml that constructs the object of SrgsDocement named srgsdoc .(Sorry to add the image of the .grxml file instead of the plain text of the .grxml file)
![enter image description here][1]