Share via


Grammars Overview

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

A grammar consists of a structured list of rules that identify words or phrases that can be used for speech recognition. These rules provide the guidelines that an application uses when collecting spoken input. The guidelines are used to mimic or anticipate possible speech patterns from users and restrict the words or phrases that can be recognized by the application.

Grammar rules consist of a predefined set of Extensible Markup Language (XML) elements that follow the guidelines defined by the World Wide Web Consortium (W3C) Speech Recognition Grammar Specification Version 1.0 format. The 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."

Because grammars are written in XML, an author can use any XML editor (including plain text editors) to write them. However, as a convenience, Speech Server offers Speech Grammar Editor. This tool presents a graphical approach to constructing grammars and integrates directly with the Microsoft Visual Studio 2005 development environment. Speech Grammar Editor also provides syntax validation to assist with grammar debugging.

Grammars can appear in one of two forms: a grammar file or an inline script.

  • Grammar files can be XML files or compiled binary files. Speech Grammar Editor supports the .grxml (XML) and .cfg (compiled) file name extensions.
  • Inline grammars exist entirely within the code of a Web-based voice response application.

The topics in this section provide more information about grammars.

In This Section

Grammars: Purpose and Structure

Rule Expansion

How to: Design Grammar Rules

Grammar Example: Solitaire

Grammar XML