Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

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

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions