Exemplo n.º 1
0
        // Handle the SpeechRecognized event.
        static void recognizer_SpeechRecognized(Object sender, SpeechRecognizedEventArgs e)
        {
            if (e.Result.Confidence >= 0.70)
            {
                Console.WriteLine("Recognized text: " + e.Result.Text);

                if (commandPerInput.ContainsKey(e.Result.Text))
                {
                    CommandAction action = commandPerInput[e.Result.Text];
                    Console.WriteLine("Action: " + action.ToString());
                }

                //synth.Speak("Got it");
                //synth.Speak(e.Result.Text);
            }
            else
            {
                Console.WriteLine("Recognized text: ... ");
            }

            /*Console.WriteLine("-------");
             * Console.WriteLine("Confidence: " + e.Result.Confidence);
             * Console.Write("Alternates: ");
             * foreach (RecognizedPhrase phrase in e.Result.Alternates) {
             *      Console.Write(phrase.Text + "(" + phrase.Confidence + ") / ");
             * }
             * Console.WriteLine();
             * Console.Write("Words: ");
             *
             * foreach (RecognizedWordUnit word in e.Result.Words) {
             *      Console.Write(word.Text + "(" + word.Confidence + ") / ");
             * }
             * Console.WriteLine();
             *
             * Console.WriteLine("-------");
             * Console.WriteLine();*/
        }