(5/5)

# have all used auto-correct to fix our venous typos and mistakes as we write, but have you ever wondered how It works? Here *s a small version of autocorrect that looks for a few common typographical errors.

INSTRUCTIONS TO CANDIDATES

Here is the link with my code and what I have so far right now, and also the reference file and example output

Part 1: Autocorrect

Ve have all used auto-correct to fix our venous typos and mistakes as we write, but have you

ever wondered how It works? Here *s a small version of autocorrect that looks for a few common

typographical errors.

To solve this problem, your program will read the naines of three files:

. the fIrst contains a list of valid words and their frequencies.

. the second contains a list of WOFIL% to autocorrect. and

. ib.’ third contains potential letter substitutions (deacribed below).

The input word flic has two entries per line; the first entry on the line is a single valid word in

the English language and the second entry is a float presenting the frequency of the word in the

lexicon. The two values are separated by a ro,nma.

Read this English dwtaonanj into a Python dictionary, using words a.’. keys and frequency as

velues. You will use the frequency for deciding the most likely correction when thcte are multiple

possibilities

The keyboard file has a line for cadi letter. The first entry on the line is the letter to be replaced

and the remaining letters are possible substitutions for that leUer, All the letters on the line are

separated by spaces. These substitutions are calculated based on adjacency on the keyboard, so if

you look down at your keyboard, you will ser that the aa” key is surrounded by “q”, ‘w”, “a”, and

z” Other substitutions were calculated similarly, so:

by! ghn

means that a possible replacement for b is any one of y f g h n. Read this keyboard file into a

dictionary: the first letter is the key (e.g.. b) and the remaining letters arc the velue, stored as a

Your program will then go through every single word in the Input liJe, autocorrect each word and

print the correction. To correct a single word, you will consider the following:

FOUND If the word is in the dictionary, it is correct. There is no need for a change. Print it as

found, and go on to the next word.

Otherwise consider all of the remaining possibiLities.

DROP If the word is not found, consider all possible ways to drop a single letter from the word.

Store an%’ valid words (words that arc In your English dictionary) In some container (List/set/

dictiomoy). These will be canclI4lnt.’ cnm’ctions.

(5/5)

## Related Questions

##### . Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma

##### . The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

##### . Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

##### . SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

##### . Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Hire Me