SPDUI_AddRemoveWord

Microsoft Speech SDK

The Microsoft.com Speech website Microsoft Speech SDK SAPI 5.1

SPDUI_AddRemoveWord (C/C++)

SpeechAddRemoveWord (Automation)


SPDUI_AddRemoveWord 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 this UI for SPDUI_AddRemoveWord.

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).

Using the SDK sample application Dictation Pad, the user can modify the lexicon using the Voice menu-->Add/Delete Words. When the user selects this menu item, Dictation Pad directly accesses the default SR engine's graphical lexicon editor through SPDUI_AddRemoveWord. If the speech recognition (SR) engine does not support the Training UI (see ISpTokenUI::IsUISupported), 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), 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