Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Above, you wrote code to calculate the number of positive ( pos_words) and riegative ( neg words ) worde for a given pasalage. Naw let's
Above, you wrote code to calculate the number of positive ( pos_words) and riegative ( neg words ) worde for a given pasalage. Naw let's do this in a function. White a function called count sentiment words that takes in a passage; and ratiars a dictionary with the following Kerys: - hus words total how mary words ocourred in the passage totar? - Hun_pos_yords t how many poekive words oocurred in the passage? - nuituneg. werds : how mary negative words oceurrod in the passage? You should be able to resse much of the sartu cose you created nbovel Starter eodede: neg.words = ('sad,' 'oistike;, "hate', 'angry', "horribte', 'bad', "worst," "boring', 'nogative'l In 1 I y your code here raise Notinplinentedtror In I 17 an this cell contains af least one hiddeo test. test passage =" "I love cas 1 , it's ey favorite class" assert count ient inent wards assert type(reunt _sent inent words (test_passage ) is dict assert 'num pos wi. wes' in count sent iment.words (test, passage), keys ()
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