AI Terms Dictionary

A comprehensive multilingual AI terminology dictionary

Definition

This natural language processing technique represents text as a multiset of words, disregarding syntax and sequence. It converts documents into numerical vectors based on word frequency or presence. While it loses contextual information like word order, it remains computationally efficient and effective for tasks such as text classification, spam detection, and topic modeling. It serves as a foundational feature extraction method before more advanced embeddings like Word2Vec became prevalent.

Summary

The bag-of-words model is a simplifying representation of text that describes document occurrence of words, ignoring grammar and word order.

Key Concepts

Use Cases

Code Example

1
2
3
4
from sklearn.feature_extraction.text import CountVectorizer
corpus = ["Hello world", "World hello"]
vectorizer = CountVectorizer()
X = vectorizer.fit_transform(corpus)