A grammar is a subset of the available vocabulary that contains only the words used by your application. Create a grammar to avoid comparing a user’s speech command to all the words in a vocabulary. A grammar can contain words from the vocabularies included in ROM or RAM, as well as user-trained words. It should contain only those words that the application requires.
An active grammar is a subset of the grammar for your application available for a device context. When a user moves from one application context to another, the active grammar should change to the commands required for the new context. Managing grammars efficiently makes speech-enabled applications easier to use and speech recognition more accurate. The smaller the active grammar, the better the speech recognition.
Active grammar includes global command grammar and application command grammar. Global command grammar is continually active. It provides quick access to favorite applications and system controls, such as volume, time, and Help. Application command grammar is active only when a particular application is in focus. For example, application commands for the radio are active only when the radio is in focus.
For speech recognition to work effectively, consider the following guidelines when you choose a grammar:
When an application receives focus, it notifies the speech recognition engine of the active grammar. The application’s active grammar is then added to the global command grammar.
When the audio source recognizes a speech command, it sends the WAV data to the speech recognition engine. The speech recognition engine attempts to match the WAV data to a speech command in the active grammar. If it succeeds, it passes the text to the application.