(data_dir_path=None, embedding_dim=None)
return _word2em
Load the glove models (and download the glove model if they don't exist in the data_dir_path
    :param data_dir_path: the directory path on which the glove model files will be downloaded and store
    :param embedding_dim: the dimension of the word embedding, available dimensions are 50, 100, 200, 300, default is 100
    :return: the glove word embeddings
Load the glove models (and download the glove model if they don't exist in the data_dir_path
    :param data_dir_path: the directory path on which the glove model files will be downloaded and store
    :param embedding_dim: the dimension of the word embedding, available dimensions are 50, 100, 200, 300, default is 100
    :return: the glove word embeddings
Load the glove models ( and download the glove model if they don t exist in the data_dir_path : param data_dir_path : the directory path on which the glove model files will be downloaded and store : param embedding_dim : the dimension of the word embedding available dimensions are 50 100 200 300 default is 100 : return : the glove word embeddings
def load_glove(data_dir_path=None, embedding_dim=None):
    """
    Load the glove models (and download the glove model if they don't exist in the data_dir_path
    :param data_dir_path: the directory path on which the glove model files will be downloaded and store
    :param embedding_dim: the dimension of the word embedding, available dimensions are 50, 100, 200, 300, default is 100
    :return: the glove word embeddings
    """
    if embedding_dim is None:
        embedding_dim = 100

    glove_file_path = data_dir_path + "/glove.6B." + str(embedding_dim) + "d.txt"
    download_glove(data_dir_path, glove_file_path)
    _word2em = {}
    file = open(glove_file_path, mode='rt', encoding='utf8')
    for line in file:
        words = line.strip().split()
        word = words[0]
        embeds = np.array(words[1:], dtype=np.float32)
        _word2em[word] = embeds
    file.close()
    return _word2em
def load_glove ( data_dir_path = None , embedding_dim = None ) : if embedding_dim is None : embedding_dim = 100 glove_file_path = data_dir_path + "/glove.6B." + str ( embedding_dim ) + "d.txt" download_glove ( data_dir_path , glove_file_path ) _word2em = { } file = open ( glove_file_path , mode = 'rt' , encoding = 'utf8' ) for line in file : words = line . strip ( ) . split ( ) word = words [ 0 ] embeds = np . array ( words [ 1 : ] , dtype = np . float32 ) _word2em [ word ] = embeds file . close ( ) return _word2em