Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Learn To Program Databases With Visual Basic 6

Authors: John Smiley

1st Edition

1902745035, 978-1902745039

More Books

Students also viewed these Databases questions