815 points · by eschluntz · 3y ago · 313 comments
This has been one of the rare side projects that has actually saved me more time than I've put in :)
However, I realize that I would never want to use something like this that would change over time. E.g. if I ran it every 6 months and last year "db" produced "debug", while this year it produces "database". Because talk about messing up my muscle memory and habits. And the language I write changes very much over time.
So I'd actually be much more interested in a "universal" version of this -- if you ran it across books and e-mails and text messages from thousands of authors covering diverse backgrounds and contexts, then what would most reliably help everyone?
E.g. expanding "t" to "the" seems like a no-brainer, just like "st" to "something". Is there a minimal set of, say, 200-500 of these that could simply be turned into a "standard keyboard" that everyone could learn?
Take a look at Evans Basic English Code, a shorthand system based off of Phillips Code (for telegraphs). It's a little dated, but the most common words are quite useful for writing or typing.
https://archive.org/details/evansbasicenglis00evan
(use the pdf, the txt file is a bad OCR and practically useless)
Also useful:
https://en.m.wikipedia.org/wiki/Most_common_words_in_English
There are different stenography systems, each with their own shortcuts and abbreviations, but at core they're all about producing large volumes of text with minimal physical effort at very high speeds.
Those interested should check out http://www.openstenoproject.org/.
A good mechanical keyboard (e.g. the ErgoDox EZ) and Plover mean the only thing standing between you and >200 WPM typing is the time and effort to learn it.
I always see wpm come up for steno stuff and while it can be faster, that's more of a professional thing. There are three cool things about plover for me. One you get to type pressing more than one or two keys at a time. Two the inputs are sent on key up or release, so can take your time pressing all the letters down, and then release them. Three, you have almost no hand movement at all, so its really, really, really comfortable to type on.
once you get that, you have the steno theories to expand all the words. plover comes with a stened dictionary, but thats just for the words. you can also do phrases, symbols, emoji, macros, and more. once you start adding dictionaries, using a computer becomes a lot more fun. plover is like really crazy layers.
Now for the other dictionaries, you can do things like: https://steno.sammdot.ca/plover-basics.png https://steno.sammdot.ca/ted-navigation.png https://steno.sammdot.ca/emily-symbols.png
for these, where it says starter, you just press all those keys down, and then on the other side you press the keys listed for what you want. so for example, I can enter like ~104 symbols without moving my hands. the average sybmol layer has like 20. the crossplatform movement dict lets me move around much easier in any text field. (note that you don't really even need to know what the key names you are pressing are as its all a pattern) I currently have six other dictionaries that I use some of the time. you can see more here: https://www.openstenoproject.org/stenodict/.
any cli program would be very easy to add most of the commands to a dictionary if you wanted. for example, a basic git dictionary: https://github.com/didoesdigital/steno-dictionaries/blob/mas...
plover has made using a computer much more fun. its a bit of a hard sell for a lot of people, but I recommend trying out some of the other dictionaries to see what you can do besides type words fast. its seriously really crazy that we are only pressing one key at a time using a keyboard.
A chemist might type "dropper" often, 'dp' while a bureaucrat might prefer "department"
> However, I realize that I would never want to use something like this that would change over time.
> And the language I write changes very much over time.
Sounds like exactly you want something that evolves after time, since how you write changes over time.
An universal version would maximize the amount of helpfulness on an average for everyone, but a tool that learns from your individual actions, can be much better improvement for you. And by making the tool available to everyone, more people could get bigger benefits from it, rather than just "average" benefits.
No, because I don't want the shortcuts to be changing on me. That would drive me nuts. The whole point for me would be to establish new habits and then keep them. To turn into muscle memory, not something to be thinking about.
It's like toolbars that "learn" which actions you're currently using the most, but the buttons are constantly moving around and are never where they were last week. It's an exercise in frustration.
Isn't this approaching llm territory?
How exactly is an llm different? I'm not sure it is, just more layers.
A universal set of shortcuts trained on a giant corpus in 2018 wouldn't have a shortcut for "covid" or "pandemic" but in 2020, it would be really handy.
I have jk mapped to escape in vim, and for a key combo that seems like it should never occur naturally, I’m often surprised how often it misfires when I actually need to type “jk”.
Globally remapping hundreds of things like “t” and “st” would actually be quite frustrating I think.
Like imagine you’re emailing your friend about a trip to st petersburg, or about some code containing the variable t, etc.
I saw that great recommendation somewhere so immediately set that up in vim. But those are my initials, and usually the beginning of my username... So took that out real quick.
-jk
Is it a "no-brainer"?
I would map "st" to "start".
"Start" is something you use a lot more as a dev.
That's the true no-brainer. Memorable, good mapping.
Chinese language has this feature "built-in".
It is officially called 双拼 (Shuangpin)where you type two (English) characters of each word to type out the entire word:
https://zh.wikipedia.org/zh-sg/%E5%8F%8C%E6%8B%BC
Even if you don't use Shuangpin officially, most Chinese input methods supports a similar feature (简拼) for popular phrases, where you type first English character of each word to type out a phrase of several words.
For example, to type "thank you" in Chinese (xiexie), you just type "xx" and it should automatically give you "xiexie" (Chinese characters) in most popular Chinese input methods.
Like "what do you want to eat" 「你想吃什麼」 Is typed with n x c s m
Next time I got to the Din Tai Fung in my neighborhood ;-)
I was working on a similar problem this weekend, but with whole words instead of abbreviations I had made in a dictionary, and in the general case, fine-tuned on any given corpus of text.
I wanted to know: could I write an autocorrect that is "fine-tuned" on a given corpus of text? Use case: I write a lot of docs with long phrases (i.e. "data augmentation"). Could I automate them?
I arrived at:
1. Calculate "surprisal" of unigrams and bigrams (entropy) from a general dataset (an NYT corpus), give a boost to words in the "fine-tuned" index;
2. Create a trie data structure that is weighed by surprisals. The more surprising a word, the more weight it gets.
3. Use that as advanced autocomplete.
I got a working solution here: https://github.com/capjamesg/autowrite/blob/main/autocomplet...(No docs yet -- coming in the next few days. Leave a GitHub Issue if you want to chat about it!)
Or maybe I am confused what you're saying. Are you trying to find more creative ways of saying the same phrase?
The "surprisal" (information theory: Shannon information) component is doing statistical next word prediction. For example, given a corpus of data in which "data augmentation" is a common phrase, "da" could complete to "data augmentation".
"data augmentation" starts with "da", and would be determined as a likely candidate for the next word because it was common in the dataset on which the statistical model was "fine-tuned".
This Wikipedia page covers the concept in more depth: https://en.wikipedia.org/wiki/Information_content
Then anyone can install it, no friction, and over time it'll slowly start making you gently more productive.
Something like auto export slack history each week, get a word frequency. Then mantually assign a bunch of expansions based on what you see?
Bluetooth Keyboard -> ESP32 as a keyboard host -> Send keystrokes to USB & File
If you have cash there is a USB/PS2 keyboard logger that will capture data to disk.
For longer writing I'm often frustrated that I can think faster than I can type, so it does help with that too!
It is a lot harder than I thought it would be. To find aliases that dont misfire too often and provide enough value. Give that I daily communicate in several languages that adds even more trouble.
I have now split it by application. Different aliases for different applications. I still have misfires. Mostly I have found I need delinators.
I wish OP's tool suggested aliases for longer phrases than what I saw in the readme. I heard TextExpander for MacOs does that but I am not a Mac user.
I have been using text-expansion since the early days of TextExpander[1], an app that works on iOS and macOS. However good the iPhone keyboard was, it was always not convenient to type and retype details such as home address, home/work map, and many other work/personal related info. TextExpander helped a lot.
I started looking for an alternative when TextExpander converted to a subscription model, which I (personal) believe is not suitable for such a tool. I found a better alternative in Alfred[2], bundled with its Powerpack — Snippets.
macOS/iOS also has its built-in “Text Replacements” but it fails me quite often in non-Apple apps. What you have here is similar to that of Apple’s Text Replacement. I let that remain and the others are managed via Alfred. Honestly, I may move to this once I can totally walk out of Alfred (Spotlight is becoming good enough.)
However, I’d like to use a delimiter to expand so it does not come in the way of my normal typing (I can touch type). Currently, I use “,” (comma) as a delimiter (Affix) because, in English, there is always a space after a comma and my expansion is only after I type a comma and the short-text without a space. Also the comma key is located conveniently when you touch type.
If I do reconcile and stay with the OS’s Text Replacement, I might still introduce the delimiter to prevent automatic expansion of the word which wasn’t intended for that particular scenario.
In general "." is a delimiter, EXCEPT for "py" so that it doesn't interfere with me typing python files
It’s decently accurate (although very annoying when it misses), but I found that even when it’s working perfectly, using it is just way more cognitive effort than typing normally. Concentrating very hard, I could just about match my normal casual typing speed while using the abbreviations, but I couldn’t beat it, and I found myself just gravitating back to normal typing.
That said, I’m a fast typist, and I write a lot, so I’m trying to make a prototype beat a process in my brain that has been intensively optimized over 30 years or so. It might work better with someone who isn’t a fast typist in the first place.
jk
In iOS I maintain a small list of abbreviations (@@ expands to my e-mail address, lk expands to my name etc.) but if it was hundred(s) I'd probably lose more time thinking about "what was the abbreviation of 'online meeting' again" or correcting accidental abbreviations that are part of normal words, than I'd save time typing...but maybe that's just me.
On mobile my typing speed is much, much lower and I extensively use autocomplete.
But even at the high end of typing speed there's still a use case for shortcuts, it's just called stenography and it requires specialized software and/or hardware and tons of training.
It kind of reminds me of stenography in a way
I guess average typists will type "the" much faster than a complex word. Through muscle memory. I think it will be less noticeable for fast typists, who get their speed by being consistently fast.
I might go look for some research on typing times for different kinds of words beyond letter count!
https://github.com/Ikcelaks/keyboard_layouts/blob/main/magic...
I did something similar on Mac, but completely manually. I'm using Espanso now, but I suffix every shortcut with an ";" character which causes the expansion. Since it's home row, it's incredibly easy to actually type it right after typing some letters, making it ideal, cause then I can use whatever shortcuts I want and very rarely have collisions.
I do think this automated generation of suggestions is a great idea, and I it made me realize I hadn't thought enough about the amount of times I type something vs. how big the word is. Since I have an extra letter, I don't want to do this for very very short words, but possibly something I type a lot is still worth it even if it's very short. I tend to use it for semi-long words that I have a hard time typing for whatever reason.
Anyways, very cool, I'll probably be running this script sometime soon to get a list of suggestions, then converting them into Espanso scripts!
r0 -> return false
rn -> return null
t -> this
puf -> public function
You can easily find the opportunities for saving typing by analyzing existing code and most used words there.I created an EasyScript translator for GPT-4: https://gist.github.com/boticello/1ea9c7105e5c369ea937158411...
As others have commented, this is not the most efficient or practical approach, but for me it was an experiment which worked.
I've thought about doing something similar with my shell history to help me figure out which shell aliases I should create.
Same here, I end up doing `h | grep "(something about the command)` a lot to get commands with specific options, etc. and think "damn i should really make an alias for this" every single time, but never get around to it
https://github.com/atuinsh/atuin
*: shameless plug, I’m one of the maintainers
Ps. one of the links in the docs is dead, "see the supported shells" on the page https://atuin.sh/docs/commands/shell-completions
I use shell functions for this type stuff, and I have it spit out the command line it's going to run with all the args (to stderr) and then running the command, and other sorts of programmatic touchup (tell me if i'm in the wrong directory, or whatever)
spitting out the command line it's going to run with all the args (to stderr) is a function too. shell functions can also do nice things like change the directory in my outside shell, set environment variables, etc.
cm = git commit -m st = git status inst = sudo apt get install -y fucking = sudo
If you want to go the extra mile.
Also, the learning curve and everything.
Although I do have some better keyboards, and to be honest one of the reasons I got them was some vague idea of learning this at some point. It's just the time investment holding me back at this point, tbh.
It currently exists as (hopefully working for everyone, could use more testing) Chrome extension, but there's a universal API underneath. It could be run entirely locally if one was to give up portability.
I have it configured to be enabled when typing in code-comments or commit logs & it often gives helpful suggestions.
Beyond this I use ahk's hotstrings feature to have "snippets". I separate them by topic and activate them as and when they're required. For example I have one for css which has things like
display: flex;
justify-content: center;
align-items: center;
bound to a single hotstring.I know I can use vscode snippets but I prefer this.
I also have global hotstrings for say my emails, address, etc,. Unencrypted in my home directory. I don't care too much but you might.
The coolest one is a password manager that lets you use your username/email on any website as the password.
You just press a hotkey and are prompted to enter the secure master password. Once you do that, it decrypts your passwords and activates the hotstrings required to convert usernames to their respective passwords. When you press enter and submit the form it kills it. This is only one of the variations I have. The previous one had me enter the master password in the form itself, and it'll read the context of the browser itself get the URL from there and automatically replace the correct password. I stopped using this as it became unwieldy once I had to have multiple Gmail accounts for example.
Is the script you use publicly available somewhere?
But I'm wondering if I would be able to learn all these shortcuts. There would be a lot of time invested, and I don't know how stable a solution this is - ie will I be able to use it everyday for the next five years?
I'm betting on the capabilities of LLMs right now - I think they can predict a lot of my typing and save me enough time and, if msft is smart, they will soon enough be present everywhere.
Calculation for "the" from the screenshot in the repo:
9933 characters saved / 8 kps = ~20 minutes
Typing faster is always going to be a benefit.
I think it would be too much effort for most people to get to 150wpm, or to learn stenography.
But, on the other hand, if people are typing 30wpm, they would benefit from training to improve their typing speed.
Now I'm imagining building a keyboard that has it built in, with a little OLED right on the keyboard, and when you press space it types out the closest match to what's in the buffer, and you don't have to take your eyes away from the board to see what the autocorrect is doing.
Instead, I use native iOS/macOS “text replacement” for customer service responses. It saves me so much time. I have all of my FAQ URLs as 4 letter shortcuts.
e.g. lltr becomes https://label.live/guides/label-printer-troubleshooting
llty = Thank you for the email. lllmk = Let me know if this helps.
You can go back even farther to ancient inscriptions. Humans have been trying to save a few characters here and there for quite a while.
This is what I thought while I was learning Vim too, but now I honestly prefer Vim keybindings everywhere. So maybe this is not too bad. I would definitely try out if one can also build a vimtutor like version for this usecase.
Having studied some shorthand, I'm not surprised in the least! There, the most frequent words tend to get single-symbol abbreviations. Common wisdom even says that much of the benefit from shorthand writing comes from these few one-symbol abbreviations.
I've never really tried using text to speech for writing blog posts and the like, but I know David Sparks (MacSparky) swears by it; and he produces a lot more written content than I do.
For longer form writing I have used dictation and I really liked it!
I'm aware of CJK input methods, but it's not immediately clear how/why you could repurpose them for English. Not to mention there are several types.
You can create a custom user dictionary in any IME, mapping the abbreviations to one or more full words or phrases, either in bulk beforehand, or one by one while you use the system.
During typing, pressing the space bar brings up a list with the substitutes corresponding to the preceding string. You can select with the up/down arrows and insert by pressing space again.
In practice, most of the time you can convert by pressing space twice in quick succession, because either you have a single candidate, or because the default selection, the top candidate is automatically set to your last, or most frequent selection.
If there's no match, you can add a new abbreviation to your dictionary.
You can turn on/off the system by pressing CTRL-space, or some other key combo.
If you had a key to toggle case on selected texts billions of backspace keystrokes and retyping strokes could be saved
branches of conversation too, one step above botting
works for what he’s looking for
aka obviously. redundant to signal your lack of support.
anyway, he fills a market need. many women are annoyed by not well thought out short responses, as much as men are
It parses your choice of documents and send emails and suggest to auto complete frequently used phrases.
Advantages:
+ no need to memorize abbreviations
+ no interference with your other typing.
Same thing chatgpt (trapped in the philosopher's Chinese room) is asking itself millions of times a day.
In the current setup there are too many collisions.
Most other people use a normal mouse
Since I also have a lot of muscle memory using normal mice, I am able to quickly adjust to working on a new PC
Others struggle when they have to take over my PC and show me something by navigating with my trackball
I am guessing this might be similar -- since OP does have years or muscle memory with normal keyboards anyway to back them up
I use a 50 euro Razer Naga X mice at the moment which is nice (with the extra buttons).
But, it's unreasonable that you stick to the lowest common denominator if you're going to be using your own setup 99% of the time.
I'd say a bigger disadvantage to non-traditional setups (trackballs, non-qwerty, small keyboards, etc.) is "others won't be able to use your stuff".
Also don't use any editor other than Notepad.
I type 20% of what I would have with copilot
[1] https://www.reddit.com/r/Classic_Speedwriting/wiki/list108/
Very useful in eg. customer service when you want to reply to someone with links and whatnot. Giving instructions, etc.
For programming you can build up a library of common things, think ";;p -> print("\($place_cursor_here)"). Or whole classes, anything you can think of, really.
Specifically, * not in terminal * not in Chrome URL bar (but yes in text areas) * not in emacs * not in vim
I'd like a native version very much, but only when it works in most places. As it is now, I'd have to configure many things individually, which is a bit of a maintenance nightmare.
I guess a viable answer would be to use an external keyboard with a firmware under your control. All DIY mechanical keyboards and lots of commercial ones fall under that category. But that won't work for laptops on the go...
It can do simple text replacement, so I have words, phrases, and sentences I use frequently compressed into a few keyboard clicks. It can also grab what is in your clipboard, so that can be incorporated into responses, which is simple but very handy.
A simple text replacement looks like this in the yml file: - trigger: ":espanso" replace: "Hi there!"
But it can even work with a shell, which I think is amazing! For example, I have a particular task at work where I often need to insert a random number into a text document. I can have Espano run PowerShell behind the scenes to run a simple PowerShell command, and that looks something like:
- trigger: ";rand"
replace: " {{output}}"
vars:
- name: output
type: shell
params:
cmd: "Get-Random -Minimum 100000"
shell: powershellThe creator is also incredibly nice, one of those rare open source devs that seems to go out of his way to validate concerns and make PRs truly feel welcome.
Great project.
I don’t know if it’s our field or just life these days but I would really love a more relaxed approach to work (or life in general?). It feels like I’m in a race and struggling to keep up with the pack.
That turned a positive into a negative when using machines that didn't have these optimizations.
Thanks for the post though, I need to do some analysis of my own typing habits to automate them
Creating a layer for this sort of typing would also be really cool and not having to use that leader key the entire time.
Somewhat similar tool to Autokey for MacOS that I use as a text expander.
Allows for great customization - appending ; to a phrase ensures you don't accidentally expand a keystroke into a phrase/URL/etc
";url" expands into "whatever string you configure"
In other words, rather than using them merely to identify words to abbreviate and suggested abbreviations, why not use an LLM that can take a bunch of abbreviated text and infer what you're trying to abbreviate?
Tht wy, u dn't hv 2 mem lsts f abbrs ahd f tm.
ChatGPT was able to successfully guess that last sentence in abbreviated form:
That way, you don't have to memorize lists of abbreviations ahead of time.
Edit: Oh, "That way, you don't have to remember lists of abbreviations ahead of time". ChatGPT must be something impressive if it can beat me at some linguistic games.