限制C#中的语音识别选择

Son*_*rey 4 c# speech-recognition dictionary speech

我想知道是否有办法将windows语音识别库限制为只包含几个单词的小型库?

我尝试用几个单词制作一个语音操作的程序,但是当我添加了一些难以识别的单词(就像名字一样)时,它将这个名称视为另一个单词.这就是为什么我想添加一个像名单列表一样的字典.

Eks:Sondre,Robert,Bob

在说出名字时,程序只会检查3个单词中的一个是否被识别

COL*_*ICE 6

我使用下面的代码来完成我之前使用Kinect相机完成的项目.我限制了短语{更快,更慢,停止..}并建立了一个语法.我希望它能回答你的问题

    private void initSpeech()
    {
            // You need to change here if you are not using kinect camera 
            RecognizerInfo ri = SpeechRecognitionEngine.InstalledRecognizers().Where(r => r.Id == "SR_MS_en-US_Kinect_10.0").FirstOrDefault();
            if (ri == null)
            {
                    throw new ApplicationException("Could not locate speech recognizer. Ensure you have the Kinect Speech SDK/runtime/MSKinectLangPack_enUS installed.");
            }

            sr = new SpeechRecognitionEngine(ri.Id);
            //Phrases that will be recognised added
            Choices phrases = new Choices();
            phrases.Add(
                "faster", 
                "slower", 
                "stop", 
                "invert y",
                "music volume",
                "effects volume",
                "okay");
            GrammarBuilder gb = new GrammarBuilder();
            //adding our phrases to the grammar builder
            gb.Append(phrases);
            // Loading the grammer 
            sr.LoadGrammar(new Grammar(gb));
    }
Run Code Online (Sandbox Code Playgroud)