Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 1. (20 points) Load the sentences of Jane Austen's Emma as lists from NLTK Gutenburg corpus. In this Assignment, for simplicity, we regard each

Question 1. (20 points)Load the sentences of Jane Austen's "Emma" as lists from NLTKGutenburgcorpus. In this Assignment, for simplicity, we regard each sentence as a "line" from the raw text. Print the first 20 sentences / lines.

Question 2. (20 points)Make a Pandas Dataframedf. It should contain two columns. One is the line number (namedline, starting from 0), the other is theword. Convert all the words in lower cases, and get rid of all punctuations. Print the first 10 rows ofdf.

Question 3. (20 points)Load the data from theNRC Emotion Lexiconinto a Pandas Dataframenrc. Make the words as index, different emotions as column names, and fill in the values correspondingly. Print the first 5 rows ofnrc.

Question 4. (20 points)Joindfandnrctogether. Sum the values of different emotions on each line, and put the result into a new Dataframenew_df. Print the first 5 rows ofnew_df.

Question 5. (20 points)Make a plot of emotions "anger", "anticipation", "disgust", "fear", "joy", "sadness", "surprise" and "trust" from the first 500 lines. Put each emotion into a differentsubplot. All the subplots should share one single x axis.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Dental Assisting

Authors: Doni Bird, Debbie Robinson

13th Edition

978-0323624855, 0323624855

Students also viewed these Programming questions