Partilhar via


Grammars Overview

  Microsoft Speech Technologies Homepage

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, the Microsoft Speech Application SDK Version 1.1 (SASDK) offers the Speech Grammar Editor tool. This tool presents a graphical approach to constructing grammars, and it integrates directly with the Microsoft Visual Studio .NET 2003 development environment. The tool 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 either XML files or compiled binary files. Speech Grammar Editor supports the .grxml (XML) and .cfg (compiled) extensions.
  • Inline grammars exist entirely within the code of a speech-enabled Web application.

The following topics provide more information about grammars:

Topic Description
Grammars Overview Provides a high-level overview about what grammars are, why they are used, and how XML elements are used to create their structure.
Rule Expansions Describes what a rule expansion is, and gives examples.
Designing Grammar Rules Provides a look at the creation and use of rules—the building blocks of grammars.
Grammar Example: Solitaire  An XML grammar example that provides a detailed look into a basic grammar structure.

See Also

Grammar XML | Enabling Speech Recognition