Advertisement
chino

[w2v] convert text to binary, binary to text

Nov 23rd, 2017
392
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.41 KB | None | 0 0
  1. from gensim.models.keyedvectors import KeyedVectors
  2.  
  3. # Convert binary file to text file
  4. w2v_model = KeyedVectors.load_word2vec_format('Path to bin file', binary=True)
  5. w2v_model.save_word2vec_format('Path to output', binary=False)
  6.  
  7. # Convert text file to binary file
  8. w2v_model = KeyedVectors.load_word2vec_format('Path to text file', binary=False)
  9. w2v_model.save_word2vec_format('Path to output', binary=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement