check if password is dictionary word

R

ravimannan2002

Hello!

I need to check wether or not a String is in a dictionary. I looked at
JSpell and I couldn't find anything that could help me.

I looked at the java.util.Dictionary class, and it's an empty
Hashtable.

Should I just load a database table with dictionary words and then
query that? I would prefer not.

Any hints,suggestions,ideas??

Thanks!
 
S

Scott W Gifford

I need to check wether or not a String is in a dictionary. I looked
at JSpell and I couldn't find anything that could help me.

The well-known C library to do this is called "cracklib".

A google search for "java cracklib" turns up these:

http://sourceforge.net/projects/solinger/
http://www.middleware.vt.edu/doku.php?id=middleware:opensource:password

I haven't used either one, but I've used the standard cracklib from
Perl before and it's quite good.

Hope this helps,

----Scott.
 
R

Roedy Green

I need to check wether or not a String is in a dictionary. I looked at
JSpell and I couldn't find anything that could help me.

you need to create a HashSet of legal words. Then you look words up
to see if they are included.

The complications are handling plurals, guess the right word spelled
incorrectly.

You might google for a 3rd party dictionary with a Java interface.
 
?

.

Hello!

I need to check wether or not a String is in a dictionary. I looked at
JSpell and I couldn't find anything that could help me.

Could you elaborate? What about JSpell does not work for you?
I looked at the java.util.Dictionary class, and it's an empty
Hashtable.

Yes. In computer science Dictionary is an abstract data type (ADT). You
would still have to populate the structure with the data. Dictionary is
obsolete. You'd probably want to use something that implements Map or
Collection.
Should I just load a database table with dictionary words and then
query that? I would prefer not.

If that works for you. Bottom line, you will have to populate something
whatever you decide to do.
 
C

castillo.bryan

I don't know anything about JSpell, but I know you could use jazzy
http://jazzy.sourceforge.net/. There is a method to see if a word is
spelled correctly and a method to get suggestions for a mispelled word.
I would think you could use the getSuggestions method to make sure,
somebody didn't use a word that was too close to a dictionary word.
From what I remember Jazzy used disk io for reading dictionary files
and caching data on the words. When I used it before, I think I had to
create a singleton for the Dictionary and put synchronization blocks
around getting and checking the dictionary. Because it uses files and
has to write the files, it might not work well in a Servlet/JSP
environment though.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,019
Latest member
RoxannaSta

Latest Threads

Top