我已经完成了基于听写语法的文本代码的演讲,它工作正常,识别我的声音,但我发现它的类型,其他任何东西可以帮助我让它正确识别吗? [英] i have done speech to text code based on dictation grammar ,it is working fine ,recognizing my voice but what i pronounciate it types some other thing can anyone help me to make it recognize properly?
本文介绍了我已经完成了基于听写语法的文本代码的演讲,它工作正常,识别我的声音,但我发现它的类型,其他任何东西可以帮助我让它正确识别吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用System;
使用System.Collections.Generic;使用System.ComponentModel
;
使用System.Data;使用System.Drawing
;
使用System.Linq;
使用System.Text;
使用System.Windows.Forms;使用System.Speech.Recognition
;
名称空间speech2textt
{
公共部分类Form1:表格
{
public Form1()
{
InitializeComponent() ;
}
SpeechRecognitionEngine Engine = new SpeechRecognitionEngine();
DictationGrammar Grammar = new DictationGrammar();
private void button1_Click(object sender,EventArgs e)
{
SpeechRecognitionEngine rec = new SpeechRecognitionEngine();
rec.LoadGrammar(new Grammar(new GrammarBuilder(exit))); //加载语法
// rec.GrammarBuilder.Append(string);
rec.LoadGrammar(new DictationGrammar());
rec.SpeechRecognized + = speech1;
Engine.BabbleTimeout = TimeSpan.FromSeconds(10.0);
Engine.EndSilenceTimeout = TimeSpan.FromSeconds(10.0);
Engine.EndSilenceTimeoutAmbiguous = TimeSpan.FromSeconds(10.0);
Engine.InitialSilenceTimeout = TimeSpan.FromSeconds(10.0);
rec.SetInputToDefaultAudioDevice(); //将输入设置为默认音频设备
rec.RecognizeAsync(RecognizeMode.Multiple); //识别语音
}
void speech1(object sender,SpeechRecognizedEventArgs e)
{
if(e.Result.Text ==exit )
{
Application.Exit();
}
else
{
richTextBox1.AppendText(+ e.Result.Text);
}
}
private void Form1_Load(object sender,EventArgs e)
{
}
}
}
解决方案
基本上,你已经正确完成了。这是发动机本身的问题。你无能为力。您可以等到技术进步更多,或使用商业产品,如果口述承认,承诺更好的质量。
-SA
由于语音识别引擎是一个黑盒子,没有开放的修补程序,你有一个非常简单的解决方案:
缓慢而清晰地说话,尽量减少任何可能的重音。
OR,使用市面上可用的语音识别图书馆有更好的引擎。这很可能不是免费的。
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Speech.Recognition; namespace speech2textt { public partial class Form1 : Form { public Form1() { InitializeComponent(); } SpeechRecognitionEngine Engine = new SpeechRecognitionEngine(); DictationGrammar Grammar = new DictationGrammar(); private void button1_Click(object sender, EventArgs e) { SpeechRecognitionEngine rec = new SpeechRecognitionEngine(); rec.LoadGrammar(new Grammar(new GrammarBuilder("exit"))); // load grammar // rec.GrammarBuilder.Append(string); rec.LoadGrammar(new DictationGrammar()); rec.SpeechRecognized += speech1; Engine.BabbleTimeout = TimeSpan.FromSeconds(10.0); Engine.EndSilenceTimeout = TimeSpan.FromSeconds(10.0); Engine.EndSilenceTimeoutAmbiguous = TimeSpan.FromSeconds(10.0); Engine.InitialSilenceTimeout = TimeSpan.FromSeconds(10.0); rec.SetInputToDefaultAudioDevice(); // set input to default audio device rec.RecognizeAsync(RecognizeMode.Multiple); // recognize speech } void speech1(object sender, SpeechRecognizedEventArgs e) { if (e.Result.Text == "exit") { Application.Exit(); } else { richTextBox1.AppendText(" " +e.Result.Text); } } private void Form1_Load(object sender, EventArgs e) { } } }
解决方案
Basically, you have done it correctly. This is a problem of the engine itself. You cannot do much about that. You can wait until the technology advances more, or use a commercial product which promises better quality if dictation recognition.
—SA
Since the speech recognition engine is a "blackbox" for which there is no opening to tinker with it, you have one very simple solution to the problem:
Speak slowly and clearly, trying to minimize any possible heavy accent.
OR, use a commerically available speech recognition library with a better engine. This will most likely not be free of charge.
这篇关于我已经完成了基于听写语法的文本代码的演讲,它工作正常,识别我的声音,但我发现它的类型,其他任何东西可以帮助我让它正确识别吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文