Sahaj.blogs

Day page

20 May 2025

Study

NLP · Bag of words and TF-IDF

Turning documents into vectors with CountVectorizer and TfidfVectorizer, n-grams, and finding similar documents with cosine similarity.

  • Bag of words counts tokens and ignores order; TF-IDF down-weights words that appear in many documents.
  • Cosine similarity between TF-IDF vectors is a strong, cheap baseline for document search.

Read the post →