This file contains hidden or 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 _build_dict_of_words(paragraph): | |
wordslist = paragraph.split(' ') | |
unique_words_list = list(set(wordslist)) | |
dict_of_words = {word: 0 for word in unique_words_list} | |
for word in wordslist: |
This file contains hidden or 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 toml | |
import io | |
from dragonfly import (Grammar, Context, AppContext, Dictation, Key, Text, Repeat, | |
Function, Choice, Mouse) | |
from castervoice.lib import context, navigation, alphanumeric, textformat, text_utils | |
from castervoice.lib import control | |
from castervoice.lib.dfplus.additions import IntegerRefST | |
from castervoice.lib.dfplus.merge.ccrmerger import CCRMerger | |
from castervoice.lib.dfplus.merge.mergerule import MergeRule | |
from castervoice.lib.dfplus.state.short import R |
This file contains hidden or 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
# non_braces | |
[non_braces.greek] | |
# does not require curly braces in latex | |
alpha = "alpha" | |
beater = "beta" | |
gamma = "gamma" | |
delta = "delta" | |
epsilon = "epsilon" | |
zita = "zeta" |
This file contains hidden or 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 ActionBase | |
from dragonfly import Context | |
from dragonfly import Text | |
class PositionalTexter(object): | |
def __init__(self, func, extra=()): | |
self.func = func |
This file contains hidden or 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
"""Unimacro grammar to Dictate latex markup, as defined in an inifile | |
""" | |
__version__ = "$Rev: 398 $ on $Date: 2011-03-07 14:50:15 +0100 (ma, 07 mrt 2011) $ by $Author: quintijn $" | |
# This file is part of a SourceForge project called "unimacro" see | |
# http://unimacro.SourceForge.net and http://qh.antenna.nl/unimacro | |
# (c) copyright 2003 see http://qh.antenna.nl/unimacro/aboutunimacro.html | |
# or the file COPYRIGHT.txt in the natlink\natlink directory | |
# | |
# _latex.py: Dictate latex markup |
This file contains hidden or 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
# Here's a new command for writing numerical fractions more naturally. Not the most elegant but gets the job done. | |
"<number> <denominator>": R(Text("\\frac %(number)d") + Key("down") | |
+ Text("%(denominator)s") + Key("right")), | |
"[one] <denominator_single>": R(Text("\\frac 1") + Key("down") | |
+ Text("%(denominator_single)s") + Key("right")), | |
IntegerRefST("number", 2, 100), | |
Choice("denominator", { | |
"halves": "2", |
This file contains hidden or 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 (Grammar, AppContext, Dictation, Key, Text, Repeat, Choice, Function, ActionBase, ActionError) | |
class MultiAppContext(AppContext): | |
# ---------------------------------------------------------------------- | |
# Initialization methods. | |
def __init__(self, relevant_apps=None, title=None, exclude=False): | |
AppContext.__init__(self) |
This file contains hidden or 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
Function only works with keyword arguments. Something like arkalii's solution is a good way of dealing with the issue. You could also use a decorator on the add function to map argument names. This would keep the mappings clean: | |
arg_map = { | |
"num1": "x", | |
"n": "x", | |
"num2": "y", | |
"m": "y", | |
} | |
def replace_args(func): | |
def new_func(*_, **kwargs): |
This file contains hidden or 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
# this file contains commands for more quickly creating dragonfly commands. | |
# users may want to make this context-specific to they're text editors | |
from dragonfly import (Grammar, MappingRule, Dictation, Function, Choice, Pause, Mouse) | |
from dragonfly.actions.action_mouse import get_cursor_position | |
from castervoice.lib import control | |
from castervoice.lib.actions import Key, Text | |
from castervoice.lib.dfplus.additions import IntegerRefST | |
from castervoice.lib.ccr.standard import SymbolSpecs | |
from castervoice.lib.dfplus.merge.mergerule import MergeRule |
This file contains hidden or 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
# | |
# This file is part of Dragonfly. | |
# (c) Copyright 2007, 2008 by Christo Butcher | |
# Licensed under the LGPL. | |
# | |
# Dragonfly is free software: you can redistribute it and/or modify it | |
# under the terms of the GNU Lesser General Public License as published | |
# by the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# |
OlderNewer