ISpEnginePronunciation::Normalize (SAPI 5.3)
ISpEnginePronunciation::Normalize returns the list of normalized forms for a word. For an example call, see the Remarks section below.
HRESULT Normalize( LPCWSTR *pszWord, LPCWSTR pszLeftContext, LPCWSTR pszRightContext, LANGID LangID, SPNORMALIZATIONLIST *pNormalizationList );
- [in] The word or term for which normalization is desired (for example, "11.30"). This is case sensitive because the case may have a bearing on normalization. For example, "cat" is always "cat", but "CAT" may also be "C. A. T."; "lea" is always "lea", but may also be "Lea".
- [in] The left portion of a sentence or phrase in which pszWord is used. See the Remarks section below for more information.
- [in] The right portion of a sentence or phrase in which pszWord is used. See the Remarks section below for more information.
- [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.
- [out] Returns a list of alternative normalizations. The application must allocate the SPNORMALIZATIONLIST structure that pNormalizationList points to. The engine will allocate the space for the normalization list itself and provide a pointer to it in pNormalizationList>ppszzNormalizedList. The application is responsible for calling CoTaskMemFree on pNormalizationList>ppszzNormalizedList to release the allocation.
|S_OK||Function completed successfully.|
|S_NOTSUPPORTED||Indicates that the engine will not provide normalization for the given input and that pNormalizationList will be set to null.|
|S_LIMITREACHED||Indicates that the returned list is not exhaustive, but contains as many alternatives as the engine is willing to provide.|
For example, to normalize "XAML" in the string "Developers should use XAML to build Avalon applications", use a statement like the following:
pPron->Normalize("XAML", "Developers should use", "to build Avalon applications", 0, &pListOfNorms;);
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 normalizations based on the context in which a word is used. The following table lists one example of a selected normalization based on context:
|"11.30"||"The time is"||null|