English 中文(简体)
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 5 years ago.

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.





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签