A bag-of-words model encodes text as a multiset, mapping a word to its number of occurrences in the text.