문제

What I'm trying to do here is, after user said "Search Google for something", the program will then open up Google and search for that "something". I got most of it done but not the dynamic grammar part. Since the only way I'm doing all these is by using static grammar, thus the program is unable to identify the "something" keyword.

I've been searching for sample codes, tutorials regarding dynamic grammar with SAPI 5.3 for days and have no luck. Hit MSDN and got a result, Speech list box, which MSDN said there is a sample project included within the Windows SDK. I asked my friends and none of them have it.

So, is there anyway to create dynamic grammar using SAPI?

도움이 되었습니까?

해결책

If you're using System.Speech.Recognition, you should be able to use GrammarBuilder.AppendDictation to solve your issue:

GrammarBuilder builder = new GrammarBuilder();
builder.Append("search google for");
builder.AppendDictation();
Grammar grammarWithDictation = new Grammar(builder);
grammarWithDictation.Name = "Search Google";
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top