在C#中进行语音识别可以从连续语音中的集合词汇中识别短语 [英] Making speech recognition in C# recognize phrases from a set vocabulary in continuous speech

查看:152
本文介绍了在C#中进行语音识别可以从连续语音中的集合词汇中识别短语的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在C#中识别使用语音识别的指令。这些说明包含我知道的固定短语的词汇。到目前为止,没有任何东西按照我需要的方式工作,因为当他们在连续的演讲中立即相互跟随时,我需要能够识别这些短语。根据指令的第一个短语,下一个词汇的词汇不同,但即使我能随时识别所有这些短语,我也很可能能够正常工作。



我已经真正寻找解决方案并试图让它发挥作用,但我目前不知道目前该做什么,似乎没有达到我的期望。希望有人能想出更好的解决方案来解决这个问题。我愿意接受任何解决方案,包括使用其他API,只要它们可以脱机工作(最好是免费的)。



我尝试过的方法:



我尝试使用内置的 System.Speech.Recognition API。使用听写词汇表,准确性不足以使我能够使用它。我尝试使用指定的语法,但这里的问题是,当它们立即跟随时,它无法识别短语。



我还发现了PauseRecognizerOnRecognition方法似乎是我想要的东西。但这似乎只适用于SpeechRecognizer,而不适用于SpeechRecognitionEngine。但是,根据我的需要,使用SpeechRecognizer时创建的弹出窗口和声音是不受欢迎的,无论如何我都无法让它正常工作。



我设法得到了进一步使用GrammarBuilder中的Append方法。多亏了这一点,我现在可以紧接着彼此识别出一组短语。我对这种方法的一个问题是,根据指令的开始,我可能会期望有不同数量的短语跟随它。这里唯一的解决方案是在最后添加所有可能的短语及其变体与可选部分。这不仅乏味,而且可能非常低效。对于我的用例,我期望遵循的短语根据它们之前的内容而有所不同。不幸的是,似乎没有任何方法可以快速识别短语,以便能够说出之后预期的短语,也没有找到缓冲输入的方法,等待第一部分被识别并处理下一个基于第一个中的内容。无论我做什么,即使从指定的词汇表中识别出以下短语,更不用说根据已经说过的内容改变词汇量,这种识别似乎不够快。

I am trying to recognize instructions using speech recognition in C#. These instructions consist of a vocabulary of set phrases I know. So far nothing is working the way I need as I need to be able to recognize these phrases when they immediately follow each other in continuous speech. Depending on the first phrase of the instruction the vocabulary for the next one is different, but I would likely be able to get this working even if I could recognize all these phrases at all times.

I have really searched for solutions and tried to get this to work, but I am currently at a loss as to what to do as currently, nothing seems to meet my expectations. Hopefully, somebody can think of a better solution to this problem. I am open to any solutions including the use of other APIs as long as they will work offline (and preferably are free).

What I have tried:

I tried using the built-in System.Speech.Recognition API. Using the dictation vocabulary the accuracy is not good enough for me to be able to work with it. I tried using a specified Grammar but the issue here is, that it can't recognize the phrases when the immediately follow each other.

I also found the PauseRecognizerOnRecognition method which seems to be something like what I am looking for. But that only seems to work for SpeechRecognizer and not SpeechRecognitionEngine. However, for my needs the pop-up and sounds created when using SpeechRecognizer are undesirable and I wasn't really able to get it working anyway.

I managed to get a little further using the Append method in GrammarBuilder. Thanks to this I can now have a set of phrases immediately following each other recognized. One of my issues with this approach is, that depending on the start of the instruction I may expect a different amount of phrases to follow it. The only solution here would be to add all the possible phrases as well as their variations with optional parts at the end. This would not only be tedious but likely very inefficient. For my use case, the phrases I expect to follow differ depending on what precedes them. Unfortunately, there doesn't seem to be any way to recognize the phrases fast enough to be able to say which phrases to expect afterward nor did I find a way to buffer the input waiting for the first part to be recognized and processing the following one based on what is said in the first. The recognition just doesn't seem to be quick enough whatever I do to even recognize the following phrase from a specified vocabulary let alone change the vocabulary based on what has been said.

推荐答案

查看选择 [ ^ ] System.Speech.Recognition API中的类。一个 Choices 对象是你可以用 .Append 附加到GrammarBuilder的东西,你可以创建一个 Choices 两者都来自String数组和GrammarBuilder数组。我从来没有做过这方面的实验,但选择应该可以创建一个像你想要的树状语法结构。
Check out the Choices[^] class in the System.Speech.Recognition API. A Choices object is something you can append to a GrammarBuilder with .Append, and you can create a Choices both out of a String array and a GrammarBuilder array. I've never done experiments to this extent but Choices should make it possible to create a "tree-like" grammar structure like you want to have.


这篇关于在C#中进行语音识别可以从连续语音中的集合词汇中识别短语的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆