@@ -0,0 +1,1282 @@
+import gensim%0A%0A#word2vec embeddings start with a line with the number of lines (tokens?) and the number of dimensions of the file. This allows%0A#gensim to allocate memory accordingly for querying the model. Larger dimensions mean larger memory is held captive. Accordingly, this line%0A#has to be inserted into the GloVe embeddings file.%0A%0A#GloVe Model File%0A#More models can be downloaded from http://nlp.stanford.edu/projects/glove/%0Afname=%22glove.6B.50d.txt%22%0A%0A#convert Glove vectors to word2vec format%0Aword2vec_convert_file=%22word2vec_line.txt%22%0A%0A#to be a first line insert%0Anum_lines = sum(1 for line in open(fname))%0Adims=50%0A%0Aprint '%25d lines with %25d dimensions' %25(num_lines,dims)%0A%0Awith open(word2vec_convert_file,'w') as f:%0A    f.write(str(num_lines)+ %22 %22 +str(dims) + '%5Cn')%0Af.close()%0A%0Amodel_file='glove_model.txt'%0A%0Afilenames = %5Bword2vec_convert_file,fname%5D%0A%0Awith open(model_file, 'w') as outfile:%0A    for fname in filenames:%0A        with open(fname) as infile:%0A            for line in infile:%0A                outfile.write(line)%0Aoutfile.close()    %0A%0A#load converted model file                        %0Amodel=gensim.models.Word2Vec.load_word2vec_format(model_file,binary=False) #GloVe Model%0A%0Aprint model.most_similar(positive=%5B'australia'%5D, topn=10)%0Aprint model.similarity('woman', 'man')%0A

Create glove-gensim.py