Skip to content

Instantly share code, notes, and snippets.

@arshjat
Created January 1, 2019 10:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arshjat/fa6eabf01ed2df6bb171ff7754b2fd48 to your computer and use it in GitHub Desktop.
Save arshjat/fa6eabf01ed2df6bb171ff7754b2fd48 to your computer and use it in GitHub Desktop.
embedding_path = "path-to-word-embedding"
embed_size = "dimension of embedding vectors"
max_features = 30000
def get_coefs(word,*arr): return word, np.asarray(arr, dtype='float32')
embedding_index = dict(get_coefs(*o.strip().split(" ")) for o in open(embedding_path))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment