Bag of words

The bag of words represents a document by the number of occurrences of each vocabulary word, without regard to order. It produces large sparse vectors that are simple to compute and effective for text classification, but ignore syntax and the meaning of words.

Example

CountVectorizer().fit_transform(['un chat noir', 'un chien'])

Related concepts

The whole glossary