human
An alternate from gensim tutorials - just use all words in the model in a rewiew. No nltk used to split."""

import re

class YelpReviews(object):
    """Iterate over sentences of all plaintext files in a directory """
    SPLIT_SENTENCES = re.compile(u"[.!?:]\s+")  # split sentences on these characters

    def __init__(self, objs, field):
        self.field = field
        self.objs = objs

    def __iter__(self):
        for obj in self.objs:
            text = obj[self.field]
            for sentence in self.SPLIT_SENTENCES.split(text):
                yield gensim.utils.simple_preprocess(sentence, deacc=True)

## Don't do this is you already have the model file! Skip to the step after.
## Otherwise, feel free to do it from scratch.
## We pass in the full data objs and use the YelpReviews class to get the 'text' field for us.

#model = gensim.models.Word2Vec(YelpReviews(data, 'text'), min_count=2, workers=2)

#model.save('yelp_w2v_model.mod')

#model.save_word2vec_format('yelp_w2vformat.mod')

# If you already have a model file, load it here:

model = gensim.models.Word2Vec.load_word2vec_format('../data/yelp/yelp_w2vformat.mod')

model.most_similar(positive=["chicken", "waffles"], topn=20)

model.most_similar("waitress")

model.vocab.items()[0:5]

model.most_similar(['good', 'pizza'])

model.most_similar_cosmul(['good', 'pizza']) # less susceptible to extreme outliers

model.most_similar(['dog'])

model.most_similar(['salon'])

model.most_similar(positive=['donuts', 'nypd'], negative=['fireman'])
Given the above code, generate some markdown instructions for it.
assistant
#Here is code to An alternate from gensim tutorials - just use all words in the model in a rewiew.

What is Word2Vec?
"Generally, word2vec is trained using something called a skip-gram model. The skip-gram model, pictures above, attempts to use the vector representation that it learns to predict the words that appear around a given word in the corpus. Essentially, it uses the context of the word as it is used in a variety of books and other literature to derive a meaningful set of numbers. If the “context” of two words is similar, they will have similar vector representations." (Source)
"In word2vec, a distributed representation of a word is used. Take a vector with several hundred dimensions (say 1000). Each word is representated by a distribution of weights across those elements. So instead of a one-to-one mapping between an element in the vector and a word, the representation of a word is spread across all of the elements in the vector, and each element in the vector contributes to the definition of many words.
If I label the dimensions in a hypothetical word vector (there are no such pre-assigned labels in the algorithm of course), it might look a bit like this:"
<img src="img/word2vec-distributed-representation.png">
Source
So that means we can do associative logic, or analogies, with these models:
<img src="img/word2vec-king-queen-vectors.png">
Specifically, a large enough model of the right kind of language (like a lot of news, or lots of books) will allow you to get "queen" from putting in man, king, woman... and doing vector math on them.  So, king-man+woman=queen. 
Source
<img src="img/word2vec-king-queen-composition.png">
Source
Creating a word2vec Model with Gensim
This takes a while.  You don't need to do this, since I already did it.  You can skip down to the place where we load the file!