- Set up a python environment with gensim installed. More detailed instructions here. You can also follow this video tutorial about Python virtualenv.
pip install gensim
- Clone this repository or download this python script
git clone https://github.com/ml5js/training-word2vec/
- The script in its current form only supports training from a single text file. Copy your text file into this directory and run
train.py
with the name of the file.
python train.py data.txt
- The script will save a file called
vectors.json
. You can then use this file the ml5.js word2vec examples.