Here, we are going to train our word2vec model. The dataset that I'm going to use is text data of Game of Thrones. So, our formal goal is to develop word2vec to explore semantic similarities between the entities of A Song of Ice and Fire (from the show Game of Thrones). The good part is we are also doing visualization on top of that, to get a better understanding of the concept practically. The original code credit goes to Yuriy Guts. I have just created a code wrapper for better understanding.
Developing something interesting
I have used IPython notebook. Basic dependencies are gensim, scikit-learn, and nltk to train the word2vec model on the text data of Game of Thrones. You can find the code on this GitHub link:
https://github.com/jalajthanaki/NLPython/blob/master/ch6/gameofthrones2vec/gameofthrones2vec.ipynb. ...
Get Python Natural Language Processing now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.