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"

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education