{{ message }}

Instantly share code, notes, and snippets.

# Alex Boche alexboche

Last active Dec 15, 2019
View excel.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 """ 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
Last active Sep 27, 2019
View greedy_commands.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 import dragonfly class GreedyishRule(MappingRule): mapping = { "say ": Text("%()s"), "numb ": Text("%()s"), } digits = {"one": "1", "two": "2", "three": "3"} extras = [Dictation("dictation"),
Last active Oct 11, 2019
View text_manipulation_debug.md

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
Created Aug 10, 2019
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 from dragonfly import * class CommandRule(MappingRule): mapping = { "amp": Key("a"), "bairch": Key("b"), "lanty []": Key("left"), } extras = [IntegerRef("n", 1, 10)] defaults = {"n":1}
Last active Aug 10, 2019
View dictation_commands.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 from dragonfly import * import nsformat dictation_length = [] # for "scratch that" purposes input_state = None """ Note: if you pass in the input state into the function using the function action rather than just accessing it from within the function using the fact that it is in global scope, the input state will not be updated when you run the dictation command multiple times To see what I mean note that in contrast to the approach here, the approach taken at the following link does not update the state after each dictation utterance
Created Aug 5, 2019
View closures.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 def make_averager(): count = 0 total = 0 def averager(new_value): # nonlocal count, total # doesn't work # global count, total count = count + 1 total = total + new_value print(total/count) return total/count
Last active Jul 31, 2019
View dictation_commands_nsformat.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 from dragonfly import * import nsformat formatting_state = None # def format_dictation(dictation, input_state): formatted_output, output_state = nsformat.formatWords(str(dictation), state=input_state) formatted_output = str(formatted_output) Text(formatted_output).execute() global formatting_state # I'm not sure if I'm managing the state properly here,I don't know how to properly do that in Python formatting_state = output_state
Created Jul 30, 2019
View nsformat.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 __version__ = "$Revision: 105$, $Date: 2008-12-04 12:47:13 +0100 (do, 04 dec 2008)$, $Author: quintijn$" # Python Macro Language for Dragon NaturallySpeaking # (c) Copyright 1999 by Joel Gould # Portions (c) Copyright 1999 by Dragon Systems, Inc. # # This code simulates the basic text formatting from NatSpeak. # # code written by Joel Gould, posted on the natpython discussion list on Wed, 28 Aug 2002 # # inserted in the unimacro package june 2006
Created Jul 30, 2019
View dragon_math_vocabulary.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters

Last active Aug 2, 2020
View chrome_grammar_visualized.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 ------------------ Grammar(chrome): 3 rules (1 exported, 0 imported): - ChromeRule(chrome) 1571 - Alternative(...) 1570 - Compound('[] ') 376 - Sequence(...) 375 - Optional(...) 18 - Choice(..., name='click_by_voice_options') 17 - Compound('click') 2 (+ 1 trivial direct child) - Compound('copy') 2 (+ 1 trivial direct child)