Walkthrough: Use Conversational Grammar Builder to Create a Keyword 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.

Use Conversational Grammar Builder to author speech and dual tone multi-frequency (DTMF) grammars that recognize a single item of data in Speech Server. Performing the procedures correctly is important if the grammar is used in an inbound application.

Prerequisites

Speech Server

Creating Keyword Grammars

To add keywords

  1. Create a new speech application, and then name the application PizzaOrder.

    This sets the grammar file name to PizzaOrder.gbuilder. For more information, see How to: Create a Voice Response Application.

  2. In Solution Explorer, double-click the .gbuilder file under the Grammars node.

  3. In the Keywords tree view pane, right-click Keywords, and then click Add Keyword Container.

  4. Type PizzaSize, and then press ENTER.

    This represents a semantic item for the application.

  5. Right-click PizzaSize, click Add Keyword, type small, and then press ENTER.

    This represents one possible value for the semantic item.

  6. Add two more keywords: medium and large.

    The grammar now contains a single semantic item, with three possible values for the semantic item.

To add speech grammar keyword phrases

  1. In the Keywords tree view pane, select the keyword small.

  2. In the Keyword Phrase pane, double-click the first row, type tiny, and then press ENTER.

  3. In the next row, type small.

    These two entries represent words to recognize for the selected value in the Keyword pane.

  4. In the Keywords tree view pane, select the keyword medium, and then add medium and average as words to recognize.

  5. In the Keywords tree view pane, select the keyword large, and then add big and huge as words to recognize.

To add DTMF grammar keyword phrases

  1. In the Keywords tree view pane, select the keyword small.

  2. In the Keyword Phrase pane, click the DTMF tab, double-click the first row, type 1, and then press ENTER.

    This represents the keystroke to recognize for the selected value in the Keyword pane.

  3. In the Keywords tree view pane, select the keyword medium, and then repeat step 2, this time adding the number 2 as the keystroke to recognize.

  4. In the Keywords tree view pane, select the keyword large, and then repeat step 2, this time adding the number 3 as the keystroke to recognize.

To add responses

  1. In the Answers pane, right-click Answers, and then click Add Keyword Answer.

  2. Type SizeResponse, and then press ENTER.

  3. Right-click SizeResponse, select Add Keyword Reference, and then click PizzaSize.

  4. Click the en-US tab.

  5. Select SizeResponse, double-click the top row in the Answer Examples pane, type I will have a big pizza, and then press ENTER.

  6. Type the following response phrases:

    • I would like a medium pizza please

    • I want a tiny pizza

    • Give me a big pizza

      Note

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

  7. Right-click SizeResponse, and then click Parse.

    In the Answer Examples pane, the colored text indicates semantic items. The uncolored preamble and postamble text is training text that the grammar engine uses to learn to recognize the occurrence of semantic items in spoken text.

  8. Save the grammar.

Validate and Build the Grammar

The grammar must be compiled to be usable. Before the grammar is compiled, build the lexicon file.

To build the lexicon file

  1. In Solution Explorer, double-click the .cal file in the Lexicons node.

  2. Click Build.

By default, the grammar PizzaOrder.gbuilder, when compiled, is output in the Grammar folder as PizzaOrder_EN_US.cfg.

To validate and build the grammar

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

  2. On the Grammar menu, click Validate Grammar.

    Note the text in the Output pane.

  3. On the Grammar menu, click Compile All.

See Also

Other Resources

Use Conversational Grammar Builder to Create Grammars
Use Speech Grammar Editor to Create Grammars