You are reading help file online using chmlib.com
|
ISpLexicon::AddPronunciation adds word pronunciations and parts of speech (POS) to the user lexicon. .
HRESULT AddPronunciation(
const WCHAR *pszWord,
LANGID LangID,
SPPARTOFSPEECH ePartOfSpeech,
const SPPHONEID *pszPronunciation
);
Value | Description |
---|---|
S_OK | Function completed successfully. |
E_INVALIDARG | At least one of the parameters is not valid. |
SP_ALREADY_IN_LEX | The same pronunciation of the word already exists in the user lexicon. |
SPERR_APPLEX_READ_ONLY | Cannot add a word to application lexicon. |
SPERR_UNINITIALIZED | The interface has not been initialized. |
E_OUTOFMEMORY | Exceeded available memory. |
FAILED(hr) | Appropriate error message. |
See the documentation on ISpPhoneConverter for more information on phone sets.
SAPI will not modify the word if spelling, pronunciation, and POS are the same as an existing entry in the user lexicon. A word can be added without pronunciation by passing in NULL as the pszPronunciation
The following is an example of AddPronunciation.
HRESULT hr;
CComPtr<ISpLexicon> cpLexicon;
hr = cpLexicon.CoCreateInstance(CLSID_SpLexicon);
// 0x409 for English
LANGID langidUS = MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US);
CComPtr cpPhoneConv;
SPPHONEID wszId[SP_MAX_PRON_LENGTH];
if(SUCCEEDED(hr))
{
hr = SpCreatePhoneConverter(langidUS, NULL, NULL, &cpPhoneConv);
}
if(SUCCEEDED(hr))
{
hr = cpPhoneConv->PhoneToId(L"r eh d", wszId);
}
if(SUCCEEDED(hr))
{
hr = cpLexicon->AddPronunciation(L"red", langidUS, SPPS_Noun, wszId);
}
You are reading help file online using chmlib.com
|