filyp / autocorrect

Spelling corrector in python
GNU Lesser General Public License v3.0
448 stars 79 forks source link

Is there a way to adapt this to Mirrored QWERTY setup for one handed typing? #7

Closed jtv199 closed 3 years ago

jtv199 commented 4 years ago

Hi.

Mirrored QWERTY

(from Wikipedia) The idea is to only use one hand (preferably the left one) and type the right-hand letters by holding a key that acts as a modifier key. The layout is mirrored, so the use of the muscle memory of the other hand is possible, which greatly reduces the amount of time needed to learn the layout if the person previously used both hands to type. This was first proposed by Randall Munroe on the xkcd-blog.

I would like it for when I type a word such as "cwwdee" it can take into consideration of the mirrored QWERTY setup autocorrect it to "cookie"

filyp commented 4 years ago

Sure! Take a look at how it's done in autocorrect_word in https://github.com/fsondej/autocorrect/blob/master/autocorrect/__init__.py First, you'd have to make a dict:

{'f': 'j',
'd': 'k',
...

And use it to generate candidates, so for 'cwwdee', you generate: 'cwwdee', 'cwwdei', cwwdie', ... Speller.existing can filter out non-existing words, and the line

return [(self.nlp_data.get(c, 0), c) for c in candidates]

Will give you word frequencies. You'd also need some way to handle ambiguities, like: 'cry' and 'cut'. Maybe while typing give user a list of alternative suggestions, sorted by frequency?

I'm curious how it works out.

filyp commented 3 years ago

It looks, you abandoned the idea, so I'm closing. If you decide to do it, reopen this issue.