CHMlib Logo Leading Translation Management System for Translation Agencies, Top Translation Management Software for Freelance Translators, Time Tracking Software, Word Count, Character Count and Line Count Software, Computer Assisted Translation Tool for Easy Word Count, Clipboard Character Count Software, User-Friendly Translation Memory Software, Terminology Management Software, Terminology Management Server, Microsoft Glossary Software, Dictionary of Acronyms, Social Network for Translators and Translation Agencies, Acronyms and Abbreviations Search Engine, Russian Translation Lab, Ukrainian Translation Lab.
You are reading help file online using chmlib.com
CrisisHelper - First Aid in Tough Times of World Economic Crisis


The Microsoft.com Speech website Microsoft Speech SDK

SAPI 5.1

ISpLexicon::AddPronunciation

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

Parameters

pszWord
[in] The word to add.
LangID
[in] The language ID of the word. The speech user default will be used if LANGID is omitted. Length must be equal to or less than SP_MAX_WORD_LENGTH.
ePartOfSpeech
[in] The part of speech of type SPPARTOFSPEECH.
pszPronunciation
[in] Null-terminated pronunciation of the word in the NUM phone set. Multiple pronunciations may be added for a single word.  The length must be equal to or less than SP_MAX_PRON_LENGTH.  pszPronunciation may be NULL.

Return values

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.

Remarks

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

Example

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

If you want your help file to be removed or added please send e-mail to chmlibcom@gmail.com
Partner sites: Logo Design, Simple Anti-Crisis Accounting Software, Voice Search for Web