Bag of Words
A bag of words is a particular representation model used to simplify the contents of a selection of text. The bag of words model omits grammar and word order but is interested in the number of occurrences of words within the text.
Example: –
"John likes to watch movies. Mary likes movies too"
The resulting bag of words representation as a dictionary:
{
'John': 1,
'likes':2,
'to':1
'watch': 1,
'movies': 2,
'Mary': 1,
'too': 1
}