# Bag-of-words model

> The bag-of-words (BoW) model is a model of text which uses an unordered collection (a &#8220;bag&#8221;) of words. It is used in natural language processing and information retrieval (IR). It disregards word order (and thus most of syntax or grammar) but captures multiplicity. The bag-of-words model is commonly used in methods of document classification where, [&hellip;]

The **bag-of-words** (**BoW**) **model** is a model of text which uses  an unordered collection (a “bag”) of words. It is used in natural language processing and information retrieval (IR). It disregards word order (and thus most of syntax or grammar) but captures multiplicity.

The bag-of-words model is commonly used in methods of document classification where, for example, the (frequency of) occurrence of each word is used as a feature for training a classifier. It has also been used for computer vision.

An early reference to “bag of words” in a linguistic context can be found in Zellig Harris’s 1954 article on *Distributional Structure*.

## Definition

The following models a text document using bag-of-words. Here are two simple text documents:

Based on these two text documents, a list is constructed as follows for each document:

Representing each bag-of-words as a JSON object, and attributing to the respective JavaScript variable:

Each key is the word, and each value is the number of occurrences of that word in the given text document.

The order of elements is free, so, for

…

*Source: [Wikipedia](https://en.wikipedia.org/wiki/Bag-of-words_model)*

---

## Metadata

- **URL:** https://wpsearchai.com/bag-of-words-model/
- **Published:** 2026-01-28T18:47:48+00:00
- **Modified:** 2026-01-28T18:47:48+00:00
- **Author:** admin
- **Categories:** Machine learning
