gensim logo

gensim
gensim tagline

Get Expert Help

• machine learning, NLP, data mining

• custom SW design, development, optimizations

• corporate trainings & IT consulting

scripts.glove2word2vec – Convert glove format to word2vec

scripts.glove2word2vec – Convert glove format to word2vec

USAGE:
$ python -m gensim.scripts.glove2word2vec –input <GloVe vector file> –output <Word2vec vector file>

Where:

  • <GloVe vector file>: Input GloVe .txt file.
  • <Word2vec vector file>: Desired name of output Word2vec .txt file.

This script is used to convert GloVe vectors in text format into the word2vec text format. The only difference between the two formats is an extra header line in word2vec, which contains the number of vectors and their dimensionality (two integers).

gensim.scripts.glove2word2vec.get_glove_info(glove_file_name)

Return the number of vectors and dimensions in a file in GloVe format.

gensim.scripts.glove2word2vec.glove2word2vec(glove_input_file, word2vec_output_file)

Convert glove_input_file in GloVe format into word2vec_output_file in word2vec format.