An open API service indexing awesome lists of open source software.

https://github.com/namorniradnug/button-phone-encoder

A little utility for encoding strings for button phones.
https://github.com/namorniradnug/button-phone-encoder

useless

Last synced: 8 months ago
JSON representation

A little utility for encoding strings for button phones.

Awesome Lists containing this project

README

          

# button-phone-encoder
Utility that encodes strings to a button phone notation.
## About
Converts text into a sequence of keys those one press on a push-button telephone to type that text.
## Examples
To type symbol `a` one press key with number 2 once. So, `a` is encoded as `2`

To type `e` you press key 3 twice, so it's encoded as `33`.

Similarly `dog` is encoded as `36664`. (`d` as `3`, `o` as `666`, `g` as `4`).

If consecutive letters are encoded with the same digits, `+` is inserted between them. For example, `cat` is encoded as `222+28`.

Space is encoded as `1`.

To encode numbers `#` is inserted in front of them. For example, `345` is encoded as `#3#4#5`
## Usage
### help
```shell
> python encoder.py -h
usage: encoder.py [-h] [-d] string

Utility that encodes strings to a button phone notation.

positional arguments:
string

optional arguments:
-h, --help show this help message and exit
-d, --decode decoding mode (default is encoding)
```
### Encoding
```shell
> python encoder.py "my phone is 1234"
69991744666+6633144477771#1#2#3#4
```
### Decoding
```shell
> python encoder.py -d "69991744666+6633144477771#1#2#3#4"
my phone is 1234
```