Free word list for use programmatically?

Question:

A friend of mine was talking about a word game she liked to play where you try to convert one word to another (they have the same number of letters) by switching one letter at a time, where each iteration produces a real word.

Example:

MOON –> WOLF
GOON
GOOF
GOLF
WOLF

I figured it’d be a fun little project to write a program to generate solutions, and taking it further, given 2 words, determine if a solution exists and the number of iterations in optimal solution.

Problem is I’m having trouble finding free word lists that I can easily access programmatically. I’m also thinking about using this as an excuse to learn Python, so it’d be great if anyone knows of free word lists and pointers on how to parse and access it from Python. The algorithm for figuring out how to find an optimal path I’ll work on my own.

Asked By: Davy8

||

Answers:

You can find a 2.2mb list of english words here.

You can access them using the file i/o functions.

Answered By: ryeguy

Options:

  1. Look for /usr/share/dict/words on your common or garden variety Unix install.
  2. http://www.ibiblio.org/webster/
  3. http://wordlist.sourceforge.net/
  4. 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.

Answered By: Paolo Bergantino

Most unix (which includes osx) have a file /usr/share/dict/words.

Answered By: Adam Luter

if you have access to a linux install, there should be some word lists in

/usr/share/dict/
Answered By: Eoin Campbell

For something similar I have used the Mozilla Firefox English dictionary. Find the English variant you want, e.g. US English, and right-click save to (the “Add to Firefox” button). The file you get is XPI type but it’s really a camouflaged ZIP file. Inside you will find en-GB.dic which is the dictionary content.

enter image description here

Inside dictionaries directory:

enter image description here

Answered By: idrosid

Have a look at the databases in dict.org. These are actually dictionary databases, so you would need to extract the word definitions yourself. You could start from Wordnet.

Answered By: kgiannakakis

I was having the same issue and with some digging into a scrabble based site, I found several of their word lists in a nice text format. They have an English version at https://www.wordgamedictionary.com/english-word-list/

Answered By: Cesar Bielich
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.