lda_model.py 文件源码

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

项目:LDA-REST 作者: valentinarho 项目源码 文件源码
def label_topic_by_probability(cls, topic_description, min_word_probability=0.010, max_words=6):
        """
        Try to disambiguate a topic considering all words with a weight greater than min_word_probability
        :param max_words:
        :param topic_description: is a list of pairs  (word, word_probability)
        :param min_word_probability: is the minimum probability for words
        :return: list of strings, possible wikipedia pages
        """
        words = [w for w, p in topic_description if p >= min_word_probability]
        words = words[:max_words]

        if len(words) == 0:
            # if no words are over the threshold return empty
            res = []
        else:
            res = wikipedia.search(' '.join(words))

        return res
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号