Udostępnij za pośrednictwem


Creating a Conversational Grammar Builder Grammar

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.

This is the second of several tutorial topics covering development of speech applications using Speech Server. This tutorial creates a smaller version of the sample application Survey (Managed Code Sample).

Speech Server includes two grammar editors that create grammar types appropriate in different scenarios. For more information about which scenarios are appropriate for Conversational Grammar Builder, see Create Speech Server Grammars with Conversational Grammar Builder.

Creating a Help Grammar

Conversational Grammar Builder enables you to build a grammar that uses concepts, keywords, or commands. For the purposes of this tutorial, the emphasis is on using the Conversational Grammar Builder to create a grammar that recognizes phrases from a user who needs help.

To add a Help command

  1. In Solution Explorer, double-click SurveyTutorial.gbuilder under the Grammars node.

  2. In the Keywords tree view pane, move the cursor over the exclamation mark in the red circle, immediately to the right of Keywords.

    This causes a black, downward-pointing triangle to appear.

  3. Select No Keywords Required.

  4. In the lower left pane, right-click Answers, and then click Add Command.

  5. In the new answer container, type HelpCommand, and then press ENTER.

Next, add training phrases for the grammar.

To add answer examples

  1. In the Answers Examples pane, double-click the top row, type I want help, and then press ENTER.

  2. Type the following additional response phrases, pressing ENTER after each:

    • I need help
    • I would like help
    • Give me help please

    Note

    The answer example phrases do not include periods. Do not add punctuation to entries in a Conversational Grammar Builder grammar.

Next, build the entire project. Even though no code has yet been added to the project, it must be built before proceeding any further. Building the project causes the lexical dictionary SurveyTutorial.lex to be compiled and added to the project. Omitting this step causes an error to be generated when you attempt to validate the grammar.

To build the project

  1. In Solution Explorer, select Solution 'SurveyTutorial' (2 projects).

  2. Right-click the solution, and then click Build Solution.

Ordinarily, the next step is to parse the answer examples. Because the grammar consists of just one command and has no keywords, the parse step does not need to be performed. The final steps are to validate the grammar and, if the grammar passes validation, to compile it.

To validate and build the grammar

  1. Double-click SurveyTutorial.gbuilder to bring Conversational Grammar Builder into focus.

  2. On the Conversational Grammar Builder menu, click Validate Grammar.

  3. On the Conversational Grammar Builder menu, click Compile Language.

  4. Save the solution.

Next Step

Creating a Grammar Editor Grammar

See Also

Other Resources

Lab: Constructing the Survey Tutorial Application
Managed Code Sample Applications
Develop Grammars with Speech Grammar Tools