A Python language Programming in Natural Language Many researchers today now use data from Twitter to analyze and predict the future events. Questions such as which place in a country is the happiest one, who will be the next US president and which place has the highest rate of depressed people, sometimes depend on the information extracted from thousands of tweets. In case of predicting the happiest state in the US, NLP experts have a set of words that also contains their rates, respectively. For example, the word “great” may have a rate from a scale of 1 to 10, 10; the word "awesome" may have a rate of 8; the word “sad” may have a rate 1 and so on. By computing the average score of a tweet using this set of words, researchers would now be able to measure and categorize the mood of a tweet depending on a certain threshold. In this problem, you will be an assistant of an NLP expert who will determine the mood of a tweet. The category would be: < 5 is "sad" >= 5 is "happy"   Let say, we have a tweet: OMG! I am so happy today #easyMachineExam When input, “OMG! I am so happy today #easyMachineExam”   And consider our list of words are the following: wth 4, omg 7, happy 10, great 10, awesome 8, sad 1, disappointing 2, hello 2, relieved 9, damn 3, hard 4   We get only the scores of the words that exist in our list. Since OMG and happy are the only words in the list, we will have {7(OMG) + 10(happy) } / 2 = (7+10)/2 = 8.5 , thus "happy" Let’s limit our set of words to what is stated above.   Note: Punctuations should be included when giving an input. Thus, you should find a way to remove the punctuations when quantifying its mood. Otherwise, OMG! will not get that rate 7. Also, it should not be case-sensitive(i.e. “HeLlo, HELLO, hellO, and hellO are the same words.) Let’s limit our inputs to words separated by one whitespace. Do not include the words with hashtags.   OmG! I AM SO HAPPY TODAY #easymachineexam should also get 8.5 which is “happy” Another example, Damn! I studied so hard but this is quite disappointing #tooEasyToAnswer #justOnce (3(damn)+4(hard)+2(disappointing))/3 = 9/3 = 3, thus "sad"

Operations Research : Applications and Algorithms
4th Edition
ISBN:9780534380588
Author:Wayne L. Winston
Publisher:Wayne L. Winston
Chapter19: Probabilistic Dynamic Programming
Section19.4: Further Examples Of Probabilistic Dynamic Programming Formulations
Problem 7P
icon
Related questions
Question

A Python language

Programming in Natural Language Many researchers today now use data from Twitter to analyze and predict the future events. Questions such as which place in a country is the happiest one, who will be the next US president and which place has the highest rate of depressed people, sometimes depend on the information extracted from thousands of tweets. In case of predicting the happiest state in the US, NLP experts have a set of words that also contains their rates, respectively. For example, the word “great” may have a rate from a scale of 1 to 10, 10; the word "awesome" may have a rate of 8; the word “sad” may have a rate 1 and so on. By computing the average score of a tweet using this set of words, researchers would now be able to measure and categorize the mood of a tweet depending on a certain threshold. In this problem, you will be an assistant of an NLP expert who will determine the mood of a tweet. The category would be:

< 5 is "sad"

>= 5 is "happy"

 

Let say, we have a tweet:

OMG! I am so happy today #easyMachineExam

When input, “OMG! I am so happy today #easyMachineExam”

 

And consider our list of words are the following:

wth 4, omg 7, happy 10, great 10, awesome 8, sad 1, disappointing 2, hello 2, relieved 9, damn 3, hard 4

 

We get only the scores of the words that exist in our list. Since OMG and happy are the only words in the list, we will have

{7(OMG) + 10(happy) } / 2 = (7+10)/2 = 8.5 , thus "happy" Let’s limit our set of words to what is stated above.

 

Note: Punctuations should be included when giving an input. Thus, you should find a way to remove the punctuations when quantifying its mood. Otherwise, OMG! will not get that rate 7.

Also, it should not be case-sensitive(i.e. “HeLlo, HELLO, hellO, and hellO are the same words.) Let’s limit our inputs to words separated by one whitespace.

Do not include the words with hashtags.

 

OmG! I AM SO HAPPY TODAY #easymachineexam should also get 8.5 which is “happy”

Another example,

Damn! I studied so hard but this is quite disappointing #tooEasyToAnswer #justOnce

(3(damn)+4(hard)+2(disappointing))/3 = 9/3 = 3, thus "sad"

Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Computational Systems
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Operations Research : Applications and Algorithms
Operations Research : Applications and Algorithms
Computer Science
ISBN:
9780534380588
Author:
Wayne L. Winston
Publisher:
Brooks Cole
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Enhanced Discovering Computers 2017 (Shelly Cashm…
Enhanced Discovering Computers 2017 (Shelly Cashm…
Computer Science
ISBN:
9781305657458
Author:
Misty E. Vermaat, Susan L. Sebok, Steven M. Freund, Mark Frydenberg, Jennifer T. Campbell
Publisher:
Cengage Learning