views:

110

answers:

7

I need to determine if an unknown 5 or 6 letter string is a valid word, i.e. is in the dictionary. I could submit the string/word to an online dictionary, but I need to check this string/word, which will be different each time, for about 100 to 150 times. This seems to be a bit time consuming.

My next thought would be to try to get a dictionary program of my own. It would need to be in Java as my program is written in Java. Does the Java API already have a class for doing this? Can I get a descent one that someone has already coded, and all I have to do is submit the string/word to it?

My program is not being used for spell checking. I want to write a program for unscrambling the Jumbled Word Puzzles when I get stuck on a scrambled word. Thanks for your suggestions.

A: 

You could use one of the open source dictionaries and load it into a database: ftp://ftp.cerias.purdue.edu/pub/dict/ and ftp://ftp.ox.ac.uk/pub/wordlists/

wallyk
actually you might do better using a Trie if you're going to roll your own: http://stackoverflow.com/questions/1332104/find-the-existence-of-a-word-in-a-large-dictionary
Mark E
A: 

aspell and its associated word lists and dictionaries might be the answer.

SpliFF
A: 

I think aspell has a Java version.

edit: actually it looks like you might do better with this aspell spinoff called Jazzy.

Mark E
+1  A: 

Maybe you can check some wordlist: http://wordlist.sourceforge.net/

This page has some word lists in text format, so you can process in Java yourself, most easily using a HashSet. You need to use more efficient data structures if efficiency is important.

Yin Zhu
+1  A: 

For scrambled words, you might want to look at the Jumble algorithm, an implementation of which is seen here.

trashgod
A: 

Maybe you could try Peter Norvig's spelling checker. I think it's an elegant way to get 80-90% accuracy.

duffymo
+1  A: 

If you don't need spell checking this would be really easy. Just load all your words into a HashSet and then check to see if that set contains the word you want to test. There are tons of word lists available.

If you do need a spell checker, then check out aspell or other free APIs.

Chad Okere