Question: Sentiment Counter 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

 Sentiment Counter Write a script called senticounter.py. Define a function run()

Sentiment Counter 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 positive words from the positive-words.txt file. Read the list of negative words from the negative- words.txt file. We define a NO-NEG review to be a review that includes no negative words. Create a dictionary that includes one key for each positive word that appears in the input text file. The dictionary should map each of these positive words to the number of NO-NEG reviews that include it. For example, if the word "great" appears in 5 NO-NEG reviews, then the dictionary should map the key "great" to the value 5. 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!