Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

help me implement the following c++ code Implement spelling corrector given the

ID: 3720901 • Letter: H

Question

help me implement the following c++ code

Implement spelling corrector given the following specification:

(a) Your program should take as an input a dictionary file in which every line stores one name, all upper case, and frequency of that name. For example, if invoked like this: ./a7 dict.txt your program should read dictionary from a file dict.txt.

(b) Dictionary provides information about correctly spelled names and their frequencies. Name is a single string and frequency is a positive integer. For example, the dictionary below contains three names:

BILL 10

JON 100

JIN 50

where JON is the most frequent.

(c) Your program should take query names from std::cin as long as they are provided.

(d) For each query name, your program should do the following: i. If the query name is already in the dictionary, print it together with its frequency separated by space. Frequency of the query name in the dictionary should increase by 1. ii. If the query name is not in the dictionary, provide a suggestion that is in the dictionary and is edit distance of 1 from the query (this should be the only action taken). If multiple suggestions exist, provide one with the highest frequency, and if several suggestions have the same frequency return the one which is lexicographically smallest. If no suggestion exists print - and include the query name in the dictionary with frequency 1.

(e) You can assume that all input data is correct, i.e. dictionary file always exists and is correct, all query and dictionary names are provided in upper case.

To illustrate how your program should work, consider the dictionary below stored in dummy.dict:

JON 100

JIM 90

BILL 1

WILL 2

Your code if invoked like this: echo "GILL BILL BILL DILL SANTA SANTA" | ./a7 dummy.dict should produce the following output:

WILL 2

BILL 1

BILL 2

BILL 3

-

SANTA 1

This is because GILL is edit distance 1 from WILL and BILL, but WILL has higher frequency, and SANTA initially is not in the dictionary

Explanation / Answer

#include #include #include #include using namespace std; vector GlobalList; enum error {CORRECT = 1, SUBSTITUTION, TRANSPOSITION, DELETION, INSERTION, ERROR}; void getString(ifstream& fin, ofstream& fout) { string line = ""; getline(fin, line, ' '); fout word; ::GlobalList.push_back(word); fout