简体   繁体   English

语音自动识别所有英语单词

[英]Speech Recognition all english words automatically

I have a windows form application. 我有一个Windows窗体应用程序。 I want to make a Voice Recognition . 我想做一个Voice Recognition The problem is the Grammar i used is limited from my choices list (see the program below). 问题是我使用的Grammar仅限于我的选择列表(参见下面的程序)。 I want to my program be able to recognise all words. 我希望我的程序能够识别所有单词。

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));

Do you know how can i make my program recognise all words ? 你知道我怎么能让我的程序识别所有单词?

Source code : 源代码 :

Declaration : 宣言 :

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

Program : 计划:

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(); 
    }

}

The problem with this program don't recognise all words, and for my project i want to make it recognise all words. 这个程序的问题无法识别所有单词,对于我的项目,我想让它识别所有单词。

Thanks Stackoverflowers 谢谢Stackoverflowers

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM