Skip to main content

Convert word to keypress sequence

Project description

# Convert word to keypress-sequence
[![Build Status](https://travis-ci.org/rchatterjee/word2keypress.svg?branch=master)](https://travis-ci.org/rchatterjee/word2keypress)

I made this as a submodule for my project on correcting password typos. I found
this very cool, and might be useful in many scenarios where one has to find
vairations of word due to mistyping.

Here we define typo as purely mistyping a key, and not due to ignorance. Hence,
finding possible typos of a word require converting the word into sequence of
key presses. This module provides those functionality to convert word into and
from sequence of key presses. Also, given a word find the possible typo of that
word tuned to the typos due to mistyping.

## Dependency ##
Right now it needs cython. I will remove it in future.
* Cython.

## Install ##

```
$ pip install word2keypress

# or

$ python setup.py install
```

## How to Use? ##

Refer to the `HowToRun.ipynb` file.

```
from word2keypress import distance, Keyboard
kb = Keyboard(u'US') # making unicode is mandatory (weird Cython)
kseq = kb.word_to_keyseq('Password')
print "\nRaw sequence:", repr(kseq)

print "\nReadable sequence:", repr(kb.print_keyseq(kseq))

print "\nkeyseq->word:", kb.keyseq_to_word(kseq)

print "\ndistance:", distance('Password1', 'PASSWORD1')
```


### How to test/develop ?
(For myself, as I keep forgetting how to deal with cython. Stupid Idea)
Don't forget to regenerate the `src/word2keypress/_keyboard.c` file in
Option 1.
```
$ python setup.py pytest # Option 1
$ tox # Option 2
$ python -m pytest tests/ # Option 3
```
In any case have to regenerate the `_keyboard.c` to test with the new code.


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

word2keypress-1.0.11.tar.gz (192.1 kB view details)

Uploaded Source

File details

Details for the file word2keypress-1.0.11.tar.gz.

File metadata

  • Download URL: word2keypress-1.0.11.tar.gz
  • Upload date:
  • Size: 192.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/3.6

File hashes

Hashes for word2keypress-1.0.11.tar.gz
Algorithm Hash digest
SHA256 367a26264d7b3e3d3dab45414e5fc0fddb51b5d5be702fe4a7be1a320cf336e9
MD5 81d64cb33f0dcd6142703078471dce9a
BLAKE2b-256 4b188f3e1f3fba9641074246770b89eff6dd9ef4e877e6f4f28123e5b5d9979a

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page