I am currently developing a Voice Recognition Application. For this I have the requirement of allowing the users to spell letters of a particular word, such as for example a name. I tried to add the alphabet as choices using a grammarbuilder, but it only recognizes one particular Letter.
Following is my code
public static class GrammarManager{
public static GrammarBuilder getAlphabet()
{
Settings.CultureInfo = "en-GB";
GrammarBuilder dictaphoneGB = new GrammarBuilder();
dictaphoneGB.Culture = new System.Globalization.CultureInfo(Settings.CultureInfo);
dictaphoneGB.Append(new Choices("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"));
return dictaphoneGB;
}
}
public class SpeechEngine{
static System.Speech.Recognition.SpeechRecognitionEngine recognizer = null;
private void initializeEmulator()
{
GrammarBuilder builder = new GrammarBuilder();
builder.AppendDictation();
recognizer = new System.Speech.Recognition.SpeechRecognitionEngine(new System.Globalization.CultureInfo("en-GB"));
recognizer.RequestRecognizerUpdate();
recognizer.LoadGrammar(new Grammar(GrammarManager.getAlphabet()));
recognizer.SpeechRecognized += recognizer_SpeechRecognized;
}
public void startEmulatorRecognition(string word)
{
recognizer.EmulateRecognizeAsync(word);
}
}
I am invoking the startEmulateRecognition() method by starting a particular string parametr. Now when I pass values like "A", "G", or "B" to that particular method, it's getting recognized. But when I pass "A B C" or "ABC" or words such as "G O O G L E", they are not being recognized.
I would really appreciate if someone can suggest me a method to achieve this, to allow recognizing words that are being spelled such as "G O O G L E" etc.?
Thanks in advance!