Question
Python We have provided a mini sentiment dictionary below (stored in the variable mini_sentiment) that provides the sentiment score for some individual words. Scores that
Python
We have provided a mini sentiment dictionary below (stored in the variable mini_sentiment) that provides the sentiment score for some individual words. Scores that are positive indicate positive sentiment and scores that are negative indicate negative sentiment. The larger the magnitude, the larger the sentiment impact. So, for example, a +1 indicates mildly positive sentiment, whereas a +2 and +3 indicate increasingly positive sentiment. Similarly, a -1 indicates mildly negative sentiment, whereas a -2 and -3 indicate increasingly negative sentiment.
# please run this cell in order to define the mini sentiment dictionary
mini_sentiment = { 'fantastic' : 3, 'terrible' : -4, 'awesome' : 4, 'fun': 2, 'boring': -2, 'best' : 4, 'okay' : 1, 'enjoy': 1, 'dislike': -1, }
a) Write a function name get_word_score that takes a word and sentiment dictionary as input and outputs the word score if the score is greater than or equal to 2 or less than or equal to -2. Note that get_word_score ignores mildly positive or negative sentiments.
b) Calculate the average sentiment of the paragraph while ignoring mildly positive or negative sentiment words.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered 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