Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

Spell Checker Problem In this exercise, you will create a simple spell checker program. Your program will have the following characteristics: Your program will be

Spell Checker Problem
In this exercise, you will create a simple spell checker program. Your program will have the following characteristics:
Your program will be capable of reading multiple files to be spell checked from command line arguments.
When your program starts up, you will read in the dictionary.txt file which contains a list of known words. Only read in this file once. Store these words in a HashSet data structure.
Create a TreeSet to store any miss-spelled words that you find.
For each file in the command line parameter list, print out the name of the file before reading in any words.
For each file parse out each of the words in the file and check to see if the word is in the HashSet you created with the dictionary.txt words or its already in your list of miss-spelled words.
If the word is in the dictionary HashSet or the miss-spelled word TreeSet then proceed to the next word.
If the word is not in the dictionary or the miss-spelled word list, give your user 2 choices: Add the word to the HashSet dictionary, or add the word to the list of miss-spelled words.
At the end of each file processed, dump out the list of miss-spelled words.
When you then start to read in the next file, make sure you clear the list of missspelled words. Keep any words added to the dictionary HashSet.
More details:
In parsing the words in these text files, you will need to filter out punctuation characters. I used split("+|)/(?? p{Punct}")
before checking the word against the dictionary, make sure you lower case the word
if the "word" doesn't start out with a letter (i.e.'a' And 'z'), then skip it because it is likely a number
If the word couldn't be found in either list and ends with an 's', try removing the 's' to create a singular version of the word and try again to find the word in your dictionary or miss-spelled word list using the singular version of the word.
Only print out lines that contain a word needing a user response.
Use the provided txt files and starter code
Your command line arguments will be:
Mexico.txt
image text in transcribed

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

Securing SQL Server Protecting Your Database From Attackers

Authors: Denny Cherry

2nd Edition

1597499471, 978-1597499477

Students explore these related Databases questions