Junior — Middle
Tell us about bag-of-words and its limitations.
sobes.tech AI
Answer from AI
Bag-of-Words (BoW) is a simple method of representing text as a set of words without considering the order and grammatical structure. The text is broken down into words (tokens), and a vector is created where each element reflects the count or presence of a specific word in the document.
Limitations of BoW:
- Loss of word order. Context and meaning dependent on word order are not considered.
- Ignoring semantics. Words with different meanings but similar forms are treated the same.
- High dimensionality. For large vocabularies, vectors become sparse and bulky.
- Sensitivity to noise. Frequently occurring but uninformative words (stop-words) can influence the model.
Example of BoW for the sentence "Кошка сидит на ковре":
| word | count |
|---|---|
| Кошка | 1 |
| сидит | 1 |
| на | 1 |
| ковре | 1 |