Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write this program is C. Please comment code. And please show the results as well. As well as the execution on the command line. You
Write this program is C. Please comment code. And please show the results as well. As well as the execution on the command line.
- You are given Shakespeare RomeoandJuliet.txt file which contains the whole book. (A large file). (Please use any file if you cant find RomeoandJuliet.txt).
- You are also given another text file called correctspelling.txt that contains correct spelling of words in the RomeandJuliet.txt. Each word of correctspelling.txt it on its own line. This file is in alphabetical order. This is also a large .txt file.
- You are basically looking for the misspelled words in Romeo and Juliet. If a word is not spelled like it is in correctspelling.txt then is in incorrect.
- Take into account the 26 letters and apostrophe ( ). It is also case insensitive.
- Please write TWO codes!
- First code - You will need to insert the words in correctspelling.txt into a dictionary tree. This tree should allow a caller to insert words to a tree to build a dictionary and search the tree to find if a given word matches (case insensitive search) any stored word in the tree.
- Next write a code to test your dictionary tree implementation by building a dictionary tree from a source dictionary text file and then use the dictionary tree to perform spell checks on all words read from another text file and print out all misspelled words there.
- This code should contain the main(int argc, char **argv)
- Basically, in this code you will use check to see if the words in RomeandJuliet.txt is spelled the same as in correctspelling.txt.
- Print the misspelled words to standard out. You can capture standard out to a file using the > and a filename. Please show how to do this in command line. The misspelled words should be EXACTLY how they were in the Romeo and Juliet book.
- To sum up, insert the words in correctspelling.txt into a tree. So, if a word in the RomeoandJuliet.txt file is not spelled the way it is in correctspelling.txt then it is incorrect. The incorrect words should be printed to a standard out. The misspelled words should be in the order of from beginning of the file to the end of the file.
- I will give a small example below.
- RomeoandJuliet.txt first line is- Enterd Sampson and Gregory, with swords and bucklers, ofs thed house of Capulet.
- correctspelling.txt (each word on its own line) and
- bucklers
- Enter
- Gregory
- of
- the
- The incorrect words in RomeoandJuliet.txt is Enterd
- ofs
- Thed
The misspelled words are exactly in the order of how they appeared in RomeoandJuliet.txt
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