Features5.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:kaggle 作者: rbauld 项目源码 文件源码
def sent2vec(s):
    words = str(s).lower()
    words = word_tokenize(words)
    words = [w for w in words if not w in stop_words]
    words = [w for w in words if w.isalpha()]
    M = []
    for w in words:
        try:
            M.append(model[w])
        except:
            continue
    M = np.array(M)
    v = M.sum(axis=0)
    return v / np.sqrt((v ** 2).sum())

###############################################################################
# Train
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号