【发布时间】: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