string srgsDocumentFile = Path.Combine(Path.GetTempPath(), "srgsDocumentFile.xml"); SrgsDocument document = null; GrammarBuilder builder = null; Grammar grammar = null; Choices firstThree = new Choices(new string[] { "1", "2", "3" }); Choices nextThree = new Choices(new string[] { "4", "5", "6" }); Choices lastThree = new Choices(new string[] { "7", "8", "9" }); Choices keyPadChoices = new Choices(new GrammarBuilder[] { firstThree, nextThree, lastThree, new Choices("0") }); builder = new GrammarBuilder(keyPadChoices); document = new SrgsDocument(builder); document.Mode = SrgsGrammarMode.Dtmf; grammar = new Grammar(document); RecognitionEngine.SetInputToWaveFile(@"c:\111111.wav"); RecognitionEngine.LoadGrammar(grammar); RecognitionResult Result = RecognitionEngine.Recognize(); if (null != Result) { StringBuilder Output = new StringBuilder(); foreach (RecognizedWordUnit Word in Result.Words) { Output.Append(Word.Text + " "); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)