Beispiel #1
0
def load_w2v2(w2vdim, simple_run = True, base_path = '../data/emory_w2v/'):
    if simple_run:
        return {'a': np.array([np.float32(0.0)] * w2vdim)}

    else:
        model_path = base_path + 'w2v-%d.bin' % w2vdim
        model = Word2Vec.load_word2vec_format(model_path, binary=True)
        print("The vocabulary size is: " + str(len(model.vocab)))

        return model
Beispiel #2
0
def load_w2v(w2vdim, simple_run=True, source="twitter"):
    if simple_run:
        return {'a': np.array([np.float32(0.0)] * w2vdim)}

    else:
        if source == "twitter":
            model_path = '../data/emory_w2v/w2v-%d.bin' % w2vdim
        elif source == "amazon":
            model_path = '../data/emory_w2v/w2v-%d-%s.bin' % (w2vdim, source)

        model = Word2Vec.load_word2vec_format(model_path, binary=True)
        print("The vocabulary size is: " + str(len(model.vocab)))

        return model
Beispiel #3
0
            def load_w2v(w2vdim, simple_run=True, source="twitter"):
                if simple_run:
                    return {'a': np.array([np.float32(0.0)] * w2vdim)}

                else:
                    if source == "twitter":
                        model_path = '../data/emory_w2v/w2v-%d.bin' % w2vdim
                    elif source == "amazon":
                        model_path = '../data/emory_w2v/w2v-%d-%s.bin' % (w2vdim, source)

                    model = Word2Vec.load_word2vec_format(model_path, binary=True)
                    print("The vocabulary size is: " + str(len(model.vocab)))

                    return model
def load_w2v_withpath(model_path):
    model = Word2Vec.load_word2vec_format(model_path, binary=True)
    print("The vocabulary size is: " + str(len(model.vocab)))

    return model
def load_w2v_withpath(model_path):
    model = Word2Vec.load_word2vec_format(model_path, binary=True)
    print("The vocabulary size is: " + str(len(model.vocab)))

    return model