Complete the code to remove stopwords from the list of words.
filtered_words = [word for word in words if word not in [1]]
The variable stopwords contains common words to remove. We keep words not in stopwords.
Complete the code to import the stopwords list from NLTK.
from nltk.corpus import [1]
We import stopwords from nltk.corpus to access common stopwords.
Fix the error in the code to get English stopwords from NLTK.
stop_words = set(stopwords.words([1]))The correct language code for English stopwords in NLTK is 'english' all lowercase.
Fill both blanks to create a list of words without stopwords from a sentence.
filtered = [[1] for [2] in sentence.split() if [1] not in stop_words]
We iterate over each word in the sentence split by spaces, and keep words not in stop_words.
Fill all three blanks to create a dictionary of word counts excluding stopwords.
word_counts = [1](word for word in words if word not in [2]) filtered_counts = {word: count for word, count in word_counts.[3]()}
We use Counter to count words excluding stop_words. Then we create a dictionary from word_counts.items().