Importing the necessary libraries
Before we begin, we require the following libraries and dependencies, which need to be imported into our Python environment. These libraries will make our tasks a lot easier, as they have readily available functions and models that can be used instead of doing that ourselves. This also makes the code more compact and readable.
Getting ready
The following libraries and dependencies will be required to create word vectors and plots and visualize the n-dimensional word vectors in a 2D space:
future
codecs
glob
multiprocessing
os
pprint
re
nltk
Word2Vec
sklearn
numpy
matplotlib
pandas
seaborn
How to do it...
The steps are as follows:
- Type the following commands into your Jupyter notebook to import all the required libraries:
from __future__ import absolute_import, division, print_function import codecs import glob import logging import multiprocessing import os import pprint import re import nltk import gensim.models.word2vec as w2v import sklearn.manifold import numpy as np import...