Skip to content

Instantly share code, notes, and snippets.

from dragonfly import *
class CommandRule(MappingRule):
mapping = {
"amp": Key("a"),
"bairch": Key("b"),
"lanty [<n>]": Key("left"),
}
extras = [IntegerRef("n", 1, 10)]
defaults = {"n":1}

A user mentioned they were experiencing a bug with the text manipulation commands where character names were being interpreted as dictation (e.g. "arch" was being interpreted as the word arch instead of the letter a). Here's some things you could try if you experience a similar bug, based on my incomplete understanding of the problem. Approaches number 3 and 4 will probably not work but they are much less heavy handed than 1 and 2. Approaches 1 and 2 should be done either-or not both. Approaches number 1 and 2 should definitely work, so if they do not there's probably just a typo in my code or something, so let me know.

  1. The purpose of discriminating between dictation and commands here is so you don't end up matching something like "land" when you say "go lease and". This is nice but it's not that important, so you could just handle dictation and commands in the same way. If you replace your text_manipulation_functions.py with this file whic
import dragonfly
class GreedyishRule(MappingRule):
mapping = {
"say <dictation>": Text("%(<dictation>)s"),
"numb <number_sequence>": Text("%(<number_sequence>)s"),
}
digits = {"one": "1", "two": "2", "three": "3"}
extras = [Dictation("dictation"),
@alexboche
alexboche / excel.py
Last active December 15, 2019 20:43
"""
Command-module for Microsoft Excel
You also can find some good vocola commands for Excel on Mark Lillibridge's Github:
https://github.com/mdbridge/bit-bucket/tree/master/voice/my_commands/commands
Alex Boche 2019
"""
# import itertools
# this function takes a dictionary and returns a dictionary whose keys are sequences of keys of the original dictionary