ISpGrammarBuilder::AddRuleTransition (SAPI 5.3)

Microsoft Speech API 5.3

ISpGrammarBuilder::AddRuleTransition

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

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

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_DICTATION <DICTATION> single word from dictation
    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
S_OK
E_INVALIDARG
E_OUTOFMEMORY
FAILED(hr)