April 17, 2007 will


The other day I noticed that the words 'kiss' and 'lips' (don't ask) could be spelled on the same buttons when texting on a phone. I idly wondered what other related words could be spelled on identical buttons. That idle wondering festered in my brain and eventually turned in to a Python script (which is often the result of my wonderings). The script I wrote, groups words together by the sequence of phone buttons needed to txt them. It also filters out sequences with just one word, which I wasn't interested in. Here is the code:

txt_words = {}

def to_number(c):
    return "22233344455566677778889999"[ord(c)-ord('a')]

for line in file("word.lst"):
    word = line.rstrip()
    txt_word = "".join(to_number(c) for c in word)
    if txt_word not in txt_words:
        txt_words[txt_word] = []

def cmp_word_lengths(w1, w2):
    return cmp(len(w1), len(w2))

out = file("txtwords.txt", "w")

for txt_word in sorted(txt_words.keys(), cmp=cmp_word_lengths):
    if len(txt_words[txt_word]) == 1:
    print >> out, "[%s] %s" % (txt_word, ", ".join(txt_words[txt_word]))

Next I scanned through the output to find related words. I guess this could be done automatically if I had access to a thesaurus file, but that seemed more trouble that it is worth. Here are a few I picked out...

[24453] AGILE CHILD - A fast moving kid?

[54779] KISSY LIPPY - Pucker up.

[74353] RIFLE SHELF - Were you keep your rifles.

[874353] TRIFLE UPHELD - A British desert, held up.

[766643] POMMIE ROOMIE - Its what Australians call their English room-mates.

In addition to the related words I found, there was also a few combinations that I found amusing, in a low-brow kind of a way.

[28789] BUSTY CURVY - Stop, I'm blushing.

[77265] SPANK PRANK - Don't do it, it's harassment.

[746633] RIMMED SINNED - Pretty sure it's a sin.

I'm tired of looking. If you find any more good ones, let me know!

Additional: You will need the word list if you want to play with the code.

Use Markdown for formatting
*Italic* **Bold** `inline code` Links to [Google](http://www.google.com) > This is a quote > ```python import this ```
your comment will be previewed here
Terry Jones

I was CTO at Eatoni (http://www.eatoni.com) for over 4 years. We did a LOT of work on this sort of thing. At one point you could try to type the following into some Nokia phones:

"There's never a season to select kicking puppies."

and the phone would display "There's never a reason to reject licking pussies."

Marius Gedminas

You could use

sorted(txt_words, key=len)

instead of

sorted(txt_words.keys(), cmp=cmp_word_lengths)


There's another interesting phenomenon of mobile phones which is that it's sometimes possible to enter a complete word by repeatedly pressing the same button. I tried this on mine and found these words: feed, high, noon, moon, mono and strangely nonmomoonm. I wonder what's the longest word that can be typed by alternately pressing the same 2 buttons?


Clearly it is 48484848 (guitguit), which is one of several species of small tropical American birds of the family C[oe]rebid[ae], allied to the creepers.

Here are the runners up...

[646464] miming, mining
[373737] freres
[333333] deeded
[626262] manana
[878787] trusts
[363636] foemen
[8686] unto
[2222] abba, baba, caca
[4242] gaga, haha
[2323] bead
[7474] pish, shri
[4444] high
[5252] kaka
[3838] duet
[8484] thug, titi
[7272] papa, para
[3333] deed, feed
[3232] dada
[3737] eses
[5858] juju, lulu
[4646] gogo
[6666] mono, moon, noon
[8888] tutu
[5656] kolo
[4747] grip, iris
[7373] sere, serf
[6262] mama, mana, nana
[7676] porn, sorn
[7878] rust
[6868] mumu
[2626] ambo, coco
[6363] meme, mend, nene
[3636] dodo
[6464] mini
[5353] leke
[2727] arbs, arcs, bras, crap
[2929] away
[8787] urus


I seem to remember that "smirnoff" and "poisoned" use the same key combos...