开发者

Speech Recognition Engine will not recognize multiple times

With the code below it works and return the first recognition, but not the everything else. What am I doing wrong? Am I suppose to be in some kind of loop?

    public void Transcribe()
    {
        SpeechRecognitionEngine SRE = new SpeechRecognitionEngine();
        SRE.LoadGrammar(new DictationGrammar());

        SRE.SetInputToWaveFile(_fileName);
        SRE.SpeechRecognized += new EventHandler<SpeechRecognizedEventArg开发者_Python百科s>(SRE_SpeechRecognized);
        SRE.RecognizeCompleted += new EventHandler<RecognizeCompletedEventArgs>(SRE_RecognizeCompleted);
        SRE.RecognizeAsync(RecognizeMode.Multiple);    
    }

    void SRE_RecognizeCompleted(object sender, RecognizeCompletedEventArgs e)
    {
        Console.WriteLine(e.Result.Text);
    }

    void SRE_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
    {            
    }


Use SpeechRecognized as your event handler to do the Console.WriteLine(). I ran into the same thing just now.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜