This short tutorial will concentrate on how-to get vector representation of word from pre-trained word2vec (published by Tomas Mikolov).
Following these steps below:
- Assume your OS had Python environment. We recommend to install Anaconda for working with Python.
- Open Terminal and install GenSim by typing
pip install --upgrade gensim.
- Download pre-trained word2vec at here.
- Now, create a blank Python source code file, for example, test.py, as below. Then, in Terminal, compile and run it by typing
model = gensim.models.KeyedVectors.load_word2vec_format('\word2vec\GoogleNews-vectors-negative300.bin', binary=True)
If anything is fine, your Terminal may look like this. The output is a 300-dimension vector.
The sample program is available at here.