Share via


ISpGrammarBuilder::AddWordTransition

Other versions of this page are also available for the following:

Windows Mobile Not SupportedWindows Embedded CE Supported

8/28/2008

This method adds a word or a sequence of words to the grammar.

Syntax

HRESULT AddWordTransition(
  SPSTATEHANDLE hFromState,
  SPSTATEHANDLE hToState,
  const WCHAR* psz,
  const WCHAR* pszSeperators,
  SPGRAMMARWORDTYPE eWordType,
  float Weight,
  const SPPROPERTYINFO* pPropInfo
);

Parameters

  • hFromState
    [in] Handle of the state at which the arc (or sequence of arcs in the case of multiple words) should originate.
  • hToState
    [in] Handle of the state at which the arc (or sequence of arcs) should terminate. If NULL the final arc will be to the (implicit) terminal node of this grammar rule.
  • psz
    [in] Pointer to a null-terminated string containing the word or words to add. If psz is NULL, then an epsilon arc is added.
  • pszSeperators
    [in] Pointer to a null-terminated string containing the transition word separation characters. If this pointer is NULL, psz points to a single word. Otherwise, pszSeperators specifies the valid separator characters. This parameter cannot contain a forward slash ("/") as that is used for the complex word format.
  • eWordType
    [in] A value that specifies the word type. Possible values are defined for the SPGRAMMARWORDTYPE enumeration. Currently, only SPWT_LEXICAL is supported.
  • Weight
    [in] Value specifying the relative weight of the arc, in case there are multiple arcs originating at the state indicated by hFromState.
  • pPropInfo
    [in] Pointer to an SPPROPERTYINFO structure containing property name and value information associated with the arc or sequence of arcs.

Return Value

The following table shows the possible return values.

Value Description

S_OK

Function completed successfully.

E_INVALIDARG

At 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 seperators.

SPERR_WORDFORMAT_ERROR

Invalid word format.

E_OUTOFMEMORY

Exceeded available memory.

FAILED(hr)

Appropriate error message.

Requirements

Header sapi.h, sapi.idl
Library sapilib.lib
Windows Embedded CE Windows CE .NET 4.1 and later

See Also

Reference

ISpGrammarBuilder
SAPI Interfaces