Instructions A very known application in natural language processing is to extract information from a given text. In this lab, you will be able to extract some emotions (Sad and Happy) from a given string and calculate the score of each emotion. You will be given below the words that express sadness, anger, and happiness. For each word, you will be given weight as well, so that when you are calculating for example the score for sadness in the text (string), you can use this formula: Sadness_Score = Weight_1 + Weight_3 +Weight_4 Sadness Words Word Weight Word Weight Word Weight Word Weight abandon 2 ashamed awful 4 bad 5 hard 3 belittle 3 betray 5 crash 4 crazy cry 3 disappoint 3 death 5 Happiness Words Word Weight Word Weight Word Weight Word Weight accomplish friend 3 beach beautiful dawn 4 adorable 3 enjoy 5 celebrate 4. cheer 3 bless 4 baby 3 angel 5 1. Create the functions sadness_score, and happiness_score 2. Each function has only 1 parameter of type string: text 3. In each function, create a list of tuples for the words and their weights i.e in happiness_score you should have happiness_list = [ ("accomplish, 3), ....] 4. Loop over the tuples and check if the word is in the given text. If the word is found, increment the result by words score, otherwise do nothing 5. Return the final score Example Input: "This lab is driving me crazy. I want to accomplish more so I won't feel bad at the end of the day" Return from sadness_score function: 7 Return from happiness_score function: 3 3. 2.

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 very known application in natural language processing is to extract information from a given text. In this lab, you will be able to extract some emotions (Sad and Happy) from a given string and calculate the score of each emotion. You will be given below the words that express sadness, anger, and happiness. For each word, you will be given weight as well, so that when you are calculating for example the score for sadness in the text (string), you can use this formula:

Instructions
A very known application in natural language processing is to extract information from a given text. In this lab, you will be able to extract
some emotions (Sad and Happy) from a given string and calculate the score of each emotion. You will be given below the words that
express sadness, anger, and happiness. For each word, you will be given weight as well, so that when you are calculating for example the
score for sadness in the text (string), you can use this formula:
Sadness_Score = Weight_1 + Weight_3 +Weight_4
....
Sadness Words
Word
Weight
Word
Weight
Word
Weight Word Weight
abandon
2
ashamed
awful
4
bad
5
hard
3
belittle
3
betray
5
crash
4.
crazy
2
cry
3
disappoint
3
death
5
Happiness Words
Word
Weight
Word
Weight Word Weight
Word
Weight
accomplish
3
friend
3
beach
4
beautiful
5
dawn
4
adorable
3
enjoy
5
celebrate
4
cheer
3
bless
4.
baby
3
angel
5
1. Create the functions sadness_score, and happiness_score
2. Each function has only 1 parameter of type string: text
3. In each function, create a list of tuples for the words and their weights i.e in happiness_score you should have happiness_list
[ ("accomplish, 3), ....]
4. Loop over the tuples and check if the word is in the given text. If the word is found, increment the result by words score, otherwise do
nothing
5. Return the final score
Example
Input: "This lab is driving me crazy. I want to accomplish more so I won't feel bad at the end of the day"
Return from sadness_score function: 7
Return from happiness_score function: 3
Transcribed Image Text:Instructions A very known application in natural language processing is to extract information from a given text. In this lab, you will be able to extract some emotions (Sad and Happy) from a given string and calculate the score of each emotion. You will be given below the words that express sadness, anger, and happiness. For each word, you will be given weight as well, so that when you are calculating for example the score for sadness in the text (string), you can use this formula: Sadness_Score = Weight_1 + Weight_3 +Weight_4 .... Sadness Words Word Weight Word Weight Word Weight Word Weight abandon 2 ashamed awful 4 bad 5 hard 3 belittle 3 betray 5 crash 4. crazy 2 cry 3 disappoint 3 death 5 Happiness Words Word Weight Word Weight Word Weight Word Weight accomplish 3 friend 3 beach 4 beautiful 5 dawn 4 adorable 3 enjoy 5 celebrate 4 cheer 3 bless 4. baby 3 angel 5 1. Create the functions sadness_score, and happiness_score 2. Each function has only 1 parameter of type string: text 3. In each function, create a list of tuples for the words and their weights i.e in happiness_score you should have happiness_list [ ("accomplish, 3), ....] 4. Loop over the tuples and check if the word is in the given text. If the word is found, increment the result by words score, otherwise do nothing 5. Return the final score Example Input: "This lab is driving me crazy. I want to accomplish more so I won't feel bad at the end of the day" Return from sadness_score function: 7 Return from happiness_score function: 3
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Problems on Dynamic Programming
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