Join 3,438 readers in helping fund MetaFilter (Hide)

Where to find a dictionary of words that are spelled backwards?
March 13, 2005 6:42 PM   Subscribe

Where can I find a dictionary of words spelled backwards, listed in alphabetical order, preferably accessible via WWW? This kind of book used to be a common tool for cryptographers back before everything was done by machine, but I'm not a spook; I just like Oulipo-style wordplay. I used to know what this was called, but no longer do, and have googled "reverse dictionary", "backwards dictionary", "yranoitcid", and many more terms with no success. Suggestions for similar dictionaries, such as ones in which all the letters of the words are sorted alphabetically (mouse->emosu) are also welcome. Thanks.
posted by rwhe to Writing & Language (24 answers total)
Just made one for you with a perl script. Go here:
posted by tss at 6:46 PM on March 13, 2005

Most linux installations come with word lists (to be used for spellchecking), and it's pretty much trivial to reverse each word, or to filter them according to other criteria (alphabetic sorting, palidromity, etc.).

Get yourself a word list and play to your heart's content.

On preview: looks like tss knows this too.
posted by orthogonality at 6:47 PM on March 13, 2005

Interested parties can make their Linux box generate the same list with

perl -pe 'chop;$_=reverse($_)."\n"' < /usr/share/dict/words | sort > outputfile.txt

My apologies for the overly verbose perl program.
posted by tss at 6:49 PM on March 13, 2005

Your apologies are accepted, but don't let it happen again.

perl -lpe reverse < /usr/share/dict/words | sort
posted by fvw at 6:57 PM on March 13, 2005

Or just:

perl -lpereverseyouknowwhereitisandhowtosorttheoutputsojustdoit
posted by orthogonality at 7:09 PM on March 13, 2005

You're not going to make me point out that that's 15 characters longer I hope…
posted by fvw at 7:11 PM on March 13, 2005

You actually counted? ;)
posted by orthogonality at 7:22 PM on March 13, 2005

rev /usr/share/dict/words | sort

posted by spacewrench at 7:28 PM on March 13, 2005

Dude! It's not cool if you don't use Perl!
posted by kenko at 7:31 PM on March 13, 2005

And along those lines, it's cooler if you don't use sort(1):

perl -a0ne'print sort(map($_=reverse."\n",@F))' /usr/share/dict/words
posted by tss at 7:41 PM on March 13, 2005

or if you don't mind a blank line at the top, maybe

perl -le'print sort(map($_=reverse,<>))' /usr/share/dict/words

OK, back to work. I love this stuff.

posted by tss at 7:47 PM on March 13, 2005

Not to stray too far offtopic, but I would like to point out that not only was tss kind enough to link to an answer, but it only took him 4 minutes to get it online.
posted by bh at 7:51 PM on March 13, 2005

Awesome. You're all fan-freakin' awesome.

I use Perl every day, but I had a mental (and probably deep emotional) block. I don't know why I didn't think of using it here.

For the record, tss's "blank line at the top" command line was the shortest one that actually worked on my machine, and -- hey, tss was the guy who got it online in four minutes, too! So I'm marking those as best answers. But you're all awesome.
posted by rwhe at 8:05 PM on March 13, 2005

Do you people like making things harder than necessary?

sort -d -r /usr/share/dict/words

posted by buxtonbluecat at 8:12 PM on March 13, 2005

Ungh, on second thought a bare "reverse" wouldn't work as you need the result to be assigned to $_, which means you need

perl -lpe '$_=reverse' < /usr/share/dict/words | sort

(which is still 10 characters shorter than ortho's, and no I didn't count, I used perl -lpe '$_=length' (well, I used wc -c, but let's pretend I used perl so I can snub spacewrench's much shorter solution))
posted by fvw at 8:13 PM on March 13, 2005

buxtonbluecat: Since rwhe wants the actual words reversed, not the sort order reversed, that won't work.
posted by tss at 8:14 PM on March 13, 2005

p.s. cheers, yeah, the joys of a desktop webserver. Finally an AskMe I can answer!
posted by tss at 8:19 PM on March 13, 2005

fvw writes "which is still 10 characters shorter than ortho's"

ortho's was a joke, poking fun at the brevity of perl code.
posted by orthogonality at 8:19 PM on March 13, 2005

Ortho: This may indeed be the case, but evidently unbeknownst to you, your joke code also reverses and sorts file contents, implements a miniature SQL database, and decrypts DVDs. It is a nice effort but, as noted, a little bit long.
posted by tss at 10:26 PM on March 13, 2005

presumably you're searching for words in this dictionary? if you have a unix shell, you can do things like:
bash-2.05b$ rev /usr/share/dict/words | egrep olleh
bash-2.05b$ rev /usr/share/dict/words | egrep "^oll..\$"
the first example gives all (reversed) words containing "olleh" and the second all words that start with "oll" and have exactly two more characters.
for more info use man egrep, and for doing such things on windows, look at cygwin.
posted by andrew cooke at 7:46 AM on March 14, 2005

of course, if you just want words that end in "ello", you don't need to reverse at all:
bash-2.05b$ egrep "ello\$" /usr/share/dict/words

posted by andrew cooke at 7:49 AM on March 14, 2005

Okay, what about the most obfuscated answer, smart people?
posted by Mo Nickels at 8:04 AM on March 14, 2005

I have the most obfuscated anwer, however it's so obfuscated I'm not even going to hint at it here. Obfuscated enough for you?
posted by fvw at 1:07 PM on March 14, 2005

Mo Nickels writes "Okay, what about the most obfuscated answer, smart people?"

"I have discovered a truly obfuscated answer which this margin is too large to contain"
posted by orthogonality at 5:39 PM on March 14, 2005

« Older I'm having a problem with some...   |  What was the first match playe... Newer »
This thread is closed to new comments.