Skip to content

Instantly share code, notes, and snippets.

@aneesha
Created November 28, 2017 09:25
Show Gist options
  • Save aneesha/842f047a77f55992bae362b39520fc42 to your computer and use it in GitHub Desktop.
Save aneesha/842f047a77f55992bae362b39520fc42 to your computer and use it in GitHub Desktop.
# git clone https://github.com/mfaruqui/retrofitting.git
# Run retrofit.py with arguments to set the word vectors file, the lexicon file, the number of iterations
# and the output word vectors. The word vectors must be in text format
# Eg:
# python retrofit.py -i word_vec_file -l lexicon_file -n num_iter -o out_vec_file
# python retrofit.py -i /data/glove.6B.50d.txt -l /retrofitting/lexicons/ppdb-xl.txt -n 10 -o retrofittedglove.txt
# Convert txt based GLOVE word vectors to Word2Vec format
from gensim.scripts.glove2word2vec import glove2word2vec
glove2word2vec(glove_input_file="/data/glove.6B.50d.txt", word2vec_output_file="glove.6B.50d.word2vec.txt")
glove2word2vec(glove_input_file="/data/retrofittedglove.txt", word2vec_output_file="retrofittedglove.word2vec.txt")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment