/*ADDS WORDS TO THE GRAMMAR*/ private void SAPIGrammarFromArrayList(ArrayList phraseList) { object propertyValue = ""; int i; for (i = 0; i < phraseList.Count; i++) { rule = grammar.Rules.Add(phraseList[i].ToString(), SpeechRuleAttributes.SRATopLevel, i + 100); //add new word to the rule state = rule.InitialState; propertyValue = ""; //state.AddWordTransition(null, command1.phrase, " ", // SpeechGrammarWordType.SGLexical, "", // 0, ref propertyValue, 1F); state.AddWordTransition(null, phraseList[i].ToString(), " ", SpeechGrammarWordType.SGLexical, "", 0, ref propertyValue, 1F); //commit rules grammar.Rules.Commit(); //make rule active (needed for each rule) grammar.CmdSetRuleState(phraseList[i].ToString(), SpeechRuleState.SGDSActive); } }
void add_transition(MetaNode item, ISpeechGrammarRuleState source, ISpeechGrammarRuleState destination, ISpeechGrammarRule rule) { object prop = item.get_path(); source.AddRuleTransition(destination, rule, (string)prop, ++cx, ref prop, 1.0f); }
void add_node(MetaNode item, ISpeechGrammarRuleState source, ISpeechGrammarRuleState destination) { object prop = item.get_path(); source.AddWordTransition(destination, (string)item["words"].value, " ", SpeechGrammarWordType.SGLexical, (string)prop, ++cx, ref prop, 1.0f); }
void add_transition(object prop, ISpeechGrammarRuleState source, ISpeechGrammarRuleState destination, ISpeechGrammarRule rule) { source.AddRuleTransition(destination, rule, (string)prop, ++cx, ref prop, 1.0f); }
void add_node(string item, ISpeechGrammarRuleState source, ISpeechGrammarRuleState destination) { object prop = item; source.AddWordTransition(destination, item, " ", SpeechGrammarWordType.SGLexical, (string)prop, ++cx, ref prop, 1.0f); }