Dynamically Loading/Unloading Grammar RRS feed

  • Question

  • Hello all.

    Is there a way to dynamically load, and unload, grammar?

    I have a program that has multiple "modules", with only one module visible at a time.  Some grammar is common (e.g., "Main Menu") while some of the grammar is unique to a specific module (e.g., "Next Slide" or "Play Video"), so those particular grammar rules would not need to be known when other modules are loaded -- and testing for them would just waste time.


    Friday, August 31, 2012 6:41 PM


  • SpeechRecognitionEngine has  LoadGrammar and UnloadGrammar method. So, you can unload the grammar as an when required.  On the other hand, you can use a collection of Grammar to maintain the grammars.

    Collection<Grammar> grammarCollection = new Collection<Grammar>();

    Change the collection as an when required, and on change update the SpeechRecognitionEngine with grammar collection.




    Friday, August 31, 2012 7:00 PM