开发者

checking words in a dictionary [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.

Want to improve this question? Update the question so it focuses on one problem only by editing this post.

开发者_高级运维

Closed 4 years ago.

Improve this question

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.


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/


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


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.


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


I think aspell has a Java version.

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


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜