I'm making a prototype for an accessibility app for Windows with Dragonfly for Python. Frustratingly, Windows Speech Recognition (WSR) recognizes audio from the computer, which is a huge problem for me as it recognizes speech generated by its own engine. For example, using speak
:
e = dragonfly.get_engine()
e.speak("Welcome. What can I do for you today? Please say a command.")
WSR, in its infinite wisdom, hears "Please say"
from the computer speakers and interprets that as "Yes"
. I've changed around the wording of the prompts but this is a consistent problem with many parts of the prototype. I would also prefer not to change my prompts to "Affirmative"
and forget "Yes"
because that seems like the opposite of accessible.
This is what my simple response class looks like:
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
I'm open to various methods of disabling or circumventing this unwanted "feature". I've tried using different contexts but the context
documentation is not very clear on its use. I've also tried setting a speaking
attribute to prevent this but it doesn't seem to work. This is a test for the speaking
attribute:
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
I set the SingleWordResponse.speaking
to True
immediately before the e.speak()
call and then set it to False
immediately after but to no avail.