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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started