Exemplo n.º 1
0
 public Meta_Grammar(Speech_Recognizer new_engine)
 {
     engine  = new_engine;
     grammar = engine.context.CreateGrammar(100);
     //grammar2 = engine.context.CreateGrammar(101);
     //grammar2.State = SpeechGrammarState.SGSEnabled;
     enabled = true;
 }
Exemplo n.º 2
0
        //public void create_dictation(Action_Library library)
        //{
        //    grammar.DictationLoad("", SpeechLoadOption.SLOStatic);
        //    grammar.DictationSetState(SpeechRuleState.SGDSActive);
        //    grammar.State = SpeechGrammarState.SGSDisabled;
        //    is_dictation = true;
        //    engine.grammars.Add((Decimal)0, this);
        //    //recognized += new Recognition_Event(library.Familiar_Grammar_recognized);
        //}

        //public void create(Speech_Recognizer engine, Familiar_Document document)
        //{
        //    grammar = engine.context.CreateGrammar(0);
        //    grammar.State = SpeechGrammarState.SGSDisabled;
        //    ISpeechGrammarRule rule = grammar.Rules.Add("root", SpeechRuleAttributes.SRATopLevel | SpeechRuleAttributes.SRADefaultToActive, 0);
        //    //ISpeechGrammarRuleState state = grammar.Rules.Item(0).AddState();
        //    //ISpeechGrammarRuleState state2 = grammar.Rules.Item(0).AddState();

        //    object temp = "";
        //    rule.InitialState.AddWordTransition(null, "bob it", " ", SpeechGrammarWordType.SGLexical, "", 0, ref temp, 1.0f);
        //    //string error;
        //    grammar.Rules.Commit();//(out error);
        //    //foreach (Element_Base rule in document.rules)
        //    //{
        //    //    //grammar.Rules.Add(
        //    //    //choice.Add(create_choices(rule));
        //    //}
        //    grammar.State = SpeechGrammarState.SGSEnabled;
        //    //engine.context.
        //    grammar.CmdSetRuleIdState(0, SpeechRuleState.SGDSActive);
        //}

        //    static protected Decimal next_id = 1;

        public Familiar_Grammar(Speech_Recognizer new_engine)
        {
            engine = new_engine;

            Decimal next_id = 1;

            while (engine.grammars.ContainsKey(next_id))
            {
                ++next_id;
            }

            grammar = engine.context.CreateGrammar(next_id);
            //      grammar.DictationSetState(SpeechRuleState.SGDSActive);
            engine.grammars.Add(next_id, this);
        }