The telephone keypad encoder turns text into the multi-tap key presses people used to type SMS messages on a numeric phone keypad. Each letter is one of three or four characters sharing a key, so you tap that key the right number of times: A is one tap of 2, B is two taps, C is three taps.
How it works
The encoder uses the ITU-T E.161 keypad layout and writes each letter as its key digit repeated by the tap position of that letter on the key:
2 ABC 3 DEF 4 GHI 5 JKL 6 MNO 7 PQRS 8 TUV 9 WXYZ 0 space
A=2 B=22 C=222
S=7 position 4 -> 7777
Letters from one word are separated by spaces in the output so the boundaries between presses are clear; a space character maps to the 0 key.
Example and notes
HI encodes to 44 444 — H is the second letter on key 4 (44) and I is the
third (444). The repetition count makes multi-tap unambiguous, which is the key
difference from predictive T9: you never need a dictionary to read it back. On a
real handset you would pause between two letters on the same key, and that pause
is what the space in the output represents.