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: 5

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: tensorflow/models
Commit Name: c987d27ce7922d08f5d50bf0280b102548fac2a0
Time: 2020-08-15
Author: kaushikshiv@google.com
File Name: research/object_detection/dataset_tools/create_ava_actions_tf_record.py
Class Name: Ava
Method Name: get_label_map