Question: i know u cant do the whole project i just need to know how to do this, there is a file which keeps things like
i know u cant do the whole project i just need to know how to do this, there is a file which keeps things like : abductions -2 abhor -3 abhorred -3 etc
and i need to calculate the polarities of sentences
Sentiment Analysis In this project, you will write a program which takes a sentence from the user and calculates the polarity score of this sentence. The polarity score of a sentence is computed as the sum of the polarity scores of the words in this sentence. To obtain the polarity score of words, you are given a file named "AFINN-en-165.txt" which consists of words and their polarity scores. In this file, each line contains word and its polarity score. To calculate the polarity of a sentence, you will split this sentence into words. For each word, if this word is found in the file, you will take the score of this word and add it to the score of the sentence: otherwise, you will ignore this word. However, the polarity score of a word must be negated if a negation comes before this word (e.g. the score of "not boring" must be 3 since the score of "boring" is - 3 and "not" comes before "boring"). The list of negations can be found in the program. We have provided you with a string of all the puncutations that can occur in a sentence (punctuation), so that you can strip each word from any punctuation. You will output the sentence such that words with known polarity are uppercase and the rest remain unchanged and the polarity score of this sentence. The code that prints the sentence and the polarity score separated by a newline is provided. Do not change it. Examples Input Output This movie is NOT BORING, on the contrary, the plot is very INTERESTING and the acting is WONDERFUL 9 This movie is not boring, on the contrary, the plot is very interesting and the acting is wonderful. The most amazing things that can happen to a human being will happen to you, if you just lower your expectations. The most AMAZING things that can happen to a human being will happen to you, if you just lower your expectations. 4 If you don't apologize, I will not accept any more calls. If you DON'T APOLOGIZE, I will NOT ACCEPT any more calls. 0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
