Question

Python 3.x:

Write a function typos(fname) that finds suspected typos in the file fname. To do that we need a dictionary, for which we use the file words.txt which is a reasonably complete list of English words (though you may disagree after running it on some sample texts). Any word in fname that is not in the dictionary should be printed, and we should be told how often it occurs in fname. Below I ran a Mark Train novel to test the program; the actual output is much longer. Note: For full credit, do the pre-processing properly: remove any non-letter characters from the input text. Also, each suspected typo should be printed only once. Use the right data-type for that. Do worry about efficiency, i.e. rereading or reprocessing the files is too slow.

This is how it should look. You can use any text file obciously but the functionality should be the same.

Python 34.3 Shell File Edit Shell Debug Options Window Help >typos (innocents.txt) Suspected misspelling: kuneiyiseh Suspected misspelling: genova Suspected misspelling: capt Suspected misspelling: lvii Suspected misspelling: conventionalities Suspected misspelling: teneriffe Occurs 1 times Occurs 1 times Occurs 2 times Occurs 2 times Occurs 1 times Occurs 1 times Ln: 2258 Col: 4

0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
Python 3.x: Write a function typos(fname) that finds suspected typos in the file fname. To do...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • Please use Python for this program Random Number File Writer Write a program that writes a...

    Please use Python for this program Random Number File Writer Write a program that writes a series of random numbers to a file. Each random number should be in the range 1 through 500. The program should let the user specify how many random numbers to put into the file. The name of the file to write to should be 'random.txt'. Submit the random.txt file generated by your program with the assignment. Sample program execution: Python 3.4.3 Shell Eile Edit...

  • Python 3 please and thank you Task 3: Create a Function 7 Create the function TotalRewardPoints...

    Python 3 please and thank you Task 3: Create a Function 7 Create the function TotalRewardPoints which accepts the dictionary that you created in Task 1 and a list of ticket purchases and displays the information as shown below. Ticket Purchase List is formatted as [Number of Tickets, Type of Ticket....] The total reward points a user gets is calculated by using the following formula: Reward Points = Number of Ticket Bought x Reward Points for that Ticket Type Your...

  • FOR PYTHON: Write a function findMinRow() that takes a two-dimensional list of numbers as a parameter....

    FOR PYTHON: Write a function findMinRow() that takes a two-dimensional list of numbers as a parameter. It returns the index of the minimum row in the list. The minimum row is the row with the smallest sum of elements. If the list has multiple rows that achieve the minimum value, the last such row should be returned. If the list is empty the function should return -1. The following shows several sample runs of the function: Python 3.4.1 Shell File...

  • 1. Please write the following code in Python 3. 2. Please also show all outputs. Create...

    1. Please write the following code in Python 3. 2. Please also show all outputs. Create a dictionary named letter_counts that contains each letter and the number of times it occurs in string1. Challenge: Letters should not be counted separately as upper-case and lower-case. Intead, all of them should be counted as lower-case. string1 = "There is a tide in the affairs of men, Which taken at the flood, leads on to fortune. Omitted, all the voyage of their life...

  • Python program This assignment requires you to write a single large program. I have broken it...

    Python program This assignment requires you to write a single large program. I have broken it into two parts below as a suggestion for how to approach writing the code. Please turn in one program file. Sentiment Analysis is a Big Data problem which seeks to determine the general attitude of a writer given some text they have written. For instance, we would like to have a program that could look at the text "The film was a breath of...

  • Write the following functions, as defined by the given IPO comments. Remember to include the IPO...

    Write the following functions, as defined by the given IPO comments. Remember to include the IPO comments in your submission. Be sure to test your code -- you can use the examples given for each function, but you should probably test additional examples as well -- and then comment-out or remove your testing code from your submission!. We will be testing your functions using a separate program, and if your own testing code runs when we load your file it...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT