Word2vec is a group of related models that are used to produce word embeddings. These models are shallow, two-layer neural networks that are trained to reconstruct linguistic contexts of words. Word2vec takes as its input a large corpus of text and produces a vector space, typically of several hundred dimensions, with each unique word in the corpus being assigned a corresponding vector in the space. Word vectors are positioned in the vector space such that words that share common contexts in the corpus are located close to one another in the space
This is an implementation of word2vect, although we can use packages to execute and get the result, how these algorithim work inside is also important, in this code we can chose to use CBOW model or Skip-Gram model by set the parameter and to use Negative Sampling or Hierarchical Softmax by setting the parameter too,which is convenient.