4d8cca40654deb641809bf8fb376afd9b1633d52,nlp_architect/data/cdc_resources/gen_scripts/create_word_embed_glove_dump.py,,load_glove_for_vocab,#Any#Any#,39
Before Change
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
def glove_dump():
After Change
def load_glove_for_vocab(glove_filename, vocabulary):
vocab = []
embd = []
with open(glove_filename) as glove_file:
for line in glove_file:
row = line.strip().split(" ")
word = row[0]
if word in vocabulary:
vocab.append(word)
embd.append(row[1:])
logger.info("Loaded GloVe!")
embeddings = np.asarray(embd, dtype=float)
word_to_ix = {word: i for i, word in enumerate(vocab)}
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 3
Instances
Project Name: NervanaSystems/nlp-architect
Commit Name: 4d8cca40654deb641809bf8fb376afd9b1633d52
Time: 2019-03-31
Author: daniel.korat@intel.com
File Name: nlp_architect/data/cdc_resources/gen_scripts/create_word_embed_glove_dump.py
Class Name:
Method Name: load_glove_for_vocab
Project Name: deepmipt/DeepPavlov
Commit Name: e13971dfe6073837e385d377c1cf84aaf35863ab
Time: 2018-07-03
Author: yoptar@gmail.com
File Name: utils/prepare/registry.py
Class Name:
Method Name:
Project Name: deepmipt/DeepPavlov
Commit Name: e258ef3ea167b86d6680bfcc513dd207586b90f4
Time: 2018-07-03
Author: yoptar@gmail.com
File Name: setup.py
Class Name:
Method Name: read_requirements