dragonfly+dragon naturally speaking not working

366 Views Asked by At

I've got Dragon Naturally Speaking 14, dragonfly, the latest natlink (4.1 or something), pywin32, python 2.7, and wxpython installed

I've got a python file with this in it in my "user configuration directory" set up by natlink

I get the natlink popup message when Dragon Naturally Speaking starts, telling me that it's working. I reset DNS 14 to ensure my "macro" (dosomething.py) is loaded.

this is the code in my dosomething.py

from dragonfly import Grammar, CompoundRule

# Voice command rule combining spoken form and recognition processing.
class ExampleRule(CompoundRule):
spec = "do something computer"                  # Spoken form of command.
def _process_recognition(self, node, extras):   # Callback when command is spoken.
     print "Voice command spoken."

# Create a grammar which contains and loads the command rule.
grammar = Grammar("example grammar")                # Create a grammar to contain the command    rule.
grammar.add_rule(ExampleRule())                     # Add the command rule to the grammar.
grammar.load()                                      # Load the grammar.

while True:
pythoncom.PumpWaitingMessages()
sleep(.1)

however, when I start up & activate DNS and say "do something computer" with dictation & command mode, or just command mode, the transcription box pops up, how can I tell if it's working or not? I don't think it is. What is supposed to happen? I'm new to python, I fired up the interpreter in the cmd window and no prompt like "Voice command spoken." is ever generated when I say the voice command. Is that what's supposed to happen?

1

There are 1 best solutions below

0
On

There are two ways to load up Dragonfly grammars: through Natlink, and through Windows Speech Recognition. WSR requires you to put in that while loop with pythoncom.PumpWaitingMessages(), but that won't work with Natlink. You should comment it out.

If you set this up correctly, you won't see "Voice command spoken." in any cmd prompt -- you will see it in the Natlink window.