如何在PyCharm中打印LDA主题输出
如何在PyCharm中打印LDA主题输出
您可能遇到过在使用pos_lda.print_topics(num_words = 10)和neg_lda.print_topics(num_words = 10)时无法在PyCharm中打印输出内容的问题。为了解决这个问题,您需要在代码中添加以下内容:
from pprint import pprint
pprint(pos_lda.print_topics(num_words=10))
pprint(neg_lda.print_topics(num_words=10))
这段代码使用了pprint函数来打印主题。pprint函数将使输出更易于阅读。您也可以使用普通的print语句来打印,但是pprint函数会让输出更加美观。
确保您已经正确导入了pprint函数。
原文地址: https://www.cveoy.top/t/topic/oRjm 著作权归作者所有。请勿转载和采集!