0

Right now, say I have created a Grammar which have the following elements in it

have, nice, day, they

What I'm trying to do here is, when I say "have", the result of the recognition is "have". When I say "have nice", the result will be "have nice".

How can I append these 2 choices or more into a single result of recognition?

And also, is it possible to add my own words to the DictationGrammar?

Xeon
  • 246
  • 2
  • 15

1 Answers1

1

First - you can build repeated elements using this GrammarBuilder constructor: GrammarBuilder (GrammarBuilder, Int32, Int32).

Second, you can add words to the dictation grammar using Lexicons. Unfortunately, the lexicon interfaces in SAPI are not exposed via System.Speech.Recognition, so your choices are either to use C++ and native SAPI, or to use Speechlib and the SAPI automation wrappers.

Alternatively, if you don't need to do this via code, you can use the speech dictionary that's part of Windows Speech Recognition.

Eric Brown
  • 13,308
  • 7
  • 28
  • 67
  • Thanks for the constructor, it works perfectly fine. Just that the program doesn't work when I tried to load a Scrabble dictionary to it. Hey, is there anyway I can contact you? I have so many questions to ask :O – Xeon Nov 28 '13 at 05:50
  • @Xeon you can reach me via my blog. If you're building a several thousand word vocabulary, command & control grammars are not going to work well. You would need a dictation grammar. – Eric Brown Nov 29 '13 at 23:41