In the previous recipe, we built a word vector. In this recipe, we'll build skip-gram and CBOW models using the gensim library.
Building a word vector using the skip-gram and CBOW models
Getting ready
The method that we have adopted to build a word vector in this recipe is called a continuous bag of words (CBOW) model. The reason it is called as CBOW is explained as follows:
Let's use this sentence as an example: I enjoy playing TT.
Here's how the CBOW model handles this sentence:
- Fix a window of certain size—let's say 1.
- By specifying the window size, we are specifying the number of words that will be considered to the right as well as to the left of the given word.
- Given the window size, the...