ISpGrammarBuilder::AddRuleTransition (Microsoft Speech Platform)

Microsoft Speech Platform SDK 11

Microsoft Speech Platform

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 handleDescription
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 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.