How Tos

Last reviewed: 3/1/2012

Article ID: H031201

HOW: Developing Microsoft Speech Platform applications that manage grammars

The information in this article applies to:

  • GrammarKit 4

Summary

GrammarKit 4 provides support for Microsoft Speech Platform.

More Information

Chant GrammarKit 4 provides support for Microsoft Speech Platform that can generate, compile, and persist grammar binary for SAPI 5 XML and W3C XML speech recognition grammar syntax.

Both 32-bit and 64-bit applications can generate, compile, and persist SAPI 5 XML and W3C XML grammar binary using a Microsoft Speech Platform recognizer. The 32-bit Microsoft Speech Platform runtime must be installed to support 32-bit applications. The 64-bit Microsoft Speech Platform runtime must be installed to support 64-bit applications.

All current Microsoft Speech Platform versions are supported: v10.0, v10.1, v10.2 and v11.0. Only one version may be installed at a time. The runtimes and recognizers (grammar compilers) can be downloaded from Microsoft:

The grammar compiler can be selected by setting the CSPEngine property to recognizer name or by setting the CNPEngineAPI value to CEMSPSR.

private Chant.GrammarKit.NChantGM NChantGM1;
private NChantGrammar _NChantGrammar = null;
// Instantiate NChantGM object
NChantGM1 = new NChantGM(this);
NChantGM1.SetNumberProperty(ChantNumberProperty.CNPEngineAPI, (int)ChantEngineAPI.CEMSPSR);

// Build Colors grammar
_NChantGrammar = NChantGM1.CreateGrammar("Colors");
_NChantGrammar.AddComment("This is the list of colors");
NChantGrammarRule nChantGrammarRule = _NChantGrammar.AddRule("Color");
NChantGrammarList nChantGrammarList = nChantGrammarRule.AddList("colorlist");
string[] colors = { "red", "blue", "green", "yellow", "pink", "purple", "brown", "orange" };
for (int i = 0; i < colors.Length; i++)
{
    nChantGrammarList.AddPhrase(colors[i]);
}
string grammarSource = _NChantGrammar.GenerateGrammar(ChantGrammarSyntax.CGSSAPI5XML);

// Compile a grammar and save results to file
NChantGM1.CompileResource(grammarSource, 0, ChantCompileObject.CCOText, ChantGrammarSyntax.CGSSAPI5XML, "mygrammar.dat", ChantCompileResult.CCRFile, 0, ChantCompileOption.CCPAsynchronous);
ProfileKit 5 Upgrade to ProfileKit 5

Administer speaker profiles to enhance speech recognition accuracy.

Learn moreLearn more DownloadDownload Buy US $499Buy US $499
Plantronics Voyager Legend UC Plantronics Voyager Legend UC Bluetooth headset

  • Noise-Canceling microphone
  • Outstanding audio quality
  • 7 hours talk time
  • Up to 11 days standby
  • Convenient USB charging

Learn moreLearn more