http://chupanhcuoi.com.vn/temp/Untitled.png
I have this small test application(sorry because the source code is copied from other and edited by me), which can recognize word from the words in the first textbox. the program works perfect with some words, but with somes, it never works. For a sample, my input is "one two three car book" (there are five words contained in the grammar). And the program can recognize 1,2,3 easily, but I can never make it recognize car, and book.
Any one can help me explain why ? Or is there any solution which can force to train the speech recognizer the word "car" and "book" programmatically ?
Sorry for my English, I'm not a native speaker.
Here is my project zip file :
http://chupanhcuoi.com.vn/temp/SpeechTest.zip[
^]
Sorry that I dont know how to upload to codeproject.com
the code for speech recognizer is from line 211 to line 256.
private void cmdEnable_Click(object sender, System.EventArgs e)
{
if (xpmode)
{
}
else
{
if (!recInited)
{
recognizer = new SpeechRecognitionEngine();
recognizer.SetInputToDefaultAudioDevice();
recognizer.SpeechRecognized += new EventHandler<SpeechRecognizedEventArgs>(recognizer_SpeechRecognized);
}
else
{
if (recognizer != null)
{
recognizer.RecognizeAsyncStop();
}
}
changerecDict();
recognizer.RecognizeAsync(RecognizeMode.Multiple);
recInited = true;
}
}
void changerecDict()
{
recogniseDict = grammartext.Text.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
if (xpmode)
{
}
else
{
recognizer.UnloadAllGrammars();
recognizer.LoadGrammar(new Grammar(new GrammarBuilder(new Choices(recogniseDict))));
}
}
private void Reco_Event(int StreamNumber, object StreamPosition,SpeechRecognitionType RecognitionType,ISpeechRecoResult Result)
{
}
private void recognizer_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
{
txtReco.Text = e.Result.Text + " " + e.Result.Confidence;
}