def w2v_pymagnitude(train_text, model, name):
    train_corpus = [text_to_word_sequence(text) for text in train_text]
    result = []
    for text in train_corpus:
        vec = np.zeros(model.dim)
        for (n_w, word) in enumerate(text):
            if (word in model):
                vec = (vec + model.query(word))
                continue
            word_ = word.upper()
            if (word_ in model):
                vec = (vec + model.query(word_))
                continue
            word_ = word.capitalize()
            if (word_ in model):
                vec = (vec + model.query(word_))
                continue
            word_ = ps.stem(word)
            if (word_ in model):
                vec = (vec + model.query(word_))
                continue
            word_ = lc.stem(word)
            if (word_ in model):
                vec = (vec + model.query(word_))
                continue
            word_ = sb.stem(word)
            if (word_ in model):
                vec = (vec + model.query(word_))
                continue
            vec = (vec + model.query(word))
        vec = (vec / (n_w + 1))
        result.append(vec)
    w2v_cols = ['{}{}'.format(name, i) for i in range(1, (model.dim + 1))]
    result = pd.DataFrame(result)
    result.columns = w2v_cols
    return result
def w2v_pymagnitude(train_text, model, name):
    train_corpus = [text_to_word_sequence(text) for text in train_text]
    result = []
    for text in train_corpus:
        vec = np.zeros(model.dim)
        for (n_w, word) in enumerate(text):
            if (word in model):
                vec = (vec + model.query(word))
                continue
            word_ = word.upper()
            if (word_ in model):
                vec = (vec + model.query(word_))
                continue
            word_ = word.capitalize()
            if (word_ in model):
                vec = (vec + model.query(word_))
                continue
            word_ = ps.stem(word)
            if (word_ in model):
                vec = (vec + model.query(word_))
                continue
            word_ = lc.stem(word)
            if (word_ in model):
                vec = (vec + model.query(word_))
                continue
            word_ = sb.stem(word)
            if (word_ in model):
                vec = (vec + model.query(word_))
                continue
            vec = (vec + model.query(word))
        vec = (vec / (n_w + 1))
        result.append(vec)
    w2v_cols = ['{}{}'.format(name, i) for i in range(1, (model.dim + 1))]
    result = pd.DataFrame(result)
    result.columns = w2v_cols
    return result