A binary vector represents a sentence or document as slots containing 0 or 1: each slot records whether a vocabulary item is absent or present. The result preserves word membership but discards sequence and much of the original meaning. Most slots are usually zero, even for large documents. section 2.5.3 section 1.5.3
Use binary vectors as a practical bag-of-words representation:
- Assign each possible word to a vocabulary slot. section 1.5.3
- Store 1 when a word appears in a document and 0 otherwise. section 2.5.3
- Prefer a sparse array or dictionary-like structure for large vocabularies; inspect an individual vector with a pandas Series and combine documents in a DataFrame. section 2.5.3
- Place the representation after tokenization, optionally filtering stop words and rare words. section 1.5.3
A token-sorting view
Imagine a coin sorter with one bin for every vocabulary word. Feeding it “Guten Morgen Rosa” fills the Guten, Morgen, and Rosa bins, producing a vector with 1s in those positions and 0s elsewhere. This makes documents searchable and mathematically comparable, but the vector no longer records the words’ order. section 1.5.3
