CourseNatural Language Processing: The Complete Course · Module 6: Word and Sentence Embeddings · part 40 of 73
Part 40 · Module 6: Word and Sentence Embeddings

Lesson 1: Words as vectors: teaching word2vec what "battery" means

22 min read·14 Oct 2026
Module 6 · Lesson 1 · About 45 minutes · Needs: basic Python; Module 4 Lesson 2 (TF-IDF and cosine similarity) helps but is not required

The situation

It is Monday 12 October 2026, project week 6. Rosa wants a help-centre search for Ines: she types a few words and the right article comes up while she replies.

Ines tries the word-count search from Module 4 with the query "battery". "the charger on my volt is flimsy" scores 0: it shares no word with the query. To word counts, "battery" and "charger" are as unrelated as "battery" and "chain". This lesson gives each word a short list of numbers, learned from text, so that related words end up close.

INES SEARCHES THE WORD COUNTS FOR "BATTERY" battery query the charger on my volt is flimsy no word in common word-count score 0: battery as far from charger as from chain
A word-count search scores a sentence about the charger 0 for the query "battery" (blue: the query; amber: text; red: the failure), because the two share no word.

The rest of this part opens with an account

Signing up is free and takes one email. Nothing to pay, and nothing renews.