Skip to content

Instantly share code, notes, and snippets.

@MLWhiz
Last active January 18, 2019 05:53
Show Gist options
  • Select an option

  • Save MLWhiz/3374d8cd11443b1a2de72207a66eaa5b to your computer and use it in GitHub Desktop.

Select an option

Save MLWhiz/3374d8cd11443b1a2de72207a66eaa5b to your computer and use it in GitHub Desktop.
def load_glove_index():
EMBEDDING_FILE = '../input/embeddings/glove.840B.300d/glove.840B.300d.txt'
def get_coefs(word,*arr): return word, np.asarray(arr, dtype='float32')[:300]
embeddings_index = dict(get_coefs(*o.split(" ")) for o in open(EMBEDDING_FILE))
return embeddings_index
glove_embedding_index = load_glove_index()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment