示例#1
0
        //public Familiar_Grammar create_dictation_grammar( )
        //{
        //    Familiar_Grammar new_grammar = new Familiar_Grammar();
        //    new_grammar.create_dictation(this);
        //    return new_grammar;
        //}

        void context_FalseRecognition(int StreamNumber, object StreamPosition, ISpeechRecoResult Result)
        {
            Feedback.print("!\r\n", Feedback.Status.debug);
            Familiar_Result result = new Familiar_Result(context, Result);

            result.display("(!) ");
        }
示例#2
0
        void context_Recognition(int StreamNumber, object StreamPosition, SpeechRecognitionType RecognitionType, ISpeechRecoResult Result)
        {
            if (context.AudioInputInterferenceStatus == SpeechInterference.SINoise)
            {
                return;
            }

            //      Feedback.print(string.Format("Result = {0} {1}\r\n", StreamNumber, context.AudioInputInterferenceStatus), Feedback.Status.debug);
            Feedback.print(string.Format("Result = {0}, {1}\r\n", Result.PhraseInfo.GetText(0, -1, true), Result.PhraseInfo.Elements.Item(0).EngineConfidence), Feedback.Status.debug);
            Profiler.initialize();
            Familiar_Result result = new Familiar_Result(context, Result);

            //            Familiar_Result result = get_result("> ", Result);
            //          result.display("> ");
            Profiler.trace("result created");

            Feedback.print(string.Format("Element Count = {0}\r\n", Result.PhraseInfo.Elements.Count), Feedback.Status.debug);
            foreach (Token word in result.chosen_phrase.words)
            {
                Feedback.print(string.Format("{0} ({1}, {2})\r\n", word.text, word.confidence, word.source.document.name), Feedback.Status.debug);
            }

            //if (Result.PhraseInfo.Elements.Count == 1 && result.chosen_phrase.words[0].confidence < 0.6)
            //    return;

            result.run();

            if (recognized != null)
            {
                recognized.Invoke(this, result);
            }
        }
        public Familiar_Phrase(ISpeechPhraseInfo new_phrase, Familiar_Result new_result)
        {
            phrase = new_phrase;
            result = new_result;
            // This is a little hacked up but it's very efficient
            id = result.options.Count + 1;

            process();
        }