【问题标题】:Speech Recognition all english words automatically语音自动识别所有英文单词
【发布时间】:2016-01-21 23:58:43
【问题描述】:

我有一个 Windows 窗体应用程序。我想做一个Voice Recognition。问题是我使用的Grammar 仅限于我的选择列表(请参阅下面的程序)。我希望我的程序能够识别所有单词。

Choices sList = new Choices();
sList.Add(new string[] { "hello", "test", "it works", "how", "are", "you", "today", "i", "am", "fine", "exit", "close", "quit", "so" });
    Grammar gr = new Grammar(new GrammarBuilder(sList));

你知道如何让我的程序识别所有单词吗?

源代码:

声明:

using System.Speech;
using System.Speech.Recognition;
using System.Speech.Synthesis;

计划:

private void button2_Click(object sender, EventArgs e)
{
    button2.Enabled = false; // Start record
    button3.Enabled = true;  // Stop record
    Choices sList = new Choices();
    sList.Add(new string[] { "hello", "test", "it works", "how", "are", "you", "today", "i", "am", "fine", "exit", "close", "quit", "so" });
    Grammar gr = new Grammar(new GrammarBuilder(sList));
    try
    {
        sRecognize.RequestRecognizerUpdate();
        sRecognize.LoadGrammar(gr);
        sRecognize.SpeechRecognized += sRecognize_SpeechRecognized ;
        sRecognize.SetInputToDefaultAudioDevice();
        sRecognize.RecognizeAsync(RecognizeMode.Multiple);
        sRecognize.Recognize();
    }
    catch
    {
        return;
    }
 }

private void sRecognize_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
{
    if (e.Result.Text == "exit")
    {
        Application.Exit();
    }
    else
    {
        textBox1.Text = textBox1.Text + " " + e.Result.Text.ToString(); 
    }

}

这个程序的问题是不能识别所有单词,对于我的项目,我想让它识别所有单词。

感谢 Stackoverflowers

【问题讨论】:

    标签: c# winforms speech-recognition


    【解决方案1】:

    如果我理解正确,你的意思,这应该正是你所需要的: 只需在 DictationMode 中使用 SpeechRecognitionEngine,即可识别单词(例如参见 http://csharp-tricks-en.blogspot.de/2011/03/speech-recognition-part-1-dictation-mode.html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多