Bag of Words
A way to represent text as a set of words with their frequencies, ignoring the order. "The cat ate the mouse" and "the mouse ate the cat" would give the same bag.
How It Is Built
- Collect a dictionary of all words.
- For each document, count how many times each word appears.
- Obtain a frequency vector.
Pros and Cons
- Pros: simple, fast, understandable.
- Cons: loses word order and meaning; common words like "and" dominate (they are removed as stop-words).
Further Development
TF-IDF weights frequencies by importance, while embeddings move towards meaning.