[Edu-sig] fun w/ word list
Brent Burley and Pat Erb
erburley@ix.netcom.com
Sat, 21 Jul 2001 13:12:18 -0700
One of the things I enjoyed while learning to program was playing with a
spell check library (anyone remember Borland's Turbo Lightning?) and
writing various word filters. This is now trivial in python:
>>> words = open('/usr/share/dict/words').readlines()
>>> words = [w[:-1] for w in words] # strip newline chars
>>> def aeiou(w): # return true if word uses every vowel
... f = string.find
... for c in 'aeiou':
... if f(w, c) == -1: return 0
... return 1
>>> filter(aeiou, words)
['adventitious', 'aeronautic', 'ambidextrous', 'argillaceous',
'argumentation', 'auctioneer', 'audiotape', 'augmentation',
'aureomycin', ...]
Other ideas:
- find palindromes
- find the words with the most number of each letter
- find words with no vowels
- find the word with the most vowels/consonants in a row
- make a histogram of letters used
- find words whose reverse is a word
- build a crossword puzzle solver
Most systems have a word list, but perhaps not in the location
shown above. Try 'man spell' and look in the FILES section.
Brent Burley