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.
- Host: GitHub
- URL: https://github.com/namorniradnug/button-phone-encoder
- Owner: NamorNiradnug
- License: unlicense
- Created: 2020-11-27T18:36:43.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2025-04-18T19:42:54.000Z (about 1 year ago)
- Last Synced: 2025-10-09T15:36:16.833Z (8 months ago)
- Topics: useless
- Language: Python
- Homepage:
- Size: 9.77 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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
```