Grammars Overview (Microsoft.Speech)

Microsoft Speech Platform SDK 11

Collapse image Expand Image Copy image CopyHover image

Speech recognition requires a speech recognition engine, speech input, and a grammar. A speech recognition grammar consists of a structured list of rules that identify words or phrases that the speech recognition engine should attempt to identify in the spoken input.

Grammar rules can identify simple one-word commands, such as "Open" or "Print", and more complex sentence structures such as "I'd like to book a flight from Seattle to Denver, departing next Tuesday". Grammars typically define a limited vocabulary that is focused on a specific task or set of tasks that a user expects to be able to accomplish by speaking.

A grammar must define structured, logical speech statements that apply to specific situations. At the same time, a grammar must be flexible enough to allow slight variations in spoken input to enable a more natural speaking style and to provide a better user experience. For example, a coffee ordering application must accept and respond to multiple ways that a user can order coffee:

  • "I would like a decaf latte"

  • "I want a decaf latte"

  • "Gimme a decaf latte"

A coffee ordering application must also process and respond to orders for different types of coffee drinks in multiple variations. For example, an application must be able to substitute the word "latte" for "cappuccino" or "mocha" and must be able to insert variations of those drinks such as "decaf" or "iced." However, a coffee ordering application does not need to process and respond to orders for airline tickets; a grammar need only include words and phrases for a specific situation or task.

You can use rules and semantic definitions to organize a grammar's content into logical groupings. This reduces the amount of work that an application needs to perform during recognition by decreasing the amount of information that the application must process and by returning only the most actionable information.

This section contains conceptual information about grammars, including their role in recognition, descriptions of grammar elements, and options for authoring grammars in the Microsoft Speech Platform SDK 11.

In This Section