Friday, November 9, 2007

"You are the paramount computer technician without letup!"

Have you ever you spilled water on your keyboard? Have you ever shorted out the F, R, and I keys on your iBook all at once? Have you ever had to chat under such circumstances because you couldn't get an appointment at the Apple Store until tomorrow? Is your name Pamela Worth? Are you chatting with me right now on instant messenger? Maybe it's time you tried the latest in useless technology. That's right, maybe PamFRI is perfect for you!

Earlier today I was talking to my friend, Pam, on line and she seemed to be speaking rather funny.

me: How are you?
Pamela: well, apart from not hav1ng some very important letters not working...
me: You're 'i' key is broken?
Pamela: 3 keys
f, r, i
Pam has app't 2moro to see Mac "gen1uses"
me: How did it break? Mysteriously?
Pamela: not so Mysteriously.
1 sp1lled a small amount of H20

Intermittently a few of her keys would not work so she was resorting to l33t speak, cutting and pasting my own words back to me, using chemical formula abbreviations, or simply referring to herself in the third person. So I did what any good, overly nerdy friend would do in that situation.

grep -vi "[fri]" /usr/dict/words | mutt -s "Here's a list of words that don't use F, R, or I" [Pam's email address]

But as you can probably imagine, a list of all of the words in the English language that don't use the letters F, R, or I isn't all that useful. For starters one would have to search the entire list of words and the definitions aren't even there.

I simply had to do more to help the poor girl, so I helped how any good, super geeky friend would help. I made a small program that uses a machine readable thesaurus from the Moby project to accept a sentence that you want to type, as well as a list of keys that are broken. The program searches the sentence for any uses of the broken keys and swaps them out for suitable synonyms that don't also use the broken keys. In the event there are no suitable synonmys, the word gets printed out with square brackets. I call it PamFRI.

If you're wondering what the above paragraph looks like without the letter's F, R, or I:

Ego absolutely had to do on and on to help the debased dame, so psyche helped how any good, hot geeky bosom buddy would help. Monad made a small agenda that uses a jalopy plumbable cache ex the Moby lay plans to accept a sentence that you want to type, as well as a levy about jolty keys. The keynote speech looks down the sentence so as to any uses about the wobbly keys and swaps them out because plenty good enough synonyms that don't also use the quelled keys. Gangplank the event no seasonable synonmys can be etch, the vow gets typeset out amongst yes-man [brackets]. One and only call the goods [PamFRI].

(planet "" ("neil" "csv.plt" 1 1))
(lib "")
(lib ""))

(define thesaurus
(let ([table (make-hash-table 'equal)]
(open-input-file "mobythes.aur")
'((separator-chars . (#\,))
(strip-leading-whitespace? . #t)
(strip-trailing-whitespace? . #t)))])
(let loop ([line (get-line)])
(unless (empty? line)
(let ([word (first line)])
(string-lowercase! word)
(hash-table-put! table word (rest line))
(loop (get-line)))))

(define (suggest badchars sentence)
(lambda (aword)
(string-lowercase! aword)
(if ((typeable? badchars) aword)
(replacement badchars aword)))))

(define ((typeable? badchars) aword)
(not (regexp-match
"(?i:[" (list->string badchars) "])"))

(define (replacement badchars aword)
(let* ([synonyms
thesaurus aword (lambda () empty))]
(filter (typeable? badchars) synonyms)])
(if (empty? replacements)
(string-append "[" aword "]")
(list-ref replacements
(random (length replacements))))))

You call the program like this:

> (suggest '(#\h) "hello my name is")
"salutation my name is"
> (suggest '(#\h #\n) "hello my name is")
"kiss my itemize is"
> (suggest '(#\i) "I like the program very much")
"superego respect the program very much"

So if you're a clumsy, water drinking, Apple computing, debased dame, fear not. Help is on the way. You can download the program here in a zip format complete with the thesaurus. The program requires Dr. Scheme to be opened which is availible for Linux, Mac, and Windows.

By the way, I fully intend to continue calling them 'yes-man brackets'.


Joe said...

does it get any more you than this? so great.

Robby said...

This has got to me the most useless helpful thing I've ever seen! And on so many levels, too! Wow.

Mike Machenry said...

Ha, thanks a bunch, guys.

Joe, I think the only way it could get more me is if this program were somehow written on a computer made of PVC. Hm......

Robby, yes, there are far too many levels of useless going on here. As has been pointed out by Pam's sister, Maureen, and a few others, there's no way to actually type in the characters that you can't type, or the sentence you'd like to type for that matter. Not without an on-screen keyboard. I knew this was a problem and in-fact considered making a little on-screen keyboard for the program. But if one could just use that, then there would be no need for this program.

So in conclusion, without an on-screen keyboard there's no use for this program and with an on screen keyboard there's no need for it.

cdfh said...