SPDUI_AddRemoveWord

This variable defines the string for displaying UI to modify the lexicon.

It is not a SAPI 5 compliance requirement for a speech recognition engine to implement UI for SPDUI_AddRemoveWord.

When to Implement

If a speech engine is being written for the desktop or a graphical environment, users can modify the set of words that will be recognized or synthesized (see ISpLexicon).

The SDK sample application Dictation Pad allows the user to modify the lexicon. The menu item is listed in the "Voice" menu as "Add/Delete Words...". When the user selects this menu item, Dictation Pad directly accesses the default SR Engine's graphical lexicon editor by using SPDUI_AddRemoveWord. If the SR Engine does not support the Training UI (see ISpTokenUI::IsUISupported), then the menu item will be unavailable.

When to Access

The application could monitor the user's speech experience (correction type and frequency). If the user corrects a recognition by typing a word that is missing from the lexicon (see ISpLexicon), then the application could prompt the user to add it to the lexicon using ISpRecognizer::DisplayUI and SPDUI_AddRemoveWord.

#define SPDUI_AddRemoveWord        L"AddRemoveWord"

Example

The following code snippet illustrates the use of ISpTokenUI::IsUISupported using SPDUI_AddRemoveWord.

HRESULT hr = S_OK;

// get the default speech recognizer token
hr = SpGetDefaultTokenFromCategoryId(SPCAT_RECOGNIZERS, &cpObjectToken);
// Check hr

// get the object token's UI
hr = cpObjectToken->QueryInterface(&cpTokenUI);
// Check hr

// check if the default speech recognizer has UI for editing the lexicon 
hr = cpTokenUI->IsUISupported(SPDUI_AddRemoveWord, NULL, NULL, NULL, &fSupported);
// Check hr

// if fSupported == TRUE, then default speech recognizer has UI for modifying the lexicon 
The following code snippet illustrates the use of ISpRecognizer::DisplayUI using SPDUI_AddRemoveWord.

HRESULT hr = S_OK;

// display lexicon editing UI for the current recognizer
hr = cpRecognizer->DisplayUI(MY_HWND, MY_APP_MIC_TRAINING, SPDUI_AddRemoveWord, NULL, NULL);
// Check hr

See Also

SAPI Global Variables

 Last updated on Saturday, April 10, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.