Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Now that you can identify how many positive and negative words occurred in a passage, you'll need to calculate a sentiment score. To obtain a
Now that you can identify how many positive and negative words occurred in a passage, you'll need to calculate a sentiment score. To obtain a sentiment score: - Multiply num_pos_words by 1 . - Multiply num_neg_words by -1 . - Add these values together, then divide by num_words_total. Implement this algorithm in a function called calculate_sentiment . Starter code: def calculate_sentiment(passage): info = couni_sentiment_words(passage) \#\#\# Your code here! ]: \# your code here raise NotImplementedError test_passage = "I love CSS 1, it's my favorite class" assert calculate_sentiment assert type(calculate_sentiment(test_passage)) is float [ ]: \#\#\# This cell contains at least one hidden test assert calculate_sentiment(test_passage) ==.25 Part 4: Submit
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