Advertisement

Bag of Words (BoW)

What Does Bag of Words (BoW) Mean?

Bag of Words (BoW) is a natural language processing (NLP) strategy for converting a text document into numbers that can be used by a computer program. BoW is often implemented as a Python dictionary. Each key in the dictionary is set to a word, and each value is set to the number of times the word appears.

The BoW model is one of the most useful ways to convert text data for use by machine learning algorithms. In this context, text words are referred to as tokens and the entire process of representing a sentence as a bag of words vector (a string of numbers) is known as tokenization.

Advertisement

Techopedia Explains Bag of Words (BoW)

BoW models are concerned with whether a known word occurs in a document and how many times it occurs -- not the order it appears, nor its context. BoW plays an important role in natural language processing, information retrieval from documents and document classification.

How Bag of Words Works

BoW is used to extract feature sets from text during the data pre-processing phase. The strategy involves breaking a document down it into list of disparate words and noting how many times each word was used in the document.

The name ‘Bag of Words’ is thought to have been inspired by the popular word game, Scrabble. The value of each tile in a Scrabble bag was determined by how frequently a specific letter appeared on the front page of the New York Times in 1938.

Advertisement

Share this Term

  • Facebook
  • LinkedIn
  • Twitter

Related Reading

Tags

Artificial Intelligence AnalyticsMachine LearningData Science

Trending Articles

Go back to top