Reputation: 7976
I've been trying to get dragonfly to work on my Windows 10 machine, but I can only get as far as making NatLink activate.
I've configured the user directory in the NatLink GUI, as well as activated the two debugging options.
In my user directory, I have one file called grammar.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()
The expected outcome is that when I say "do something computer", NatLink should print "voice command activated" to its console. However, this doesn't happen.
When I start Dragon, the NatLink console prints the following:
UserDirectory: C:\Users\bp\Documents\dragonfly-grammar
do extra output at (re)loading time: 1
do extra output at callback time: 1
-- natlinkmain starting...
NatLink pyd dir C:\Natlink\Natlink\MacroSystem\core
NatLink base dirC:\Natlink\Natlink\MacroSystem
userDirectory: C:\Users\bp\Documents\dragonfly-grammar
Unimacro not enabled
changeCallback, Type: user, args: ('bp', 'C:\\ProgramData\\Nuance\\NaturallySpeaking15\\Users\\bp\\current', 'US English', 'General - Large')
callback user, args: ('bp', 'C:\\ProgramData\\Nuance\\NaturallySpeaking15\\Users\\bp\\current', 'US English', 'General - Large')
---------changeCallback, User changed to bp
setting shiftkey to: {shift} (language: enx)
usercallback, language: enx
--- natlinkstartup starting...
vocolaEnabled: True
Loading _vocola_main
Vocola not active
Vocola is disabled...
filesToLoad: ['_vocola_main']
beginCallback, cbd: 0
check for changed files (all files)...
vocolaEnabled: 0
filesToLoad: []
vocolaEnabled: 0
filesToLoad: []
language: enx (<type 'str'>)
userLanguage: US English (<type 'str'>)
DNSuserDirectory: C:\ProgramData\Nuance\NaturallySpeaking15\Users\bp\current (<type 'str'>)
=== debugCallback info ===
natlinkmain changeCallback, global variable: coreDirectory: C:\Natlink\Natlink\MacroSystem\core
natlinkmain changeCallback, global variable: baseDirectory: C:\Natlink\Natlink\MacroSystem
natlinkmain changeCallback, global variable: DNSuserDirectory: C:\ProgramData\Nuance\NaturallySpeaking15\Users\bp\current
natlinkmain changeCallback, global variable: userName: bp
natlinkmain changeCallback, global variable: unimacroDirectory: C:\Natlink\Unimacro
natlinkmain changeCallback, global variable: userDirectory: C:\Users\bp\Documents\dragonfly-grammar
natlinkmain changeCallback, global variable: WindowsVersion: 10
natlinkmain changeCallback, global variable: BaseModel: US English | BestMatch IV
natlinkmain changeCallback, global variable: BaseTopic: US English | Large | General
natlinkmain changeCallback, global variable: language: enx
natlinkmain changeCallback, global variable: userLanguage: US English
natlinkmain changeCallback, global variable: userTopic: General - Large
vocolaEnabled: 0
filesToLoad: ['_vocola_main']
natlinkmain started from C:\Natlink\Natlink\MacroSystem\core:
NatLink version: 4.2
DNS version: 15
Python version: 27
Windows Version: 10
userDirectory: C:\Users\bp\Documents\dragonfly-grammar
baseDirectory: C:\Natlink\Natlink\MacroSystem
unimacroDirectory: C:\Natlink\Unimacro
natlinkmain imported-----------------------------------
Then, when I activate the microphone, the NatLink console prints the following:
changeCallback, Type: mic, args: on
findAndLoadFiles...
vocolaEnabled: 0
filesToLoad: ['_vocola_main']
beginCallback, cbd: 1
check for changed files (all files)...
vocolaEnabled: 0
filesToLoad: []
vocolaEnabled: 0
filesToLoad: []
=== debugCallback info ===
natlinkmain changeCallback, global variable: coreDirectory: C:\Natlink\Natlink\MacroSystem\core
natlinkmain changeCallback, global variable: baseDirectory: C:\Natlink\Natlink\MacroSystem
natlinkmain changeCallback, global variable: DNSuserDirectory: C:\ProgramData\Nuance\NaturallySpeaking15\Users\bp\current
natlinkmain changeCallback, global variable: userName: bp
natlinkmain changeCallback, global variable: unimacroDirectory: C:\Natlink\Unimacro
natlinkmain changeCallback, global variable: userDirectory: C:\Users\bp\Documents\dragonfly-grammar
natlinkmain changeCallback, global variable: WindowsVersion: 10
natlinkmain changeCallback, global variable: BaseModel: US English | BestMatch IV
natlinkmain changeCallback, global variable: BaseTopic: US English | Large | General
natlinkmain changeCallback, global variable: language: enx
natlinkmain changeCallback, global variable: userLanguage: US English
natlinkmain changeCallback, global variable: userTopic: General - Large
beginCallback, cbd: 1
check for changed files (only specific)
beginCallback, cbd: 1
check for changed files (only specific)
vocolaEnabled: 0
filesToLoad: []
changeCallback, Type: mic, args: off
Win10 64 bit, Python 2.7 32 bit
Upvotes: 0
Views: 114
Reputation: 7976
Turns out grammar files must (apparently) begin with _
, so renaming file to _grammar.py
did the trick
Upvotes: 3