lda_model.py 文件源码

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

项目:LDA-REST 作者: valentinarho 项目源码 文件源码
def label_topic_by_number_of_words(cls, topic_description, n_words=5):
        """
        Try to disambiguate a topic considering top k words in its description
        :param n_words:
        :param topic_description: is a list of pairs  (word, word_probability)
        :return: list of strings, possible wikipedia pages
        """
        words = [t[0] for i, t in enumerate(topic_description) if i < n_words]

        if len(words) == 0:
            # if no words are over the threshold, take the first
            words = [topic_description[0][0]]

        res = wikipedia.search(' '.join(words))
        return res
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号