Good afternoon! This is a Microsoft Server Speech SDK v11.0 (server version).
I ran a test case sample MSDN . So, the English phrases - red, blue - are well known. But I also want to recognize Russian - install Microsoft Speech Recognition Language -TELE (ru-RU) and run my application /
the code:
static void DoWork()
{
Thread.CurrentThread.CurrentCulture = new CultureInfo("ru-RU");
Thread.CurrentThread.CurrentUICulture = new CultureInfo("ru-RU");
SpeechRecognitionEngine sre = new SpeechRecognitionEngine();
sre.SetInputToWaveFile(@"c:\Test\.wav");
Choices colors = new Choices();
colors.Add(new string[] { "" });
GrammarBuilder gb = new GrammarBuilder();
gb.Culture = new CultureInfo("ru-RU");
gb.Append(colors);
Console.WriteLine(gb.Culture.CultureTypes);
Grammar g = new Grammar(gb);
sre.LoadGrammar(g);
sre.SpeechRecognized +=
new EventHandler<SpeechRecognizedEventArgs>(sre_SpeechRecognized);
sre.Recognize();
}
static void sre_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
{
Console.WriteLine(String.Format("Speech recognized: {0}",e.Result.Text));
}
An error appears on this line:
sre.LoadGrammar(g);
The language for the grammar does not match the language of the speech recognizer.
So how to fix this error? I am trying to install CultureInfo, but it does not work ... Thanks!
source
share