Prepare Grammar Usage Scenarios
PrepareGrammar helps you to optimize your application's grammars for the speech recognition engine that your application will use in production.
You convert compiled grammar files with the “.cfg” extension (generated by the CompileGrammar tool) to compiled grammar files with the “.cfgpp” extension to optimize them for the instance of the speech recognition engine that the production application will use. This is called "preparing" grammar files.
PrepareGrammar uses a RecoConfig file to connect to the speech recognition engine and to obtain information it can use to perform its compilation. See Setting Up the Grammar Development Tools. You will typically want to connect to the production speech recognition that your application will use when using PrepareGrammar. PrepareGrammar performs additional optimization on the ".cfg" file generated by the CompileGrammar tool to help you guard against latency in your application while grammars are being loaded.
You will typically use PrepareGrammar in the following scenario:
You want to optimize a grammar for a specific instance of a Microsoft speech recognition engine.
PrepareGrammar answers the following questions:
How can I minimize the possibility of application latency when loading grammars?
How can I optimize a grammar for the exact instance of the Microsoft speech recognition engine that my application will use in production?
If a grammar is being fetched across the internet by a hosted speech recognition engine (for example, a hosted IVR service such as Tellme), the grammar should never be prepared by the developer. Instead, the grammar’s optimization should remain at the CFG format, which you generated using the CompileGrammar tool. This allows the hosted speech recognizer to do the preparation of the grammar dynamically. For hosted IVR applications, grammars outside of the hosted platform should always be in source format (for example, GRXML) or optimized to CFG format.