Microsoft语音平台:识别单词重复 [英] Microsoft Speech Platform: recognize word repetitions
本文介绍了Microsoft语音平台:识别单词重复的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用Microsoft语音平台在屏幕上输出语音时识别语音.但是,我有问题:例如,我有语法(由GrammarBuilder and Choices构造-红色",绿色",黑色")
I use Microsoft Speech Platform to recognize speech at output it on screen. But, i have problem: for example, i have grammar (constructs by GrammarBuilder and Choices - "red","green","black")
当我说红色绿色黑色"时,我只能得到红色",也许是红色绿色",而不能得到红色绿色黑色".
When i say- "red green black"- i can get only "red", maybe "red green" , but not "red green black".
一些代码:
Thread.CurrentThread.CurrentCulture = new CultureInfo("ru-RU");
Thread.CurrentThread.CurrentUICulture = new CultureInfo("ru-RU");
// Create a new SpeechRecognitionEngine instance.
_sre = new SpeechRecognitionEngine(new System.Globalization.CultureInfo("ru-RU"));
_sre.SpeechHypothesized += _sre_SpeechHypothesized;
_sre.SpeechDetected += _sre_SpeechDetected;
//_sre.SetInputToWaveFile(@"c:\Test\Wavs\Wavs-converted\file.wav");
_sre.SetInputToDefaultAudioDevice();
public void LoadGrammarIntoEngine(IEnumerable<String> textColl)
{
Choices choices = new Choices();
GrammarBuilder gb = new GrammarBuilder();
gb.Culture = new CultureInfo("ru-RU");
if (choices != null && textColl != null)
{
choices.Add(textColl.ToArray());
gb.Append(choices);
}
}
public void Recognize() {
if (_sre != null && _sre.Grammars.Count != 0) {
_sre.RecognizeAsync(RecognizeMode.Multiple);
}
}
那么,如何解决此问题?我应该使用规则制定SGRS语法吗? 语法文件是txt文件,其单词如下:
So, how to fix this problem? Should i make SGRS-grammar with rules? The grammar file is txt file with words like that:
Dictionary.txt
Dictionary.txt
green
black
yellow
red
some other words
推荐答案
您可以使用 查看全文