Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

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

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Database Design And SQL For DB2

Authors: James Cooper

1st Edition

1583473572, 978-1583473573

More Books

Students also viewed these Databases questions