How do I integrate VoCon 1-Shot (2-pass) speech recognition in my application?

Last reviewed: 7/15/2011

HOW Article ID: H071131

The information in this article applies to:

Summary

1-Shot (2-pass) recognition refers to the capturing multiple slot items from a single utterance, as opposed to capturing (and confirming) each slot individually provided by the Voice Destination Entry (VDE) capability of VoCon 3200.

More Information

To optimize recognition for large grammars, for example street address, VoCon provides a special-purpose grammar format and recognition processing referred to as 1-Shot.

SpeechKit 7 supports 1-Shot (2-pass) recognition required to process these grammars. New speech resources: CSRActivateField, CSRStopField, CSRStopField are available to pass the values needed to recognize the desired fields of these grammars.

The following example illustrates defining, enabling, and disabling grammar resources for 1-Shot (2-pass) speech recognition.


private Chant.SpeechKit.NChantSR NChantSR1;
// Instantiate NChantSR object
NChantSR1 = new NChantSR(this);
NChantSR1.SetNumberProperty(ChantNumberProperty.CNPEngineAPI, (int)ChantEngineAPI.CEVoCon4);
// Win32 - Set the path to the VoCon runtime libraries
NChantSR1.SetStringProperty(ChantStringProperty.CSPEnginePath, "C:\\Program Files\\Nuance\\vocon3200\\EDS_v4_1\\bin\\winx86rls");
// Win32 - Set the file name of CLC model
NChantSR1.SetStringProperty(ChantStringProperty.CSPCLCModel, "C:\\Program Files\\Nuance\\vocon3200\\EDS_v4_1\\models\\clc_enu_cfg3_v1_0_0.dat");
// Win32 - Or set the file name of DDG2P model
//NChantSR1.SetStringProperty(ChantStringProperty.CSPDDG2PModel, "C:\\Program Files\\Nuance\\vocon3200\\EDS_v4_1\\models\\ddg2p_enu_vadvde_ttsasr_large_v2_1_3.dat");

// Define field definition grammar
int grammarVocabID = NChantSR1.DefineResource(ChantSpeechResource.CSRNativeGrammarVocab, "vde_pass1.lcf");

// Define fields
NChantSR1.AddResource(ChantSpeechResource.CSRStartField, grammarVocabID, "street");
NChantSR1.AddResource(ChantSpeechResource.CSRStopField, grammarVocabID, "state2");
NChantSR1.AddResource(ChantSpeechResource.CSRActivateField, grammarVocabID, "state");

// Define field data grammar
int grammarVocabID2 = NChantSR1.DefineResource(ChantSpeechResource.CSRNativeGrammarVocab, "vde_pass2.fcf"); 

// Only load and enable the field definition grammar vocabulary
NChantSR1.EnableResource(ChantSpeechResource.CSRNativeGrammarVocab, grammarVocabID);

// Disable it
NChantSR1.DisableResource(ChantSpeechResource.CSRNativeGrammarVocab, grammarVocabID);

CChantSR* m_pChantSR;  // ChantSR object
// Instantiate ChantSR object
m_pChantSR = new CChantSR();
m_pChantSR->SetNumberProperty(CNPEngineAPI, CEVoCon4);
// Win32 - Set the path to the VoCon runtime libraries
m_pChantSR->SetStringProperty(CSPEnginePath, L"C:\\Program Files\\Nuance\\vocon3200\\EDS_v4_1\\bin\\winx86rls");
// Win32 - Set the file name of CLC model
m_pChantSR->SetStringProperty(CSPCLCModel, L"C:\\Program Files\\Nuance\\vocon3200\\EDS_v4_1\\models\\clc_enu_cfg3_v1_0_0.dat");
// Win32 - Or set the file name of DDG2P model
//m_pChantSR->SetStringProperty(CSPDDG2PModel, L"C:\\Program Files\\Nuance\\vocon3200\\EDS_v4_1\\models\\ddg2p_enu_vadvde_ttsasr_large_v2_1_3.dat");

// Define field definition grammar
long grammarVocabID = pChantSR->DefineResource(CSRNativeGrammarVocab, L"vde_pass1.lcf");

// Define fields
m_pChantSR->AddResource(CSRStartField, grammarVocabID, L"street");
m_pChantSR->AddResource(CSRStopField, grammarVocabID, L"state2");
m_pChantSR->AddResource(CSRActivateField, grammarVocabID, L"state");

// Define field data grammar
long grammarVocabID2 = m_pChantSR->DefineResource(ChantSpeechResource.CSRNativeGrammarVocab, L"vde_pass2.fcf"); 

//  Only load and enable the field definition grammar vocabulary
pChantSR->EnableResource(CSRNativeGrammarVocab, grammarVocabID);

// Disable it
pChantSR->DisableResource(CSRNativeGrammarVocab, grammarVocabID);
    

CChantSR* ChantSR1;  // ChantSR object
// Instantiate ChantSR object
ChantSR1 = new CChantSR();
ChantSR1->SetNumberProperty(CNPEngineAPI, CEVoCon4);
// Win32 - Set the path to the VoCon runtime libraries
ChantSR1->SetStringProperty(CSPEnginePath, "C:\\Program Files\\Nuance\\vocon3200\\EDS_v4_1\\bin\\winx86rls");
// Win32 - Set the file name of CLC model
ChantSR1->SetStringProperty(CSPCLCModel, "C:\\Program Files\\Nuance\\vocon3200\\EDS_v4_1\\models\\clc_enu_cfg3_v1_0_0.dat");
// Win32 - Or set the file name of DDG2P model
//ChantSR1->SetStringProperty(CSPDDG2PModel, "C:\\Program Files\\Nuance\\vocon3200\\EDS_v4_1\\models\\ddg2p_enu_vadvde_ttsasr_large_v2_1_3.dat");

// Define field definition grammar
long grammarVocabID = ChantSR1->DefineResource(CSRNativeGrammarVocab, "vde_pass1.lcf");

// Define fields
ChantSR1->AddResource(ChantSpeechResource.CSRStartField, grammarVocabID, "street");
ChantSR1->AddResource(ChantSpeechResource.CSRStopField, grammarVocabID, "state2");
ChantSR1->AddResource(ChantSpeechResource.CSRActivateField, grammarVocabID, "state");

// Define field data grammar
int grammarVocabID2 = ChantSR1->DefineResource(ChantSpeechResource.CSRNativeGrammarVocab, "vde_pass2.fcf"); 

//  Only load and enable the field definition grammar vocabulary
ChantSR1->EnableResource(CSRNativeGrammarVocab, grammarVocabID);

// Disable it
ChantSR1->DisableResource(CSRNativeGrammarVocab, grammarVocabID);

var
ChantSR1: TChantSR;
grammarVocabID: Integer;
grammarVocabID2: Integer;
begin
// Instantiate ChantSR object
ChantSR1 := TChantSR.Create();
ChantSR1.SetNumberProperty(CNPEngineAPI, CEVoCon4);
// Win32 - Set the path to the VoCon runtime libraries
ChantSR1.SetStringProperty(CSPEnginePath, 'C:\\Program Files\\Nuance\\vocon3200\\EDS_v4_1\\bin\\winx86rls');
// Win32 - Set the file name of CLC model
ChantSR1.SetStringProperty(CSPCLCModel, 'C:\\Program Files\\Nuance\\vocon3200\\EDS_v4_1\\models\\clc_enu_cfg3_v1_0_0.dat');
// Win32 - Or set the file name of DDG2P model
//ChantSR1.SetStringProperty(CSPDDG2PModel, 'C:\\Program Files\\Nuance\\vocon3200\\EDS_v4_1\\models\\ddg2p_enu_vadvde_ttsasr_large_v2_1_3.dat');

// Define field definition grammar
grammarVocabID := ChantSR1.DefineResource(CSRNativeGrammarVocab, 'vde_pass1.lcf');

// Define fields
ChantSR1.AddResource(CSRStartField, grammarVocabID, 'street');
ChantSR1.AddResource(CSRStopField, grammarVocabID, 'state2');
ChantSR1.AddResource(CSRActivateField, grammarVocabID, 'state');

// Define field data grammar
grammarVocabID2 := ChantSR1.DefineResource(CSRNativeGrammarVocab, 'vde_pass2.fcf'); 

//  Only load and enable the field definition grammar vocabulary
ChantSR1.EnableResource(CSRNativeGrammarVocab, grammarVocabID);

// Disable it
ChantSR1.DisableResource(CSRNativeGrammarVocab, grammarVocabID);
    

private JChantSR JChantSR1;
// Instantiate ChantSR object
JChantSR1 = new JChantSR();
JChantSR1.setNumberProperty(ChantNumberProperty.CNPEngineAPI, ChantEngineAPI.CEVoCon4);
// Win32 - Set the path to the VoCon runtime libraries
JChantSR1.setStringProperty(ChantStringProperty.CSPEnginePath, "C:\\Program Files\\Nuance\\vocon3200\\EDS_v4_1\\bin\\winx86rls");
// Win32 - Set the file name of CLC model
JChantSR1.setStringProperty(ChantStringProperty.CSPCLCModel, "C:\\Program Files\\Nuance\\vocon3200\\EDS_v4_1\\models\\clc_enu_cfg3_v1_0_0.dat");
// Win32 - Or set the file name of DDG2P model
//JChantSR1.setStringProperty(ChantStringProperty.CSPDDG2PModel, "C:\\Program Files\\Nuance\\vocon3200\\EDS_v4_1\\models\\ddg2p_enu_vadvde_ttsasr_large_v2_1_3.dat");

// Define field definition grammar
int grammarVocabID = JChantSR1.defineResource(ChantSpeechResource.CSRNativeGrammarVocab, "vde_pass1.lcf");

// Define fields
JChantSR1.addResource(ChantSpeechResource.CSRStartField, grammarVocabID, "street");
JChantSR1.addResource(ChantSpeechResource.CSRStopField, grammarVocabID, "state2");
JChantSR1.addResource(ChantSpeechResource.CSRActivateField, grammarVocabID, "state");

// Define field data grammar
int grammarVocabID2 = JChantSR1.defineResource(ChantSpeechResource.CSRNativeGrammarVocab, "vde_pass2.fcf"); 

//  Only load and enable the field definition grammar vocabulary
JChantSR1.enableResource(ChantSpeechResource.CSRNativeGrammarVocab, grammarVocabID);

// Disable it
JChantSR1.disableResource(ChantSpeechResource.CSRNativeGrammarVocab, grammarVocabID);
    

WChantSR1.SetNumberProperty(CNPEngineAPI, CEVoCon4);
// Win32 - Set the path to the VoCon runtime libraries
WChantSR1.SetStringProperty(CSPEnginePath, "C:\\Program Files\\Nuance\\vocon3200\\EDS_v4_1\\bin\\winx86rls");
// Win32 - Set the file name of CLC model
WChantSR1.SetStringProperty(CSPCLCModel, "C:\\Program Files\\Nuance\\vocon3200\\EDS_v4_1\\models\\clc_enu_cfg3_v1_0_0.dat");
// Win32 - Or set the file name of DDG2P model
//WChantSR1.SetStringProperty(CSPDDG2PModel, "C:\\Program Files\\Nuance\\vocon3200\\EDS_v4_1\\models\\ddg2p_enu_vadvde_ttsasr_large_v2_1_3.dat");

// Define field definition grammar
var grammarVocabID = WChantSR1.DefineResource(CSRNativeGrammarVocab, "file:///c:/vde_pass1.lcf");

// Define fields
WChantSR1.AddResource(CSRStartField, grammarVocabID, "street");
WChantSR1.AddResource(CSRStopField, grammarVocabID, "state2");
WChantSR1.AddResource(CSRActivateField, grammarVocabID, "state");

// Define field data grammar
int grammarVocabID2 = WChantSR1.DefineResource(CSRNativeGrammarVocab, "file:///c:/vde_pass2.fcf"); 

//  Only load and enable the field definition grammar vocabulary
WChantSR1.EnableResource(CSRNativeGrammarVocab, grammarVocabID);

// Disable it
WChantSR1.DisableResource(CSRNativeGrammarVocab, grammarVocabID);
    

Dim WithEvents XChantSR1 As XChantSR
Dim grammarVocabID as Integer
Dim grammarVocabID2 as Integer
XChantSR1.SetNumberProperty CNPEngineAPI, CEVoCon4
' Win32 - Set the path to the VoCon runtime libraries
XChantSR1.SetStringProperty CSPEnginePath, "C:\Program Files\Nuance\vocon3200\EDS_v4_1\bin\winx86rls"
' Win32 - Set the file name of CLC model
XChantSR1.SetStringProperty ChantStringProperty.CSPCLCModel, "C:\Program Files\Nuance\vocon3200\EDS_v4_1\models\clc_enu_cfg3_v1_0_0.dat"
' Win32 - Or set the file name of DDG2P model
'XChantSR1.SetStringProperty ChantStringProperty.CSPDDG2PModel, "C:\Program Files\Nuance\vocon3200\EDS_v4_1\models\ddg2p_enu_vadvde_ttsasr_large_v2_1_3.dat"

' Define field definition grammar
grammarVocabID = XChantSR1.DefineResource(CSRNativeGrammarVocab, App.Path & "\vde_pass1.lcf")

' Define fields
XChantSR1.AddResource CSRStartField, grammarVocabID, "street"
XChantSR1.AddResource CSRStopField, grammarVocabID, "state2"
XChantSR1.AddResource CSRActivateField, grammarVocabID, "state"

' Define field data grammar
grammarVocabID2 = XChantSR1.DefineResource(CSRNativeGrammarVocab, "vde_pass2.fcf")

'  Only load and enable the field definition grammar vocabulary
XChantSR1.EnableResource CSRNativeGrammarVocab, grammarVocabID

' Disable it
XChantSR1.DisableResource CSRNativeGrammarVocab, grammarVocabID
        

Dim WithEvents NChantSR1 As NChantSR
Dim grammarVocabID As Integer
grammarVocabID2 As Integer
' Instantiate ChantSR object
NChantSR1 = New NChantSR(Me)
NChantSR1.SetNumberProperty(ChantNumberProperty.CNPEngineAPI, ChantEngineAPI.CEVoCon4)
' Win32 - Set the path to the VoCon runtime libraries
NChantSR1.SetStringProperty(ChantStringProperty.CSPEnginePath, "C:\Program Files\Nuance\vocon3200\EDS_v4_1\bin\winx86rls")
' Win32 - Set the file name of CLC model
NChantSR1.SetStringProperty(ChantStringProperty.CSPCLCModel, "C:\Program Files\Nuance\vocon3200\EDS_v4_1\models\clc_enu_cfg3_v1_0_0.dat")
' Win32 - Or set the file name of DDG2P model
'NChantSR1.SetStringProperty(ChantStringProperty.CSPDDG2PModel, "C:\Program Files\Nuance\vocon3200\EDS_v4_1\models\ddg2p_enu_vadvde_ttsasr_large_v2_1_3.dat")

' Define field definition grammar
grammarVocabID = NChantSR1.DefineResource(ChantSpeechResource.CSRNativeGrammarVocab, "vde_pass1.lcf")

' Define fields
NChantSR1.AddResource(ChantSpeechResource.CSRStartField, grammarVocabID, "street")
NChantSR1.AddResource(ChantSpeechResource.CSRStopField, grammarVocabID, "state2")
NChantSR1.AddResource(ChantSpeechResource.CSRActivateField, grammarVocabID, "state")

' Define field data grammar
grammarVocabID2 = NChantSR1.DefineResource(ChantSpeechResource.CSRNativeGrammarVocab, "vde_pass2.fcf");

'  Only load and enable the field definition grammar vocabulary
NChantSR1.EnableResource(ChantSpeechResource.CSRNativeGrammarVocab, grammarVocabID)

' Disable it
NChantSR1.DisableResource(ChantSpeechResource.CSRNativeGrammarVocab, grammarVocabID)