1

我在这里尝试做的是,在用户说“在 Google 上搜索某物”之后,该程序将打开 Google 并搜索该“某物”。我完成了大部分工作,但没有完成动态语法部分。由于我做所有这些的唯一方法是使用静态语法,因此程序无法识别“某事”关键字。

几天来,我一直在寻找示例代码、有关 SAPI 5.3 动态语法的教程,但没有运气。点击 MSDN 并得到一个结果,语音列表框,MSDN 说 Windows SDK 中包含一个示例项目。我问了我的朋友,他们都没有。

那么,有没有办法使用 SAPI 创建动态语法呢?

4

1 回答 1

3

如果您使用 System.Speech.Recognition,您应该能够使用它GrammarBuilder.AppendDictation来解决您的问题:

GrammarBuilder builder = new GrammarBuilder();
builder.Append("search google for");
builder.AppendDictation();
Grammar grammarWithDictation = new Grammar(builder);
grammarWithDictation.Name = "Search Google";
于 2013-10-16T06:39:12.880 回答