Freigeben über


ISpRecoGrammar::IsPronounceable (Windows CE 5.0)

Send Feedback

This method calls the SR engine to determine if the word has a pronunciation.

See also ISpSREngine::IsPronounceable for more information on the SR engine's role.

Typically, there are two scenarios when an application may want to use the IsPronounceable.

If an application is using a number of specialized or uncommon words (for example, legal, medical, or scientific terms), the application may want to verify that the words are contained in either the lexicon (see also ISpLexicon) or the SR engine's dictionary. If the words are not contained in the lexicon or the dictionary (even if they are pronounceable), then the application may want to add them to the lexicon to improve their chances of a successful recognition.

An application may also want to verify that the SR engine will actually recognize the words in a CFG (even though loading the CFG succeeded). If the SR engine retrieves SPWP_UNKNOWN_WORD_UNPRONOUNCEABLE, then the application can update the lexicon pronunciation entry (see ISpLexicon).

HRESULT IsPronounceable(const WCHAR* pszWord,SPWORDPRONOUNCEABLE* pfPronounceable);

Parameters

  • pszWord
    [in] Pointer to the word to test. Length must be less than or equal to SP_MAX_WORD_LENGTH.

  • pfPronounceable
    [out] Pointer to a value indicating if the word SR engine can pronounce the word. Possible values are defined by the SPWORDPRONOUNCEABLE enumeration. See Remarks section.

  • Beth -- move to enumerations.//

    Value Description
    SPWP_UNKNOWN_WORD_UNPRONOUNCEABLE The word is not pronounceable by the SR engine, and is not located in the lexicon and, or the engine's dictionary.
    SPWP_UNKNOWN_WORD_PRONOUNCEABLE The word is pronounceable by the SR engine, but is not located in the lexicon and, or the engine's dictionary.
    SPWP_KNOWN_WORD_UNPRONOUNCEABLE The word is pronounceable by the SR engine, and is located in the lexicon and, or the engine's dictionary.

Return Values

The following table shows the possible return values.

Value Description
S_OK Function completed successfully.
E_POINTER Either pszWord or pfPronounceable is invalid or bad.
FAILED(hr) Appropriate error message.

Remarks

The exact implementation and use for the SR engine's dictionary and pronounceable words can vary between SR engines. For example, an SR engine can attempt to pronounce all words passed using IsPronounceable, even if it is not located in the lexicon or the dictionary, it would rarely or never retrieve SPWP_UNKNOWN_WORD_UNPRONOUNCEABLE.

Example

The following code snippet illustrates the use of this method. The words used are examples only, as the pronunciation by different SR engines can vary. See Remarks section.

HRESULT hr = S_OK;
// check if a common word is pronounceable
hr = cpRecoGrammar->IsPronounceable(L"hello", &wordPronounceable);
// Check hr
// wordPronounceable is probably equal to SPWP_KNOWN_WORD_PRONOUNCEABLE
// check if an uncommon, or imaginary, word is pronounceable
hr = cpRecoGrammar->IsPronounceable(L"snork", &wordPronounceable);
// Check hr
// wordPronounceable is probably equal to SPWP_UNKNOWN_WORD_PRONOUNCEABLE
// check if a non-word, or imaginary, word is unpronounceable
hr = cpRecoGrammar->IsPronounceable(L"lpdzsd", &wordPronounceable);
// Check hr
// wordPronounceable is probably equal to SPWP_UNKNOWN_WORD_UNPRONOUNCEABLE

Requirements

OS Versions: Windows CE .NET 4.1 and later.
Header: Sapi.h, Sapi.idl.
Link Library: Sapilib.lib.

See Also

ISpRecoGrammar | SAPI Interfaces

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.