Starting from:
$30

$24

Spell Checker Solution

Introduction




A spell checker is a program that reads the words in a piece of text and looks up each of them in a dictionary to check the spelling. A simple way of performing spell checking is to store the set of all correctly spelled words in some data structure. For each word we need to check, we will search the data structure to see if the word is stored. If it is not, we will say that the word is spelled incorrectly.




Problem Statement




Use a binary search tree to design and implement a spell checker class, SpellCheck.java.




Problem Analysis




The goal of this assignment is to create a spell checker that reads in a dictionary (i.e. a list of correctly spelled words) from a file, and then reads in another file containing a document (i.e., another list of words) and checks whether each word in the document is contained in the dictionary. If all of the words in the document are contained in the dictionary, your program should print a message to standard output saying that no spelling errors were detected. Otherwise, your program should print a list of possibly misspelled words, in alphabetical order.




To complete this assignment, you should provide an implementation of the Dictionary ADT using a binary search tree. The BinarySearchTree.java class we have developed in class is recommended to be used. In addition, you will need to create a Dictionary ADT class, Dictionary.java, which possibly extends (using Java inheritance feature) the BinarySearchTree.java class we have developed.




You should thoroughly test your Dictionary ADT implementation and the spell checking code. A file containing a dictionary of words is provided. Note that this file is sorted alphabetically, contains roughly 25,000 words, and has one word per line. You can use this file to test your code, but your program should not assume the dictionary file is sorted, or that it has 25,000 words, or that it has only one word per line.




Program Input




The program gets its input from two data files, dictionary.txt and sampleText.txt. The dictionary.txt file consists of a list of correctly spelled words. The file has one word per line. The sampleText.txt file consists of a list of words to check their spelling. Your program should not assume that the sampleText.txt file has only one word per line.




Program Output




Your program should print a message to standard output saying that no spelling errors were detected.

Otherwise, your program should print a list of possibly misspelled words, in alphabetical order.




Submission Instructions




When you are satisfied with your implementation, and after testing it thoroughly, submit the Dictionary.java and SpellChecker.java files via Blackboard Learn.












More products