glove_file.close()
embeddings = np.asarray(embd, dtype=float)
word_to_ix = {}
for word in vocab:
word_to_ix[word] = len(word_to_ix)
return word_to_ix, embeddings
After Change
logger.info("Loaded GloVe!")
embeddings = np.asarray(embd, dtype=float)
word_to_ix = {word: i for i, word in enumerate(vocab)}
return word_to_ix, embeddings