Share via


Note

Please see Azure Cognitive Services for Speech documentation for the latest supported speech solutions.

Microsoft Speech Platform

ISpGrammarBuilder::AddRuleTransition

ISpGrammarBuilder::AddRuleTransition adds a rule (reference) transition from one grammar rule to another.

<pre IsFakePre="true" xmlns="http://www.w3.org/1999/xhtml"> <strong>HRESULT AddRuleTransition(</strong> <strong> SPSTATEHANDLE</strong> <em>hFromState</em>, <strong> SPSTATEHANDLE</strong> <em>hToState</em>, <strong> SPSTATEHANDLE</strong> <em>hRule</em>, <strong> float</strong> <em>Weight</em>, <strong>const</strong> <strong><a runat="server" href="jj127877(v=msdn.10).md">SPPROPERTYINFO</a></strong> *<em>pPropInfo</em> <strong>);</strong> </pre>

Parameters

  • hFromState
    [in] Handle of the state from which the arc should originate.

  • hToState
    [in] Handle of the state where the arc should terminate. If NULL, the final arc will be to the (implicit) terminal node of this 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, and "import" that rule by calling ISpGrammarBuilder::GetRule( ... , SPRAF_Import, TRUE /*fCreatIfNotExist*/, ...).

    hRule can also be one of the following special transition handles:

    Transition handle Description
    SPRULETRANS_WILDCARD <WILDCARD> transition
    SPRULETRANS_TEXTBUFFER <TEXTBUFFER> transition
  • Weight
    [in] Value specifying the arc's relative weight in case there are multiple arcs originating from hFromState.

  • pPropInfo
    [in] The SPPROPERTYINFO structure containing property name and value information that is associated with this arc.

Return Values

Value Description
S_OK Function completed successfully.
E_INVALIDARG At least one parameter is invalid.
E_OUTOFMEMORY Not enough memory to complete operation.
FAILED(hr) Appropriate error message.