Disable built-in speech recognition commands?

后端 未结 1 1854
眼角桃花
眼角桃花 2021-01-17 13:29

I\'m trying to build software that interprets various textual commands, all in a custom way. I use System.Speech.Recognition and it works surprisingly well, but I can\'t fig

相关标签:
1条回答
  • 2021-01-17 14:33

    Use SpeechRecognitionEngine instead of SpeechRecognizer.
    Try this:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Speech.Recognition;
    namespace speech
    {
    class Program
    {
        static void Main(string[] args)
        {
            SpeechRecognitionEngine mynizer = new SpeechRecognitionEngine();
    
            GrammarBuilder builder = new GrammarBuilder();
            builder.AppendDictation();
            Grammar mygram = new Grammar(builder);
            mynizer.SetInputToDefaultAudioDevice();
            mynizer.LoadGrammar(mygram);
            while (true)
            {
                Console.WriteLine(mynizer.Recognize().Text);
            }
        }
    
    }
    }
    
    0 讨论(0)
提交回复
热议问题