Skip to content
ml-recall

#stop-words

2 questions from NLP Fundamentals, Text Representation & Embeddings

Timed test

2 questions · 2 min · score and explanations at the end

Take a test
Q 1 / 2Score 0 / 0

Question 1: Short answer

mediumAI-checkedNLP Fundamentals
import numpy as np
from sklearn.feature_extraction.text import CountVectorizer

docs = ["The food was not good", "The food was good"]
X = CountVectorizer(stop_words="english").fit_transform(docs).toarray()
print(X[0] @ X[1] / (np.linalg.norm(X[0]) * np.linalg.norm(X[1])))

scikit-learn's built-in English stop list contains "the", "was" and "not". What cosine similarity does the code print (to 2 decimals)?

a number between 0 and 1