Question: write a program Spell.java that generates a list of misspelled words for a given text. To do this, create a hash set with 1000 buckets,

write a program Spell.java that generates a list of misspelled words for a given text. To do this, create a hash set with 1000 buckets, and load the words from dictionary.txt into it. Then check each word in the file test.txt against it. Any word not in the dictionary should be considered misspelled and written to the output file, misspelled.txt. Your program should return the following results:

noow broawn sdog

you will want to remove punctuation and capitalization before checking if a word is in the dictionary.

If you need to debug your program, use smallDictionary.txt, which contains just the twenty words in the test.txt file, change the hash table size to 5, and print it out so that you can see what it looks like internally.

due t the site of dictionary.txt only small dictionary is included

//smallDictionary.txt

aid

all

brown

come

dog

for

fox

good

is

jumps

lazy

men

now

of

over

party

quick

the

time

to

//test.txt

Noow

is

the

time

for

all

good men to come to the aid of the party.

The quick broawn fox

jumps

over

the lazy sdog!!!!

//removing punctuation and changing letters to lower case

public static String removePunc (String lowercase){

String removepunc = "";

lowercase = lowercase.toLowerCase();

for(int i = 0; i < lowercase.length(); i++){

char ch = lowercase.charAt(i);

if(isLetter(ch))

removepunc += ch;

}

return removepunc;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!