Skip to content
ML to LLMs
Learning path

Module 9

Classical NLP

Turn text into numbers with tokenization, bag-of-words, n-grams, TF-IDF, and word embeddings, then extract entities and discover topics.

  1. 1. From text to vectorsTokenize and normalize text, build bag-of-words and n-gram features, compute TF-IDF and cosine similarity by hand, and train a strong classical text baseline.40 min
  2. 2. Word embeddingsRepresent words as dense vectors learned from context, understand Word2Vec's skip-gram and CBOW objectives, and see why contextual embeddings replaced static ones.35 min
  3. 3. Named entity recognitionTurn entity extraction into per-token BIO labels, decode valid tag sequences with Viterbi, and evaluate with entity-level F1 instead of token accuracy.40 min
  4. 4. Topic modelingDiscover the themes in an unlabeled corpus with LDA (documents as mixtures of topics, topics as distributions over words), implement collapsed Gibbs sampling, and choose between LDA, NMF, and embedding-based BERTopic.40 min

Models need numbers. This module turns text into vectors two ways: sparse counts weighted by rarity (bag-of-words, TF-IDF), which are fast, cheap, and an excellent baseline, and dense embeddings, which place related words near each other.

#LessonYou will be able to
1From text to vectorstokenize, build a document-term matrix, and compute TF-IDF and cosine similarity by hand
2Word embeddingsexplain Word2Vec's skip-gram and CBOW objectives and the difference between static and contextual embeddings
3Named entity recognitiontag entities with BIO labels, decode valid sequences with Viterbi, and score with entity-level F1
4Topic modelingimplement collapsed Gibbs LDA, choose the number of topics, and pick between LDA, NMF, and BERTopic

Interactive lab: TF-IDF calculator

Next moduleModule 10: Neural-network foundations