Create a new corpus!

Report a typo

Let's try to create our own NLTK corpus. The .txt file you will be given contains words with a positive meaning. Such lists are useful when we want to determine the sentiment of a text. Pass the file to PlaintextCorpusReader of NLTK. Then, use a corpus method to divide the corpus into words. Finally, print out all its elements in the range 20-29 inclusively.

Input data format

A .txt file containing words with a positive meaning.

Output data format

The output of your program — a list of 10 words.

When you slice a list, you can specify the needed range as follows:
sequence[start:stop]  # slice a sequence from start to stop-1

Write code in your IDE to process the text file and display the results below
___

Create a free account to access the full topic