Share via


Note

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

Microsoft Speech Platform

Grammar Authoring Overview

Although you can author grammars programmatically in your application using the ISpGrammarBuilder interface, you may find that it is more efficient to author grammars using the XML format defined by the Speech Recognition Grammar Specification Version 1.0 (SRGS). You can create grammars in XML format using any text editor. See SRGS Grammar XML Reference (Microsoft.Speech) for more information about support for SRGS grammars by the Microsoft Speech Platform.

You can load a grammar created using SRGS XML as a read-only static file or as a dynamic file. Grammars that are loaded as dynamic files can be modified at run time using the ISpGrammarBuilder interface. To reduce latency when loading large grammar files, you can use the ISpGrammarCompiler::CompileStream method to compile SRGS grammars to a binary format created by Microsoft. To load SRGS grammars in XML format or binary format at run time, use ISpRecoGrammar::LoadCmdFromFile.

Using the Grammar Development Tools that are included in the Microsoft Speech Platform SDK, you can also compile statistical language model (SLM) grammars authored in Advanced Research Projects Agency (ARPA) format. See Compile Grammar Reference Manual for more information. The Grammar Development Tools provide a suite of command-line tools that you can use to validate, debug, test, and optimize grammars for voice applications.

This section contains conceptual information and examples for creating grammars using the XML format defined by SRGS, and one example for creating grammars using the ISpGrammarBuilder interface.

In This Section