Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Microsoft Speech API 5.3
ISpLexicon::GetPronunciations
ISpLexicon::GetPronunciations gets pronunciations and parts of speech for a word.
HRESULT GetPronunciations(
LPCWSTR *pszWord,
LANGID LangID,
DWORD dwFlags,
SPWORDPRONUNCIATIONLIST *pWordPronunciationList
);
Parameters
- pszWord
[in] Pointer to a null-terminated text string as a search keyword. Length must be equal to less than SP_MAX_WORD_LENGTH. - LangID
[in] The language ID of the word. May be zero to indicate that the word can be of any LANGID. - dwFlags
[in] Bitwise flags of type SPLEXICONTYPE indicating that the lexicons searched for this word. - pWordPronunciationList
[in, out] Pointer to SPWORDPRONUNCIATIONLIST structure in which the pronunciations and parts of speech are returned.
Return values
| Value |
| S_OK |
| SP_WORD_EXISTS_WITHOUT_PRONUNCIATION |
| E_POINTER |
| E_INVALIDARG |
| E_OUTOFMEMORY |
| SPERR_UNINITIALIZED |
| SPERR_NOT_IN_LEX |
| FAILED(hr) |
Example
The following example is a code fragment demonstrating the use of GetPronunciations.
// Declare local identifiers:
HRESULT hr = S_OK;
CComPtr<ISpLexicon> cpLexicon;
SPWORDPRONUNCIATIONLIST *pwordpronlist;
SPWORDPRONUNCIATION *pwordpron;
memset(pwordpronlist, 0, sizeof(pwordpronlist));
hr = cpLexicon->GetPronunciations(L"resume", 409, eLEXTYPE_USER | eLEXTYPE_APP, pwordpronlist);
if( SUCCEEDED(hr))
{
for (pwordpron = pwordpronlist->pFirstWordPronunciation;
pwordpron != NULL;
pwordpron = pwordpron->pNextWordPronunciation)
{
// Do something with the SPWORDPRONUNCIATION structure's
// members (for example, ePartOfSpeech and szPronunciation).
}
}
// Free all the buffers.
CoTaskMemFree(pwordpronlist.pvBuffer);