A very simple implementation of Bag-of-Words for those learning about Natural Language Processing.
About BoW
BoW is a simple count algorithm used in old spam email detection and search engine.
Essentially, we can train a model to remember a set of words we call ordered vocabulary to later count each words from a paragraph or sentence.
The resulting "prediction" is a vector of ordered counts of those words and their position doesn't matter.
This is quite good for simple detection, like spam emails which contains a lot of "quick", "win", or "prizes" word.
However, when it comes to positional meaning BoW performs very poorly. It's like instructing a gold fish to climb a coconut tree.