Question: Can someone help me figure this out in Python? Let's write a basic sentiment analyzer in Python. Sentiment analysis is the act of extracting mood

Can someone help me figure this out in Python?
Let's write a basic sentiment analyzer in Python. Sentiment analysis is the act of extracting mood from text. It has practical applications in analyzing reactions in social media, product opinions, movie reviews and much more. The 1.0 version of our sentiment analyzer will start with a string of positive and negative words. For any input text and the sentiment score will be calculated as follows: for each word in our tokenized text if word in positive_text then increment sentiment score else if word in negative_text then decrement sentiment score So for example, if: positive_text = "happy glad like" negative_text = "angry mad hate" input_text = "Amazon makes m.e like so angry and mad" score = -1 [+1 for like, -1 for angry, -1 for mad] You want to write sentiment as a function: Function: sentiment Arguments: positive_text, negative_text, input_text Returns: score (int) Then write a main program, that executes like this: Sentiment Analyzer 1.0 Type 'quit' to exit. Enter Text: i love a good book from amazon 2 positive. Enter Text: i hate amazon their service makes me angry -2 negative. Enter Text: i love to hate amazon 0 neutral. Enter Text: quit
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
