我需要有关语音识别代码的帮助

时间:2016-04-25 23:10:59

标签: c#

首先抱歉我的英语不好,但我会尝试解释我的错误。我试图制作像Speech Recognition Bot这样的东西。我在youtube上观看视频。

虽然他写了" sRecognize.SpeechRecognized + ="他点击了" Tab"按钮,它添加" sRecognize_SpeechRecognized"在" ="之后。

但是当我点击Tab时,它会添加"新的EventHandler< SpeechRecognizedEventArgs>(sRecognize_SpeechRecognized);"

任何人都可以帮助我,我该怎么办?

public partial class Form1 : Form
   {

    public Form1()
    {
        InitializeComponent();
    }
    SpeechRecognizer sRecognize = new SpeechRecognizer();
    private void Form1_Load(object sender, EventArgs e)
    {
        sRecognize.SpeechRecognized +=new EventHandler<SpeechRecognizedEventArgs>(sRecognize_SpeechRecognized);
   }

1 个答案:

答案 0 :(得分:0)

我在这里修理它。

我刚刚在&#34; + =&#34;

之后添加了sRecognize_SpeechRecognized

并编写了以下代码。

void sRecognize_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
        {
            richTextBox1.AppendText(e.Result.Text.ToString() + " ");
        }

最后,它看起来像这样并且工作正常。

public partial class Form1 : Form
    {

        public Form1()
        {
            InitializeComponent();
        }
        SpeechRecognizer sRecognize = new SpeechRecognizer();
        private void Form1_Load(object sender, EventArgs e)
        {
            sRecognize.SpeechRecognized += sRecognize_SpeechRecognized;

        }
        void sRecognize_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
        {

        }