Example #1
0
# To update available directories on tab changes, `list` again.

import os
import re

import talon.clip as clip
from talon import applescript
from talon.voice import Context, Key, Str, press

from .. import utils
from ..misc.basic_keys import alphabet
from ..misc.mouse import delayed_click

ctx = Context("terminal", bundle="com.googlecode.iterm2")
ctx.vocab = ["docker", "talon"]
ctx.vocab_remove = ["doctor", "Doctor"]

try:
    from ..text.homophones import all_homophones

    # Map from every homophone back to the row it was in.
    homophone_lookup = {
        item.lower(): words
        for canon, words in all_homophones.items() for item in words
    }
except ImportError:
    homophone_lookup = {
        "right": ["right", "write"],
        "write": ["right", "write"]
    }
    all_homophones = homophone_lookup.keys()
Example #2
0
import re
import string
import subprocess

import talon.clip as clip
from talon import applescript, ui, tap, cron
from talon.voice import Context, Key, Str, press

from .. import utils
from ..misc.basic_keys import alphabet, alpha_alt
from ..misc.mouse import delayed_click
from ..text.formatters import LOWSMASH, DASH_SEPARATED, formatted_text

ctx = Context("terminal", bundle="com.googlecode.iterm2")
ctx.vocab = ["docker", "talon"]
ctx.vocab_remove = ["doctor", "Doctor", "talent", "talented"]

try:
    from ..text.homophones import all_homophones

    # Map from every homophone back to the row it was in.
    homophone_lookup = {
        item.lower(): words
        for canon, words in all_homophones.items() for item in words
    }
except ImportError:
    homophone_lookup = {
        "right": ["right", "write"],
        "write": ["right", "write"]
    }
    all_homophones = homophone_lookup.keys()
Example #3
0
from . import config
from .text import shrink

vocab_alternate = config.load_config_json("vocab_alternate.json", dict)

vocab_alternate.update(
    {f"shrink {k}": v
     for k, v in shrink.shrink_map.items()})

ctx = Context("vocab")

try:
    vocab_path = os.path.join(os.path.dirname(os.path.abspath(__file__)),
                              "vocab.json")
    with resource.open(vocab_path) as fh:
        vocab = json.load(fh)
except FileNotFoundError:
    vocab = []


def add_vocab(words):
    global vocab
    vocab += [re.sub("[^a-zA-Z0-9]+", "", w) for w in words]
    vocab = sorted(list(set(vocab)))
    with open(vocab_path, "w") as f:
        json.dump(vocab, f, indent=0)


ctx.vocab = vocab + list(vocab_alternate.keys())
ctx.vocab_remove = config.load_config_json("vocab_remove.json", list)
Example #4
0
from talon import applescript
import talon.clip as clip
from talon.api import ffi
from talon.voice import Key, press, Str, Context

from user.utility import text

from user.mouse import delayed_click

ctx = Context("terminal", bundle="com.googlecode.iterm2")
ctx.vocab = [
    'docker',
    'talon',
]
ctx.vocab_remove = ['doctor', 'Doctor']

subdirs = {}


def slugify(value):
    """
    Normalizes string, converts to lowercase, removes non-alpha characters,
    and converts spaces to hyphens.
    """
    value = re.sub("[^\w\s-]", "", value).strip().lower()
    value = re.sub("[-\s]+", " ", value)
    return value


def update_ctx(_=None, newdir=None):
Example #5
0
ctx.vocab_remove = [

    'Alana',

    'Brian',

    'covariant',

    'Daniel',
    'Daniella',
    'Department',

    'filer',
    'Fareham'

    'Gino',
    'gonna',
    'Grant',
    'Grants',

    'improbability',

    'Jean',

    'Kaunda',

    "Lander",
    'Landa',
    'lender',
    "Lavender",

    'mag',
    'Max',
    'Manx',
    'Marion',

    'P value',
    'P values',
    'Philo',
    'Phalen',
    'Pohlmann',

    'rose',
    'Rose',
    'Rowe',

    'Shirley',

    'tax',
    'Tanya',
    'Tobias',
    'Theron',

    # Remove Australian English :(
    'analyse',
    'analysing',
    'generalise',
    'generalised',
    'itemise',
    'normalise',
    'organise',
    'organised',
    'rigourous',


]
Example #6
0
    'UTM',
    'val',
    'val',
    'vals',
    'varphi',
    'vec',
    'Wakefield',
    'WD',
    'XLab',
    'XLim',
    'XTable',
    'YLab',
    'YLim',
    'youdub',
    'ZLim',
]

ctx.vocab_remove = [
    'Brian',
    'Daniel',
    'Gino',
    'Jean',
    'modelling',
    'lawtex',
    'P value',
    'P values',

    # 'tax',
    'cuesta',
]
Example #7
0
        "state none": i("None"),
        "item <dgndictation> [over]": [
            i(", "),
            formatted_text(DOWNSCORE_SEPARATED, JARGON),
        ],
        "swipe [<dgndictation>] [over]": [
            Key("right"),
            i(", "),
            formatted_text(DOWNSCORE_SEPARATED, JARGON),
        ],
    }
)

ctx = Context("golang", func=extension_context(".go"))
ctx.vocab = ["nil", "context", "lambda", "init"]
ctx.vocab_remove = ["Linda", "Doctor", "annette"]
ctx.keymap(
    {
        "empty string": i('""'),
        "is not empty": i('.len  != 0'),
        "variadic": i("..."),
        "logical and": i(" && "),
        "logical or": i(" || "),
        # Many of these add extra terrible spacing under the assumption that
        # gofmt/goimports will erase it.
        "state comment": i("// "),
        "[line] comment <dgndictation>": [
            Key("cmd-right"),
            i(" // "),
            formatted_text(SENTENCE),
        ],
Example #8
0
ctx.vocab = [
    'Talon',
    'talon',
    'Netlight',
    'refactoring',
    'Refactoring',
    'Array',
    'array',
    'undefined',
    'Undefined',
    'Back-end',
    'back-end',
]

ctx.vocab_remove = [
    'tallow',
    'Tallow',
    'tyler',
    'Tyler',
    'mark',
    'Mark',
]

# ctx.vocab_remove = ['doctor', 'Doctor']

# WORDS
# gibby, shibby, swick, totch, baxley, peach, carmex, kite, wonkrim, wonkrish, scrhim, shrish, fame, fish, crimp, chris, jeep, dune, doom
# shockey, shockoon, sprinkle, spring, dear, smear, trundle, jolt, snipline, sprinkoon
# rizzle, dizzle, dazzle, razzle