【问题标题】:Preventing Windows Speech Recognition from recognizing computer audio with Dragonfly?使用 Dragonfly 防止 Windows 语音识别识别计算机音频?
【发布时间】:2014-12-03 04:30:42
【问题描述】:

我正在使用 Dragonfly for Python 为 Windows 无障碍应用程序制作原型。令人沮丧的是,Windows 语音识别 (WSR) 可以识别来自计算机的音频,这对我来说是个大问题,因为它可以识别它自己的引擎生成的语音。例如,使用speak:

e = dragonfly.get_engine()
e.speak("Welcome. What can I do for you today? Please say a command.")

WSR 以其无限的智慧从计算机扬声器中听到"Please say",并将其解释为"Yes"。我已经改变了提示的措辞,但这是原型的许多部分的一致问题。我也不想将提示更改为"Affirmative" 而忘记"Yes",因为这似乎与可访问性相反。

这就是我的简单响应类的样子:

class SingleWordResponse(CompoundRule):
    spec = "<word>"
    extras = [Choice("word", {"no":0, "yes":1, "ready":1, "okay":1,"repeat":2})]
    mode = 0
    def _process_recognition(self, node, extras):
        #here I use self.mode to keep track of what the user is doing and respond based on the context

我愿意接受各种禁用或规避这种不需要的“功能”的方法。我尝试过使用不同的上下文,但context documentation 的使用不是很清楚。我也尝试设置 speaking 属性来防止这种情况,但它似乎不起作用。这是speaking属性的测试:

class SingleWordResponse(CompoundRule):
    spec = "<word>"
    extras = [Choice("word", {"no":0, "yes":1, "ready":1, "okay":1,"repeat":2})]
    speaking = False
    def _process_recognition(self, node, extras):
        if self.speaking == False:
            print "command recognized"
            #process command
        #otherwise do nothing

我在调用e.speak() 之前立即将SingleWordResponse.speaking 设置为True,然后在之后立即将其设置为False,但无济于事。

【问题讨论】:

    标签: python speech-recognition python-dragonfly


    【解决方案1】:

    一种可能的解决方案是使用 Rule.disable() 和 Rule.enable() 发挥创意。当您不希望它被识别时,这至少会阻止您的规则被识别。

    但是,它不处理 WSR 从 speak() 函数中识别自己的语音。这意味着,当您使用 speak() 函数时,您仍然会得到随机文本插入。我认为您可能遇到了麦克风质量问题,因此我在扬声器音量调高和关闭的情况下测试了您的代码。尽管将其称为 WSR 问题,但您似乎是正确的:即使扬声器关闭,我仍然遇到问题。

    顺便说一句,出于各种原因,我讨厌建议“投入更多资金”解决方案,但 Dragon NaturallySpeaking with Natlink+Dragonfly 没有这个反馈问题(Windows XP/7 上的 DNS 版本 11/12至少,没有在其他地方测试过)。 WSR 还不够聪明。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-04-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-02-23
      • 1970-01-01
      相关资源
      最近更新 更多