Question: I need help to write the python code for the following three tasks, see what I have attempted in the image below. When you look

I need help to write the python code for the following three tasks, see what I have attempted in the image below.

When you look at the stemmed object above, you can see the results of using PorterStemmer. But what did this do to our top words?

1. Write code to count the words and show the top 20 used.

2. Produce a new horizontal bar graph with this new set of words.

3. Explain what stemming did to our set of words.

No additional files are attached.

I need help to write the python code for the following three

Stemming - getting to the root word Stemming will take words such as enjoyed and enjoying to the root form of enjoy. A disadvantage of stemming is that it may stem a word to a nonsensical word, such as location to locat. Reference: Stemming vs Lemmatization In [82] \# create a List of words to_stem = list(itertools.chain(*my_final)) \# stemming section from nltk.stem.porter import Porterstemmer porter = Porterstemmer() stemmed = [porter.stem(word) for word in to_stem] print(stemmed[:50]) ['enjoy', 'best', 'western', 'pioneer', 'squar', 'husband', 'room', 'king', 'bed', 'clean', 'quiet', 'attract', 'son', 'roo m", 'twin", 'bed', "room', 'corner', "main', "street', "said', 'littl', "noisier", 'neon', 'light', 'shone', 'later', 'hote 1', 'trip', 'made', 'appreci', 'one', 'love', 'old', "wood', 'center', "staircas", 'breakfast', 'includ', 'everyon', 'happ i', 'waffl', 'toast', 'cereal', 'egg', 'meal', 'locat', 'great', 'could', 'walk'] Problem 8 ( 6 pts.): When you look at the stemmed object above, you can see the results of using PorterStemmer. But what did this do to our top words? 1. Write code to count the words and show the top 20 used. 2. Produce a new horizontal bar graph with this new set of words. 3. Explain what stemming did to our set of words

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!