def get_glove_matrix(glove_map, vocab):
    matrix_len = len(vocab)
    emb_dim = len(list(glove_map.values())[0])
    weights_matrix = np.zeros((matrix_len, emb_dim))
    for (i, word) in enumerate(vocab):
        try:
            weights_matrix[i] = glove_map[word]
        except KeyError:
            if (word in [PAD_TOKEN, START_TOKEN, STOP_TOKEN]):
                weights_matrix[i] = np.zeros((emb_dim,))
            else:
                weights_matrix[i] = np.random.normal(scale=0.6, size=(emb_dim,))
    return weights_matrix
def get_glove_matrix(glove_map, vocab):
    matrix_len = len(vocab)
    emb_dim = len(list(glove_map.values())[0])
    weights_matrix = np.zeros((matrix_len, emb_dim))
    for (i, word) in enumerate(vocab):
        try:
            weights_matrix[i] = glove_map[word]
        except KeyError:
            if (word in [PAD_TOKEN, START_TOKEN, STOP_TOKEN]):
                weights_matrix[i] = np.zeros((emb_dim,))
            else:
                weights_matrix[i] = np.random.normal(scale=0.6, size=(emb_dim,))
    return weights_matrix