Share via


Note

Please see Azure Cognitive Services for Speech documentation for the latest supported speech solutions.

Microsoft Speech Platform

Grammar Interfaces

This section provides information to help you create and compile grammars used for speech recognition in the Microsoft Speech Platform.

Speech recognition applications typically use voice commands to initiate actions that the application performs. This type of voice interaction with a speech application is also known as command and control (C&C). The C&C features of the Speech Platform are implemented as context-free grammars (CFGs). A CFG is a structure that defines the specific words and phrases, and their sequence, that speech recognition (SR) engine can recognize.

The Speech Platform supports CFG grammars (CFGs) that conform to the format defined in the Speech Recognition Grammar Specification (SRGS) Version 1.0. Applications can use ISpGrammarCompiler to transform XML-format SRGS grammars into a binary format used by the speech recognition engine in the Speech Platform. This compiling process can be performed either before or during application run time.

The Speech Platform also enables applications to create CFG structures programmatically using the ISpGrammarBuilder interface, which is inherited by ISpRecoGrammar. Typically, you will find it more efficient to author new grammars using SRGS XML and to use the ISpGrammarBuilder API to dynamically update an already loaded SRGS XML grammar. See Grammar Authoring Overview for more information about creating grammars.

You can also use ISpGrammarBuilder to save an in-memory grammar to a memory stream (that is, save a grammar to a hard disk).

In This Section