Free word list for use programmatically?
You can find a 2.2mb list of english words here.
You can access them using the file i/o functions.
Most unix (which includes osx) have a file /usr/share/dict/words
.
Options:
- Look for /usr/share/dict/words on your common or garden variety Unix install.
- http://www.ibiblio.org/webster/
- http://wordlist.sourceforge.net/
- http://svnweb.freebsd.org/csrg/share/dict/ (click the 'revision' tag of the file 'words')
#4
is the one I used for my own Python experiment into word games, and it worked nicely.
For bonus points, here's something to get you started on your word program:
import re
startwith = "MOON"
endwith = "GOLF"
cklength = re.compile('.{' + str(len(startwith)) + '}(\n)?$', re.I)
filename = "C:/dict.txt"
words = set(x.strip().upper() for x in open(filename) if x.match(cklength))
Words will then be a set of all 4 letter words in the dictionary. You can do your logic from there.
if you have access to a linux install, there should be some word lists in
/usr/share/dict/