我想知道是否有办法将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/