Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        /*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);
            }
        }
Exemplo n.º 3
0
        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);
        }