IAPCSpeech::SetSpkContextRule

This method sets a context rule used to normalize a text string before sending the string to the text-to-speech (TTS) engine.

Syntax

HRESULT IAPCSpeech::SetSpkContextRule ( DWORD dwContextID, DWORD dwFlags, LPCTSTR lpctStr1, LPCTSTR lpctStr2, LPVOID p );

Parameters

dwContextID
Specifies the identifier of the context that new rule belongs to.
dwFlags
Specifies a bitmask for flags. It is one of the following values:
APCSPCH_TN_ADDR_CTX
Used with an address context.
APCSPCH_TN_PHONE_CTX
Used with a telephone context. When text contains three numbers and a dash, it is interpreted as a phone number.
APCSPCH_TN_SPELLING_CTX
Spells out a string letter by letter.
APCSPCH_TN_WORD
Replaces or deletes a word.
lpctStr1
Long pointer to the string to be replaced.
lpctStr2
Long pointer to the string that replaces lpctStr1. If NULL, lpctStr1 is removed.
p
Reserved; set to 0.

Return Values

An appropriate HRESULT value is returned.

Remarks

The following can be used as delimiters for this method:

In an address. numbers are usually pronounced differently. For example, 98052 would be “9-8-0-5-2,” while 5345 would be “fifty-three forty-five.” To use this special context, the application can create a text-to-speech (TTS) context and pass APCSPCH_TN_ADDR_CTX as the dwFlag in the SetSpkContextRule method.

For APCSPCH_TN_PHONE_CTX, the TTS engine pronounces the pound sign (#) as "pound," and the asterisk (*) as "star." The left brace, right brace, left bracket, right bracket, left parenthesis, right parenthesis, comma, period, caret, and space characters result in a pause in speech. The TTS engine combines multiple pauses into a single pause. The TTS engine always pronounces the number 0 as "zero." The TTS engine pronounces digits and letters individually, rather than stringing them together as large numbers or words.

If APCSPCH_TN_PHONE_CTX or APCSPCH_TN_SPELLING is set, all other flags are ignored.

APCSPCH_TN_WORD and APCSPCH_TN_ADDR_CTX can be combined.