Answered step by step
Verified Expert Solution
Question
1 Approved Answer
its not letting me to attach any files. A spelling checker reads the words in a document and outputs a list of misspelled words. For
its not letting me to attach any files.
A spelling checker reads the words in a document and outputs a list of misspelled words. For each misspelled word, the program outputs the word followed by a list of the line numbers where the word is found in the document import 1agautl.* public clasa Word implementa ComparablexWord> private String word the misspelled word private AezList Intege>linesi / line numbers The program decides which words are misspelled by using a dictionary of correct words. The program searches the dictionary for each word in the document. If a word from the document cannot be found in the dictionary, the word is added to the list of misspelled words. public Word) ( ines new AEzayit public ord (String w, int lineKmber Project Files The following files are required to complete the project You should download these files from Google Drive. You are not allowed to modify these files in any way except for implementing methods that were intentionally left empty. Specifically, interface definitions may not be modified, and all code must remain in the spellcheck folder lines ArrayList (); = new public string gstNerd) return word public Arraylist integer> tines return lines import java io. public interface SpellCheckinterface public vd ddiine (int 1inembex) Loads the dictionary contained in the specified file public String toString param filename The name of the dictionary file to be loaded retur true If the file was successfully loaded, false return word""linesstaString if the file could not be loaded or was invalid throws IQException if filename does not exist public boolean ladDictionary(String fileName) throws IQException *Check the document for misspelled words 8return true if two words are equal, false otherwise 2Override public beoleen equals (object w) f / Left aa exerc1se ret true if the file was successfully spell checked, false if the fille had misspelled words @throws legalArgumentExceptign if filename is null -ecompare tw words and return the corresponding integer value (O, D, >0) 20verride public int compareTo (Word w) public boolean checkDocument String fileName) throws lOException return thiavord.sonarcte(.) Word.java import java.util import java.io.* public class SpellChecker implements SpellCheckinterfacef l New code in red Linkedl ist Word> misspelled String line-un.nextLne() tolowercas ); Stringl] tokens line split'TWP(Alpha for(int i-0,i-tokens.length++ dict = new LinkedList private String word the misspelled word private AezList Intege>linesi / line numbers The program decides which words are misspelled by using a dictionary of correct words. The program searches the dictionary for each word in the document. If a word from the document cannot be found in the dictionary, the word is added to the list of misspelled words. public Word) ( ines new AEzayit public ord (String w, int lineKmber Project Files The following files are required to complete the project You should download these files from Google Drive. You are not allowed to modify these files in any way except for implementing methods that were intentionally left empty. Specifically, interface definitions may not be modified, and all code must remain in the spellcheck folder lines ArrayList (); = new public string gstNerd) return word public Arraylist integer> tines return lines import java io. public interface SpellCheckinterface public vd ddiine (int 1inembex) Loads the dictionary contained in the specified file public String toString param filename The name of the dictionary file to be loaded retur true If the file was successfully loaded, false return word""linesstaString if the file could not be loaded or was invalid throws IQException if filename does not exist public boolean ladDictionary(String fileName) throws IQException *Check the document for misspelled words 8return true if two words are equal, false otherwise 2Override public beoleen equals (object w) f / Left aa exerc1se ret true if the file was successfully spell checked, false if the fille had misspelled words @throws legalArgumentExceptign if filename is null -ecompare tw words and return the corresponding integer value (O, D, >0) 20verride public int compareTo (Word w) public boolean checkDocument String fileName) throws lOException return thiavord.sonarcte(.) Word.java import java.util import java.io.* public class SpellChecker implements SpellCheckinterfacef l New code in red Linkedl ist Word> misspelled String line-un.nextLne() tolowercas ); Stringl] tokens line split'TWP(Alpha for(int i-0,i-tokens.length++ dict = new LinkedListStep 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