4d8cca40654deb641809bf8fb376afd9b1633d52,nlp_architect/data/cdc_resources/gen_scripts/create_word_embed_glove_dump.py,,load_glove_for_vocab,#Any#Any#,39

Before Change


def load_glove_for_vocab(glove_filename, vocabulary):
    vocab = []
    embd = []
    glove_file = open(glove_filename, "r")
    for line in glove_file.readlines():
        row = line.strip().split(" ")
        word = row[0]
        if word in vocabulary:

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


def glove_dump():
Italian Trulli
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: rkcosmos/deepcut
Commit Name: 0347e36737b25671dff14c6c1bbbe5d090d71a06
Time: 2017-06-28
Author: titipata@allenai.org
File Name: deepcut/deepcut.py
Class Name:
Method Name:


Project Name: sentinel-hub/eo-learn
Commit Name: 6b1035d56eca9b7af4abe1a81565667b0bf2fb47
Time: 2020-09-23
Author: william.ouellette@gmail.com
File Name: io/eolearn/io/local_io.py
Class Name: ExportToTiff
Method Name: execute