Answered step by step
Verified Expert Solution
Link Copied!

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.

  1. You are given Shakespeare RomeoandJuliet.txt file which contains the whole book. (A large file). (Please use own files to test out code).
  2. You are also given another text file called correctspelling.txt that contains correct spelling of words in the RomeandJuliet.txt. The correctspelling.txt file does not contain every word in RomeoandJuliet.txt. Each word of correctspelling.txt it on its own line. This file is in alphabetical order (but being in alphabetical order is not relevant). This is also a large .txt file.
  3. 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.
  4. Take into account the 26 letters and apostrophe ( ). It is also case insensitive.
  5. 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.
  • Basically put correctspelling.txt in a dictionary tree
  1. Next 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.
  • Basically, in this code you will use check to see if the words in RomeandJuliet.txt is spelled the same as in correctspelling.txt. If a word in RomeandJuliet.txt is not in correctspelling.txt then it is considered misspelled.
  1. 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.
  2. 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. Also, if there is a word in RomeoandJuliet.txt and not in correctspelling.txt then that word that is incorrect as well. The incorrect words should be printed to a standard out. The misspelled words should be in the order of how they appeared in RomeoandJuliet.txt.
  3. I will give a small example below.
  • RomeoandJuliet.txt first line is- Enter Sampson and Gregory, with swords and bucklers, of the house of Capulet.
  • Example of first few words in correctspelling.txt
  • correctspelling.txt (each word on its own line) and
  • bucklers
  • Enter
  • Gregory
  • of
  • the
  • The misspelled words in RomeoandJuliet.txt is below and that is what should appear in the standard out. Each misspelled word on it own line.
  • Sampson
  • and
  • with
  • swords
  • house
  • Capulet
  • 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

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions