word2vec.py 文件源码

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

项目:Word2VecStackoverflow 作者: ase-sharif 项目源码 文件源码
def main(positive, negative, topn):
    """ This method train word2vec model, and return most similar tags

    Args:
        positive (list): list of positive tags
        negative (list): list of negative tags
        topn (int): number of top keywords in word2vec

    Returns:
        list: Return list of word2vec

    """
    with open('tags.txt') as f:
        content = f.readlines()
        sentences = [x.split() for x in content]

        model = Word2Vec(sentences, min_count=20)

        return model.most_similar(positive=positive, negative=negative, topn=topn)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号