Question: Language= python Provide screenshoot Write a function happiness (text) that uses the Dodds et al (1) happiness dictionary to rate the happiness of a piece

Language= python

Provide screenshoot

Language= python Provide screenshoot Write a function happiness (text) that uses the

Write a function happiness (text) that uses the Dodds et al (1) happiness dictionary to rate the happiness of a piece of english text input as a single string). The happiness score is the average score over all words in the text that appear in the dictionary. For simplicity, you may neglect the words with special characters in the dictionary. Test cases: s1 = "Mary had a little lamb." 82 = "Mary had a little lamb. Mary had a little lamb!" s3 = "A quick brown fox jumps over a lazy dog." happiness (81) and happiness (82) should return 5.368; happiness (83) should return 5.275. Write a function happiness (text) that uses the Dodds et al (1) happiness dictionary to rate the happiness of a piece of english text input as a single string). The happiness score is the average score over all words in the text that appear in the dictionary. For simplicity, you may neglect the words with special characters in the dictionary. Test cases: s1 = "Mary had a little lamb." 82 = "Mary had a little lamb. Mary had a little lamb!" s3 = "A quick brown fox jumps over a lazy dog." happiness (81) and happiness (82) should return 5.368; happiness (83) should return 5.275

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!