3

I'm trying to make an AI system using Microsoft's SAPI.

Using the DictationGrammar class returns stupid results when trying to interpret speech.

Using the GrammarBuilder class requires a Choice class (correct me here if I'm wrong) and the recognising will stop after one word.

This is unacceptable since the DictationGrammar class will not return the correct interpreted speech almost 100% of the time and putting the custom grammar in a loop takes too long and the user has to wait 5 seconds after each word.

Is there a way to make a custom grammar that will accept multiple words and not stopping after one word or specifying words to recognise in the DictationGrammar class?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
rakagunarto
  • 325
  • 3
  • 23
  • Eric Brown's answer has most of the good examples with `GrammarBuilder` but why is building your custom grammars taking so long per word? Can you share that bit of code? – tyh Feb 10 '15 at 18:31
  • I want it to recognise sentences, loading sentences in the Choices class works. – rakagunarto Feb 12 '15 at 12:39

1 Answers1

3

Consider the following constructors:

This creates a grammar for a string of words, not all of which need to be present.

This creates a grammar for a repeated group of items.

This creates a choice between alternate grammars.

Also consider these methods:

These methods add items to an existing GrammarBuilder/Choices element.

Eric Brown
  • 13,774
  • 7
  • 30
  • 71