首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Microsoft语音平台:识别单词重复

Microsoft语音平台:识别单词重复
EN

Stack Overflow用户
提问于 2015-01-10 18:15:39
回答 1查看 241关注 0票数 1

我使用Microsoft语音平台在屏幕上输出语音识别语音。但是,我有问题:例如,我有语法(由GrammarBuilder和Choice构造--“红色”、“绿色”、“黑色”)

当我说--“红绿黑”--我只能得到“红”,也许是“红绿”,而不是“红绿黑”。

一些代码:

代码语言:javascript
复制
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文件,其单词如下:

Dictionary.txt

代码语言:javascript
复制
green
black
yellow
red
some other words
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-01-10 18:37:56

您可以使用重复追加方法

代码语言:javascript
复制
 gb.Append(choices, 1, 10);
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27879560

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档