Share via


ISpGrammarBuilder::AddRuleTransition

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 rule (reference) transition from one grammar rule to another.

Syntax

HRESULT AddRuleTransition(
  SPSTATEHANDLE hFromState,
  SPSTATEHANDLE hToState,
  SPSTATEHANDLE hRule,
  float Weight,
  const SPPROPERTYINFO* pPropInfo
);

Parameters

  • hFromState
    [in] Handle of the state at which the arc should originate.
  • hToState
    [in] Handle of the state at which the arc should terminate. If NULL the final arc will be to the terminal node (implicit) of the grammar rule.
  • hRule
    [in] Handle of any state of the rule to be called with this transition. Get the hRule using the ISpGrammarBuilder::GetRule call. To refer to a rule in another grammar, "import" that rule by calling ISpGrammarBuilder::GetRule( ... , SPRF_Import, TRUE /*fCreatIfNotExist*/, ...).

    The following table shows the special transition handles for hRule.

    Transition handle Description

    SPRULETRANS_WILDCARD

    <WILDCARD> transition

    SPRULETRANS_DICTATION

    <DICTATION> single word from dictation

    SPRULETRANS_TEXTBUFFER

    <TEXTBUFFER> transition

  • Weight
    [in] Value specifying the relative weight of the arc in case there are multiple arcs originating at the value specified by hFromState.
  • pPropInfo
    [in] Pointer to a SPPROPERTYINFO structure containing property name and value information that is associated with the arc.

Return Value

The following table shows the possible return values.

Value Description

S_OK

Function completed successfully.

E_INVALIDARG

At least one of the parameters is invalid.

E_OUTOFMEMORY

Not enough memory to complete operation.

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