简体   繁体   English

如何获取pyLDAvis中每个主题的单词列表

[英]How to get list of words for each topic in pyLDAvis

I am new to using pyLDAvis. 我是使用pyLDAvis的新手。 I have been looking through the documentation but cannot seem to find a way to get the set of words for each topic of my model. 我一直在浏览文档,但似乎无法找到一种方法来获取模型中每个主题的词汇。 I have 20 topics and I would like to get the top 20 or so words for each topic. 我有20个主题,并且每个主题我都希望获得前20个左右的词。 Does anyone have a way of getting this data? 有人有办法获取这些数据吗?

The pyldavis.prepare() method produces a PreparedData object with attributes like .topic_info that returns a DataFrame with the words, logprob etc (see docs ) pyldavis.prepare()方法生成具有诸如.topic_info属性的PreparedData对象,该对象返回带有单词, logprob等的logprob (请参阅docs

from pyLDAvis.gensim import prepare
vis = prepare(lda_model, corpus, dictionary, mds='tsne')
vis.topic_info

     Category         Freq       Term        Total  loglift  logprob
term                                                                
2299  Default 2,068,609.00      order 2,068,609.00    30.00    30.00
1037  Default   816,951.00      drink   816,951.00    29.00    29.00
2778  Default   565,075.00     review   565,075.00    28.00    28.00

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何获取pyLDAvis中特定相关度量值(lambda)的每个主题的单词列表? - How to get list of words for each topic for a specific relevance metric value (lambda) in pyLDAvis? 如何快速从列表中获取唯一的单词? - How to get unique words from a list quickly? 如何获取每个评论中每个主题的情绪(pos/neg/neu)? 从 LDA 获得主题后? - How to get sentiment (pos/neg/neu) for each topic in each review? after getting topics from LDA? 如何仅在gensim中访问主题词 - How to access topic words only in gensim 算法从句子中的单词中获取句子的主题/焦点 - algorithm to get topic / focus of sentence out of words in sentence 如何从匹配文本列表中获得子字符串或2个单词? - How can I get substring or 2 words from the list on matching text? 如何获得单词列表的三维向量嵌入 - How to get three dimensional vector embedding for a list of words 如何从普林斯顿英语 WordNet 获取词性和单词列表? - How to get a list of parts of speech and words from Princeton English WordNet? 如何获得各种语言中最常用单词的列表? - How do I get a list of the most common words in various languages? 如何获取是/否问题的某些动词的否定词列表? - How to get the list of negative words of certain verbs for Yes/No Questions?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM