How do I use command IDs with speech recognition?

Last reviewed: 7/15/2015

Article ID: H061406

The information in this article applies to:

  • SpeechKit 8

Summary

Process recognition results using command identifiers in addition to command strings.

More Information

A command can optionally have a numeric identifier associated with it. This enables processing recognition results on the basis of a numeric identifier in addition to command strings.

If and identifier is not specified, the command position in the list is the default numeric value is assigned.

To create a command vocabulary, instantiate a ChantCommandVocab class object. Then add the commands.


// Define the vocabulary
NChantCommandVocab nChantCommandVocab = nChantSR.CreateChantCommandVocab("commands");

// Add commands to the vocabulary
nChantCommandVocab.AddCommand("Open File", 101);
nChantCommandVocab.AddCommand("Print File", 102);
nChantCommandVocab.AddCommand("Close File", 103);

// Enable the vocabulary
nChantCommandVocab.Enable();

// Disable the vocabulary
nChantCommandVocab.Disable();
       

// Define the vocabulary
CChantCommandVocab* pChantCommandVocab = pChantSR->CreateChantCommandVocab(L"commands");

// Add commands to the vocabulary
pChantCommandVocab->AddCommand(L"Open File", 101);
pChantCommandVocab->AddCommand(L"Print File", 102);
pChantCommandVocab->AddCommand(L"Close File", 103);

// Enable the vocabulary
pChantCommandVocab->Enable();

// Disable the vocabulary
pChantCommandVocab->Disable();
    

// Define the vocabulary
CChantCommandVocab* pChantCommandVocab = pChantSR->CreateChantCommandVocab("commands");

// Add commands to the vocabulary
pChantCommandVocab->AddCommand("Open File", 101);
pChantCommandVocab->AddCommand("Print File", 102);
pChantCommandVocab->AddCommand("Close File", 103);

// Enable the vocabulary
pChantCommandVocab->Enable();

// Disable the vocabulary
pChantCommandVocab->Disable();

var aTChantCommandVocab: TChantCommandVocab;
// Define the vocabulary
aTChantCommandVocab := aTChantSR.CreateChantCommandVocab('commands');

// Add commands to the vocabulary
aTChantCommandVocab.AddCommand('Open File', 101);
aTChantCommandVocab.AddCommand('Print File', 102);
aTChantCommandVocab.AddCommand('Close File', 103);

// Enable the vocabulary
aTChantCommandVocab.Enable();

// Disable the vocabulary
aTChantCommandVocab.Disable();
    

// Define the vocabulary
JChantCommandVocab jChantCommandVocab = jChantSR.createChantCommandVocab("commands");

// Add commands to the vocabulary
jChantCommandVocab.addCommand("Open File", 101);
jChantCommandVocab.addCommand("Print File", 102);
jChantCommandVocab.addCommand("Close File", 103);

// Enable the vocabulary
jChantCommandVocab.enable();

// Disable the vocabulary
jChantCommandVocab.disable();
    

' Define the vocabulary
Dim nChantCommandVocab As NChantCommandVocab
nChantCommandVocab = nChantSR.CreateChantCommandVocab("commands")

' Add commands to the vocabulary
nChantCommandVocab.AddCommand("Open File", 101);
nChantCommandVocab.AddCommand("Print File", 102);
nChantCommandVocab.AddCommand("Close File", 103);

' Enable the vocabulary
nChantCommandVocab.Enable()

' Disable the vocabulary
nChantCommandVocab.Disable()