How Tos

Last reviewed: 9/1/2012

Article ID: H091201

HOW: Using phrase lists in command vocabularies

The information in this article applies to:

  • SpeechKit 7

Summary

Chant command vocabularies map to Dragon voice menus that support phrases lists that can be set at runtime to expand command choices based on application states.

An application can use lists to dynamically expand command list choices.

More Information

Command vocabularies are defined using the ChantCommandVocab class. The list of phrases choices are defined using the ChantSR DefineResource method.

The following example illustrates using a phrase lists in a command vocabulary:

// Define the vocabulary
NChantCommandVocab nChantCommandVocab = new NChantCommandVocab(NChantSR1, "commands");

// Add commands to the vocabulary
nChantCommandVocab.AddCommand("red <item>");
nChantCommandVocab.AddCommand("blue <item>");
nChantCommandVocab.AddCommand("green <item>");

// Create your list resource (one for each unique list embedded in your commands)
_ListID = NChantSR1.DefineResource(ChantSpeechResource.CSRVocabList, "item", ChantResourceFunction.CRFNone, null, null, 0, nChantCommandVocab.ResourceID);
NChantSR1.AddResource(ChantSpeechResource.CSRVocabPhrase, _ListID, "car");
NChantSR1.AddResource(ChantSpeechResource.CSRVocabPhrase, _ListID, "truck");
NChantSR1.AddResource(ChantSpeechResource.CSRVocabPhrase, _ListID, "boat"); 

// Enable the vocabulary
nChantCommandVocab.Enable();
// Then enable the list
NChantSR1.EnableResource(ChantSpeechResource.CSRVocabList, _ListID);

// Disable the vocabulary
nChantCommandVocab.Disable();
// You do not have to explicitly disable the list. The vocabulary disable does it automatically.

For additional help with command vocabularies, contact Chant Support via Chant Support Contacts or web.