preprocessing/embeddings.py
def load_embeddings_binary(embeddings_path):
    """
    It loads embedding provided by glove which is saved as binary file. Loading of this model is
    about  second faster than that of loading of txt glove file as model.
    :param embeddings_path: path of glove file.
    :return: glove model
    """
    with codecs.open(embeddings_path + '.vocab', 'r', 'utf-8') as f_in:
        index2word = [line.strip() for line in f_in]
    wv = np.load(embeddings_path + '.npy')
    model = {}
    for i, w in enumerate(index2word):
        model[w] = wv[i]
    return model

    It loads embedding provided by glove which is saved as binary file. Loading of this model is
    about  second faster than that of loading of txt glove file as model.
    :param embeddings_path: path of glove file.
    :return: glove model
    
It loads embedding provided by glove which is saved as binary file. Loading of this model is
about  second faster than that of loading of txt glove file as model.
It loads embedding provided by glove which is saved as binary file . Loading of this model is about second faster than that of loading of txt glove file as model .
def load_embeddings_binary(embeddings_path):
    with codecs.open(embeddings_path + '.vocab', 'r', 'utf-8') as f_in:
        index2word = [line.strip() for line in f_in]
    wv = np.load(embeddings_path + '.npy')
    model = {}
    for i, w in enumerate(index2word):
        model[w] = wv[i]
    return model
def load_embeddings_binary ( embeddings_path ) : with codecs . open ( embeddings_path + '.vocab' , 'r' , 'utf-8' ) as f_in : index2word = [ line . strip ( ) for line in f_in ] wv = np . load ( embeddings_path + '.npy' ) model = { } for i , w in enumerate ( index2word ) : model [ w ] = wv [ i ] return model
It loads embedding provided by glove which is saved as binary file.
It loads embedding provided by glove which is saved as binary file .
"""
    It loads embedding provided by glove which is saved as binary file. Loading of this model is
    about  second faster than that of loading of txt glove file as model.
    :param embeddings_path: path of glove file.
    :return: glove model
    """
None
embeddings_path
path of glove file.
path of glove file .