aggregate final scores final_score pos_score neg_score norm_final_score round(float(final_scoretoken_count final_sentiment 'positiveif norm_final_score > else 'negativeif verbosenorm_obj_score round(float(obj_scoretoken_count norm_pos_score round(float(pos_scoretoken_count norm_neg_score round(float(neg_scoretoken_count to display results in nice table sentiment_frame pd dataframe([[final_sentimentnorm_obj_scorenorm_pos_scorenorm_neg_scorenorm_final_score]]columns=pd multiindex(levels=[['sentiment stats:']['predicted sentiment''objectivity''positive''negative''overall']]labels=[[ , , , , ],[ , , , , ]])print(sentiment_framereturn final_sentiment our function basically takes in movie reviewtags each word with its corresponding pos tagextracts out sentiment scores for any matched synset token based on its pos tagand finally aggregates the scores this will be clearer when we run it on our sample documents in [ ]for reviewsentiment in zip(test_reviews[sample_review_ids]test_ sentiments[sample_review_ids])print('review:'reviewprint('actual sentiment:'sentimentpred analyze_sentiment_sentiwordnet_lexicon(reviewverbose=trueprint('-'* reviewno comment stupid movieacting average or worse screenplay no sense at all skip itactual sentimentnegative sentiment statspredicted sentiment objectivity positive negative overall negative - reviewi don' care if some people voted this movie to be bad if you want the truth this is very good movieit has every thing movie should have you really should get this one actual sentimentpositive sentiment statspredicted sentiment objectivity positive negative overall positive reviewworst horror film ever but funniest film ever rolled in one you have got to see this film it is so cheap it is unbelievable but you have to see it really!!! watch the carrot