如何区分命令与普通对话-C#中的语音识别 [英] How to distinguish commands from normal conversation - Speech Recognition in C#
问题描述
大家好,
我是语音识别和C#的新手.我正在一个项目中,该项目包括将命令与正常对话区分开来.我添加了一个自定义语法,用于标识四个命令(截至目前),即下一个",上一个","home","end".
但是,当我说一些普通的句子/单词时,SpeechRecognitionEngine将这些单词与自定义语法中的单词相关联并采取相应的措施.我也尝试了"RecognizedWordUnit.Confidence"属性,它在一定程度上但未完全纠正该问题.
任何人都建议,我怎样才能使我的语音引擎很好地识别命令字词,而忽略其余语音.
谢谢
Manjinder
Hi All,
I''m a newbie to both Speech Recognition and C#. I''m working on a project which includes distinguishing commands from normal conversation. I added a custom grammar that indentifies four commands (as of now) namely, ''next'', ''previous'', ''home'', ''end''.
But when I speak some normal sentences/words, the SpeechRecognitionEngine relates the words with those in the customed Grammar and act accordingly. I tried the ''RecognizedWordUnit.Confidence'' property as well, it corrected the issue to some level but not fully.
Anybody please suggest, how can I make my Speech Engine to recongnize well just the command words and ignoring the rest of speech.
Thank You
Manjinder
推荐答案
如果您同时收听这两个消息,则必须在命令列表中放一个单词以引起注意一个单独的命令侦听器.
基本上,您会听一个词,例如计算机"或命令",然后在听到该命令时,便会更改列表中的命令并监听那些特定的命令.
If you''re listening for both at the same time, you''ll have to put a single word in the command list to get the attention of a seperate command listener.
Basically, you listen for a single word, like "computer" or "command", then when that command is heard, you change out the commands in the list and listen for those specific commands.
我仅通过SpeechRecognitionEngine听某些特定的单词.我的代码段如下所示:
RecEngine =新的SpeechRecognitionEngine();
RecEngine.SetInputToDefaultAudioDevice();
mygrammar = sampleGrammar();
RecEngine.LoadGrammar(mygrammar);
RecEngine.SpeechRecognized + =(s,args)=>
{
foreach(args.Result.Words中的RecognizedWordUnit单词)
{
如果(word.Confidence& gt; 0.9)
输出+ = word.Text;
}
};
私人语法sampleGrammar()
{
选择项=新选择项(下一个",上一个",主页",结束");
builder =新的GrammarBuilder(choices);
语法gr =新语法(生成器);
return gr;
}
因此,当我说我要休息"之类的句子时.它选择并将休息"表示为下一个",并将漫游"表示为家庭"等.我想改善语音识别,但不确定如何做到.
非常感谢!
Manjinder
I''m listening for some specific words only through SpeechRecognitionEngine. Snippet of my code goes as
RecEngine = new SpeechRecognitionEngine();
RecEngine.SetInputToDefaultAudioDevice();
mygrammar = sampleGrammar();
RecEngine.LoadGrammar(mygrammar);
RecEngine.SpeechRecognized += (s, args) =>
{
foreach (RecognizedWordUnit word in args.Result.Words)
{
if (word.Confidence > 0.9)
output += word.Text;
}
};
private Grammar sampleGrammar()
{
Choices choices = new Choices("next", "previous", "home", "end");
builder = new GrammarBuilder(choices);
Grammar gr = new Grammar(builder);
return gr;
}
So, when i speak some sentence like ''I want rest''. It picks and relates ''rest'' as ''next'', similarly ''roam'' as ''home'' etc. I want to improve the Speech Recognition, but not sure how to do that.
Many Thanks!
Manjinder
这篇关于如何区分命令与普通对话-C#中的语音识别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!