You are reading help file online using chmlib.com
|
ISpRecoGrammar::IsPronounceable calls the SR engine object to determine if the word has a pronunciation.
HRESULT IsPronounceable(
const WCHAR *pszWord,
SPWORDPRONOUNCEABLE *pfPronounceable
);
Value 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_PRONOUNCEABLE The word is pronounceable by the SR engine, and is located in the lexicon and/or the engine's dictionary.
Value | Description |
---|---|
S_OK | Function completed successfully. |
E_POINTER | Either pszWord or pfPronounceable is invalid or bad. |
FAILED (hr) | Appropriate error message. |
The exact implementation and usage for the SR engine's dictionary and pronounceable words may vary between engines. For example, an SR engine may 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, return SPWP_UNKNOWN_WORD_UNPRONOUNCEABLE.
Typically, there are two scenarios when an application might use the method ::IsPronounceable.
If an application is using a number of specialized or uncommon words (e.g., 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), the application can add them to the lexicon to improve the 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 returns SPWP_UNKNOWN_WORD_UNPRONOUNCEABLE, the application can update the lexicon pronunciation entry (see ISpLexicon).
See also ISpSREngine::IsPronounceable for more information on the SR engine's role.
The following code snippet illustrates the use of ISpRecoGrammar:IsPronounceable. The words used are examples only, as the pronounceability by different SR engines may 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
You are reading help file online using chmlib.com
|