Question: Write a script called senticounter.py. Define a function run() inside senticounter.py. The function should: - Accept as a parameter the path to a text file.

Write a script called senticounter.py. Define a function run() inside senticounter.py. The function should: - Accept as a parameter the path to a text file. The text file has one review per line. - Read the list of negative words from the negative-words.txt file. - Create a dictionary that includes one key for each negative word that appears in the input text file. The dictionary should map each of these negative words to the number of times they appear immediately before the word "phone" in the entire file. - Return the dictionary Notes: Ignore case. You can also assume that the input file includes only letters, no punctuation or other special characters.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!