How to incorporate speech dictation into a C# Windows Form Control based program

218 views Asked by At

I am trying to incorporate speech dictation into a C# Windows Form Control which is a custom text editor. Here is my simple code to instantiate SpeechRecoginizer. My text editor control is accepting the speech dictation and displaying the dictated text. It can also understand basic commands such as 'scroll down' or 'scroll up'.
It, however, does not understand much of the more complex dictation commands such as 'delete than', 'Select next 4 words', etc. So, I when I say 'delete that', the speech monitor displays 'This command is not available now'. I tried adding a grammar for 'Delete that', but this does not change the behavior, the speech monitor still displays the same message and I can not catch 'delete that' in the SpeechRecognized event handler. Does anyone one know which API or .NET interface need to be incorporated to catch these commands and implement them?

  SpeechRecognizer sr = new SpeechRecognizer();   

  GrammarBuilder gb = new GrammarBuilder();
  gb.AppendDictation();

  // Create the Grammar instance.
  Grammar g = new Grammar(gb);

  sr.LoadGrammar(g);   // dictation grammar already gets loaded

  sr.SpeechRecognized += new EventHandler<SpeechRecognizedEventArgs>(OnSpeechRecognized);
1

There are 1 answers

0
user2373071 On

The application need to support TSF (Text Services Framework) interfaces. Of about 101 interfaces defined for TSF, the only mandatory interface to implement is ITextStoreACP. This makes the application TSF aware.