Created
January 1, 2019 10:42
-
-
Save arshjat/14344f0753a410262e4fedccfbab8ce4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
word_index = tk.word_index | |
nb_words = min(max_features, len(word_index)) | |
embedding_matrix = np.zeros((nb_words + 1, embed_size)) | |
for word, i in word_index.items(): | |
if i >= max_features: continue | |
embedding_vector = embedding_index.get(word) | |
if embedding_vector is not None: embedding_matrix[i] = embedding_vector |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment