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

标签 c# dictionary speech-recognition speech

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

我尝试用几个词制作一个声控程序,但是当我添加计算机难以识别的词(比如名字)时,它经常将这个名字识别为另一个词。这就是为什么我想添加一个特定的字典,如名称列表。

Eks:Sondre、Robert、Bob

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

最佳答案

我在之前使用 Kinect 相机完成的项目中使用了下面的代码。 我限制了短语 {faster,slower,stop..} 并建立了语法。我希望它能回答你的问题

    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));
    }

关于c# - 限制 C# 中的语音识别选择,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20724979/

相关文章:

azure - 有没有办法从音频文件(.wav)中删除某些关键字,例如电子邮件、电话号码,而不将其转换为文本?

c# - Windows Phone 8 中的语音识别

c# - Silverlight 旋转和缩放位图图像以适合矩形而不裁剪

javascript - 映射每个日期保存一个数组,实现问题

python - 你如何在 Python 中请求 IMDB API?

android - 如果不立即与 JellyBean 中的 RecognitionListener 通话,则会卡住

c# - ArgumentNullException : Value cannot be null.(参数 'items')异常

c# - PackageReference 未将 dll 复制到使用者(测试)项目输出,ExcludeAssets = "runtime"且 PrivateAssets = "none"

c# - 无效的对象名称错误 - EntityFrameworkCore 2.0

java - 独立(并行)替换字符串中的一组子字符串