使用Microsoft语音识别引擎的音频比较

时间:2013-09-11 04:31:49

标签: c# asp.net speech-recognition microsoft-speech-platform

我有一个用户可以说话和一个单词的应用程序,他将获得他所说的单词的百分比准确度。即引擎识别这个词有多清楚。

这一切都很好,但我有一个两难的问题,那就是需要将字词添加到词典中,我会将识别引擎作为字典。

如果我给出用“p”开头的单词,那么像pendant,pent等单词将被添加到字典中。在这种情况下,我没有将识别的单词作为“笔”。

相反,我总是得到“吊坠”等其他词语

但是,如果我只将有限的单词添加到字典中,如“pe”,“pen”,则对于相同的录制文件,我将识别的单词仅作为“笔”。

意味着它明显取决于我们给词典的字词。

我已经向我的客户传达了同样的信息。但是他们想要的是他们也可以为给定的输入词说错话,所以那时他们不需要获得准确性并获得认可的文本。 / p>

我已经完成了我可以为这个问题做的事情。但是我的客户需要一些与宇宙不同的东西。

代码:

public OdllSpeechProcessor(string culture, string speechContent , string filePath)
        {
            try
            {
                int counter = 0;
                string line;
                cultureInfo         = new CultureInfo(culture);
                recognitionEngine   = new SpeechRecognitionEngine(cultureInfo);
                words               = new Choices();
                gb                  = new GrammarBuilder();
                gb.Culture          = cultureInfo;
                rndAccuracy         = new Random();

                System.IO.StreamReader file = new System.IO.StreamReader(filePath);
                while ((line = file.ReadLine()) != null)
                {
                    if (line != "")
                    {
                        for (int i = 0; i < srcContent.Length; i++)
                        {
                            if (line.StartsWith(subsetWords, true, cultureInfo))
                            {
                                if (count >= line.Length)
                                {
                                    words.Add(line);
                                    counter++;
                                }
                            }
                        }
                    }
                }


                file.Close(); 

                // Adding words to the grammar builder.              
                gb.Append(words);

                // Create the actual Grammar instance, with the words from the source audio.
                g = new Grammar(gb);

                // Load the created grammar onto the speech recognition engine.
                recognitionEngine.LoadGrammarAsync(g);

有专家在这有解决方案吗?任何帮助将不胜感激。

由于

1 个答案:

答案 0 :(得分:0)

您正在使用命令语法(即一组选项)。使用命令语法,引擎会尽力找到匹配,这很容易导致误报(如您所见)。您可能想要调查听写语法,特别是发音语法,正如我在this question的回答中所概述的那样。请注意,我概述的解决方案使用了一些C#中不可用的接口(或至少通过System.Speech.Recognition公开)。