class ExampleRule(CompoundRule):
    spec = 'do something computer'

def _process_recognition(self, node, extras):
    print('Voice command spoken.')
grammar = Grammar('example grammar')
grammar.add_rule(ExampleRule())
grammar.load()
while True:
    pythoncom.PumpWaitingMessages()
sleep(0.1)
How do you recognize speech with the Python module Dragonfly?