Question: I have to write a python program for this homework Submit a file named COMP2102 FLIN HW XXXXpy containing the Python code of your solution
Submit a file named COMP2102 FLIN HW XXXXpy containing the Python code of your solution to the problem, where XxXXr represents your student ID Write a program that reads from a text file "original.txr" an English paragraph such the one shown in Figure.1 and saves its word in a container called reference that keeps only the different words found in the text (e.g. the word Artificial is repeated more than one time in original.txt but reference should contain only 1 copy of the word artificial). Your program will then read another version of the text called misspelled.txt that contains the sametext but in which several words ar misspelled. Knowing that the only misspelling that occurs, is the one consisting of putting some letters of the word in wrong positions, (i.e. the letters of the word are all there but some of them are in wrong positions, example the word Artificial is wrongly spelled Aritifical). Once your program reads misspelled.txt, it should display for each misspelled word, the line number where it is located and possible corrections for the word. The corrections should be extracted from the container reference The format of the expected output is shown in Figure.3 Your program must define and use at least the follow ing functions with suitable parameters: 1. buildReference (..): that reads the contents of original.txt and saves the different words in the container reference 2. detectNcorrect(...).that reads the contents of misspelled.txt and saves the misspelled words as well as the possible corrections in an adequate container called corrections 3. proposeCorrections(..): that receives as input a single misspelled word and retums a list of possible corrections. 4. generatePermutations(...): a recursive helper function called by proposeCorrections() to generate all possible permutation of the word passed to it displayResults(..):that displays the line number of the misspelled words and the possible corrections. The results should be in the form of one misspelled word followed by its corrections in the same li Artificial intelligence (Al), sometimes called machine intelligence, is intelligence demonstrated by machines in contrast to the natural intelligence displayed by humans and other animals. In computer science A research is defined as the study of "intelligent agents":any device that perceives its environment and takes actions that maximize its chance of successfuly achieving its goals. Colloquially, the term "artificial intelligence" is applied when a machine mimics ognitive- functions that humans associate with other human minds, such as "learning" and "problem solving The scope of Al is disputed: as machines become increasingly capable, tasks considered as requiring intelligence" are often removed from the definition, a phenomenon known as the Al effect, leading to the quip in Tesler Theorem, "Al is whatever hasn't been done yet". For instance, optical character recognition s frequently excluded from "artificial intelligence", having become a routine technology. Modem machine capabilities generally classified as Al include successfully understanding human speech, competing at the highest level in strategic game systems (such as chess and Go), autonomously operating cars, and intelligent routing in content delivery networks and military simulations Recently, Deep Leaming is a hot topic in Al. It acts as a classifier that detects objects such as cats and dogs in images and videos Figure. 1: Sample contents of original.txt
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
