menuRule = grammar.Rules.Add("MenuCommands", SpeechRuleAttributes.SRATopLevel | SpeechRuleAttributes.SRADynamic, 1);
menuRule.InitialState.AddWordTransition(null, "a", " ", SpeechGrammarWordType.SGLexical, "a", i, ref PropValue, 1.0F);
到底这两句是什么意思?
还有,menuRule.InitialState.AddWordTransition最多能循环几次啊?因为我试过循环添加500次,然后执行grammar.Rules.Commit();就出问题了
The AddWordTransition method adds a word transition from this rule state to another rule state in the same rule.When the word sequence specified by the word transition is spoken, the rule can go from this state to the DestinationState. A rule accepts a word sequence when the rule can go from the initial state to the end state using the word sequence.
ISpeechGrammarRuleState.AddWordTransition(
DestinationState As ISpeechGrammarRuleState,
Words As String,
[Separators As String = " "],
[Type As SpeechGrammarWordType = SGLexical],
[PropertyName As String = ""],
[PropertyId As Long = 0],
[PropertyValue As Variant = 0],
[Weight As Single = 1.0]
)Parameters
DestinationState
Specifies the DestinationState, or the state where the transition ends. DestinationState of Nothing means the end state of the rule.
Words
Specifies the Words.
Separators
[Optional] Specifies the Separators.
PropertyName
[Optional] Specifies the PropertyName.
PropertyId
[Optional] Specifies the PropertyId.
PropertyValue
[Optional] Specifies the PropertyValue.
Weight
[Optional] Specifies the Weight.
Return Value
None.