Skip to content
Free public beta until December 4, 2026: every course is open, no card needed. After that, the first chapter of each course stays free and full access is a one-time $39 ($19 for up to 100 founding members chosen for helpful feedback). Your progress is kept. How the beta works

bag-of-words

A sparse vector of raw word counts over a fixed vocabulary, with word order thrown away entirely.

A bag-of-words representation counts how many times each vocabulary word appears in a document and stores those counts as a vector, one dimension per vocabulary word. It discards word order completely -- "dog bites man" and "man bites dog" produce the identical vector -- which is exactly what limits how much meaning a bag-of-words representation can capture.

Examples

  • The sentences "the dog bit the man" and "the man bit the dog" produce the identical bag-of-words vector: {the: 2, dog: 1, bit: 1, man: 1}.

See also

Read the full section →
Graph settings

Calculator