Represent a document with three counts
Preserve the order of coordinates and the signs of values. · 169 words
An AI text tool often ignores word order and records how often selected words appear. This is called a bag-of-words representation. Choose three words: museum, guide, and ticket. If a short document says "museum guide museum ticket guide", its count vector is (3, 2, 1). Each coordinate matches one chosen word: 3 museum words, 2 guide words, and 1 ticket word. The order of the words is not stored, so the representation is simple to compute, although it loses grammar and context.
Suppose a second document says "ticket guide and guide". Its count vector is (0, 2, 1), using the same word order. When several documents use the same words, their vectors can be stacked as rows in a count matrix. A search system might give the words weights (2, 3, 1). The first document then receives 2(3) + 3(2) + 1(1) = 13, while the second receives 2(0) + 3(2) + 1(1) = 7. The higher score means the first document matches more strongly under those chosen weights.
Check your recall
What count vector represents the document "museum guide museum ticket guide" for the words museum, guide, and ticket?
Check your answer
The vector is (3, 2, 1): museum appears 3 times, guide appears 2 times, and ticket appears 1 time.
Sources and credits
Original KeyTouch lesson. Background reading · Zhang et al. · Linear Algebra.