Question: We will create a graphical spell checker program. The interface will look similar to this: The Edit menu has one menu item: Spell Check.This program
We will create a graphical spell checker program. The interface will look similar to this:
The Edit menu has one menu item: Spell Check.This program will use this file as a dictionary to look up properly spelled words. When the program starts, it will open the dictionary file (name it "Words.txt"). You will hash the words into a hash table container chosen from the choices available in the Java libraries.
Your program will have a menu item to open an input file and place it into a TextArea in a window. When the checking proceeds, you will extract a word from the text to be checked and find out if the word is in the dictionary. You will continue this process until you have checked all the words in the file. Each time you find a word that you cannot match in the dictionary, you will let the user know and you will attempt to generate a list of suggested words. You will generate the list by assembling similar words via three methods:
One letter missing. You assume that one letter has been left out of the word. You can assemble new words to check by adding letters a..z in each of the positions in the word from the start to the end of the word.
One letter added. You assume the word has an extra letter. You scan through the word deleting each of the letters in turn, and looking up the word formed by the remaining letters.
Two letters reversed. You swap letters in positions 0..1, 1..2, 2..3, ... , n-2..n-1, to form new words which you look up.
Each time you find a legal word from any of the three methods, you add it to the suggestion list, which you present to the user when you have finished this part of the process. If you cannot identify any suggestions, let the user know there are none.
User Interaction
All output from the spell checker should appear in a dialog box. You are not required to allow the user to select the proper word from the dialog and place it in the original text, although this would be an excellent extension to the program. If the user modifies the text manually and reruns the spell checker, the revised results should be checked
Example file:
Hello. My plan is to hav a test fiile that has UPPer and LOWER case words. All fuor cises of misspellings will be represented. The file will encompass more than one line and will have no other puncktuation than commas, and the dot at the end of a line.
-----------------------------------
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
