Export (0) Print
Expand All

ISpGrammarBuilder::AddWordTransition (SAPI 5.4)

Speech API 5.4
Microsoft Speech API 5.4


ISpGrammarBuilder::AddWordTransition adds a word or a sequence of words to the grammar.

HRESULT AddWordTransition(
   SPSTATEHANDLE          hFromState,
   SPSTATEHANDLE          hToState,
   LPCWSTR               *psz,
   LPCWSTR               *pszSeparators,
   float                  Weight,
   const SPPROPERTYINFO  *pPropInfo


[in] Handle of the state from which the arc (or sequence of arcs in the case of multiple words) should originate.
[in] Handle of the state where the arc (or sequence of arcs) should terminate. If NULL, the final arc will be to the (implicit) terminal node of this grammar rule.
[in] Address of a null-terminated string containing the word or words to be added. If psz is NULL, an epsilon arc will be added.
[in] Address of a null-terminated string containing the transition word separation characters.
psz points to a single word if pszSeperators is NULL, or else pszSeperators specifies the valid separator characters. This parameter may not contain a forward slash ("/") as that is used for the complex word format.
[in] The SPGRAMMARWORDTYPE enumeration that specifies the word type. SAPI 5.1 supports only SPWT_LEXICAL. SAPI 5.3 supports SPWT_LEXICAL and SPWT_LEXICAL_NO_SPECIAL_CHARS. If neither of these are specified, the method returns E_INVALIDARG.
[in] Value specifying the arc's relative weight in case there are multiple arcs originating from hFromState.
[in] The SPPROPERTYINFO structure containing property name and value information that is associated with this arc or sequence of arcs.

Return values

S_OKFunction completed successfully.
E_INVALIDARGAt least one of psz, pszSeparators, or pPropInfo is invalid or bad; eWordType is a value other than SPWT_LEXICAL; flWeight is less than 0.0; a slash ("/") is used as a separators.
SPERR_WORDFORMAT_ERRORInvalid word format.
E_OUTOFMEMORYExceeded available memory.
FAILED(hr)Appropriate error message.
© 2015 Microsoft