Complete the code to import the Naive Bayes classifier from scikit-learn.
from sklearn.naive_bayes import [1]
The MultinomialNB class is the Naive Bayes classifier used for text classification tasks.
Complete the code to convert text data into numerical features using CountVectorizer.
from sklearn.feature_extraction.text import [1] vectorizer = [2]()
CountVectorizer converts text documents into a matrix of token counts, which is needed before applying Naive Bayes.
Fix the error in the code to train the Naive Bayes model on vectorized text data.
model = MultinomialNB()
X_train_counts = vectorizer.fit_transform(texts)
model.[1](X_train_counts, labels)The fit method trains the model using the feature matrix and labels.
Fill both blanks to predict labels for new text data and convert them to a list.
X_new_counts = vectorizer.[1](new_texts) predicted = model.[2](X_new_counts).tolist()
Use transform to convert new texts to features, then predict to get labels.
Fill all three blanks to create a dictionary of word counts for words longer than 3 characters.
word_counts = {word: [1] for word in text.split() if len(word) [2] 3 and word.isalpha() and word not in stopwords}
filtered_counts = {k: v for k, v in word_counts.items() if v [3] 1}The dictionary counts each word's occurrences with text.count(word). We keep words longer than 3 characters (> 3) and filter counts greater or equal to 1 (>= 1).