Export (0) Print
Expand All

ISpEnginePronunciation::GetPronunciations (SAPI 5.3)

Speech API 5.3
Microsoft Speech API 5.3

ISpEnginePronunciation::GetPronunciations

ISpEnginePronunciation::GetPronunciations returns all the pronunciations the engine knows about for a given word.


HRESULT GetPronunciations(
   LPCWSTR                    *pszWord,
   LPCWSTR                     pszLeftContext,
   LPCWSTR                     pszRightContext,
   LANGID                      LangID,
   SPWORDPRONUNCIATIONLIST    *pEnginePronunciationList
);

Parameters

pszWord
[in] The word or term for which a pronunciation is desired (for example, "record"). This is case sensitive.
pszLeftContext
[in] The left portion of a sentence or phrase in which pszWord is used. See the Remarks section below for more information.
pszRightContext
[in] The right portion of a sentence or phrase in which pszWord is used. See the Remarks section below for more information.
LangID
[in] The ID of the language. This parameter is useful if an engine supports multiple languages. To use the engine's default language, set the ID to 0.
pEnginePronunciationList
[out] Returns a list of pronunciations. The application must allocate the SPWORDPRONUNCIATIONLIST structure that pEnginePronunciationList points to. The engine will allocate the space for the pronunciation list itself and provide a pointer to it in pEnginePronunciationList>pvBuffer. The application is responsible for calling CoTaskMemFree() on pEnginePronunciationList>pvBuffer to release the allocation.

Return values

ValueDescription
S_OKFunction completed successfully.
S_NEEDSNORMALIZATIONIndicates that the word in pszWord needs to be normalized before pronunciations can be provided. All values in pEnginePronunciationList will be set to 0.
S_NEEDSWORDBREAKIndicates that pszWord contains multiple words. The application should call Normalize to break it into individual words and then call GetPronunciation again with the specific word of interest.
S_NOTSUPPORTEDIndicates that the engine will not provide pronunciation for the given input. All values in pEnginePronunciationList will be set to 0.

Remarks

The pszLeftContext and pszRightContextparameters are always case sensitive and either of them can be set to null, in which case the engine ignores the parameter. In addition, the engine may ignore any context string.

Some engines (generally TTS) select pronunciations based on the context in which a word is used. The following table lists two examples of selected pronounciations based on context:

pszWordpszLeftContextpszRightContext
"record"null"your message"
"record""the hottest temperature on"null
Show:
© 2014 Microsoft