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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started