Question: I want to fix it in python! CSC 130 Programming Assignment 6 Fall 2017 This assignment is worth 20points and must be turned in at
CSC 130 Programming Assignment 6 Fall 2017 This assignment is worth 20points and must be turned in at the start of class on Tuesday, November 21st. Remember to place your python file prog6.py in your folder on trace Assignment Overview This assignment focuses on the implementation of Python programs to read files and process data using dictionaries and sets. Assignment Background What is co-occurrence problem? You will write a Python program to solve the co-occurrence problem. The co-occurrence problem is stated as follows. We have a file containing English sentences, one sentence per line. Given a list of query words, your program should output the line number of lines that have all those words. While there are many ways to do this, the most efficient way is to use sets and dictionaries. Here is one example. Assume that the following is the content of the file. Line numbers are included for clarity; the actual file doesn't have the line numbers. 1. Try not to become a man of success, but rather try to become a man of value. 2. Look deep into nature, and then you will understand everything better. 3. The true sign of intelligence is not knowledge but imagination. 4. We cannot solve our problems with the same thinking we used when we created them. 5. Weakness of attitude becomes weakness of character. 6. You can't blame gravity for falling in love. 7. The difference between stupidity and genius is that genius has its limits. These are quotes fom Albert Einstcin.) If we are asked to find all the lines that contain this set of words: ["true". "knowledge", "imagination") the answer will be line 3 because all three words appeared in line 3. If they appear in more than one line, should report all of them. For example, co-occurrence of fthe". "is") will be lines 3 and 7. Implementation You need to implement the following functions: 1) open file) The open tile function will prompt the user for a file-name, and try to open that file. If the file exists, it will return the file object, otherwise it will re-prompt until it can successfully open the file. This feature should be implemented using a while loop, and a try-except clause
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
