有没有办法检查一个单词将在哪个主题中?
我已经使用Gensim的LDA主题建模来创建6个主题。但是现在,我想说一个词,看看哪个主题会属于。这可能吗?如果是这样,哪种方法?
ex。 输入Word('Fitness')=> LDA型号=>该单词最适合(如果在词典中)
类似的主题中的百分比:
Topic 1: 2%,
Topic 2: 5%,
Topic 3: 1%,
Topic 4: 89%,
Topic 5: 1%,
Topic 6: 2%
因此,我可以说这个词最适合主题4。
I have used Gensim's LDA topic modeling to create 6 topics. But now I would like to give the model a word and see which topic that would fall under. Is this possible? If so through which method?
Ex.
Enter word('Fitness') => LDA Model => Percentage of which topic the word would best fit under (if in the dictionary)
Something like:
Topic 1: 2%,
Topic 2: 5%,
Topic 3: 1%,
Topic 4: 89%,
Topic 5: 1%,
Topic 6: 2%
Thus, I could say this word fits best under topic 4.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Gensim's LDA implementation includes the method
get_term_topics(word_id, minimum_probability=None)
:相对概率,对于给定单词 *通过模型中的整数ID) - 可选删除到一些可选的
minimum_probability
。 (我不确定概率是否可以保证将其列为1.0
- 检查该概率如果需要,请考虑缩放其结果。)Gensim's LDA implementation includes the method
get_term_topics(word_id, minimum_probability=None)
:https://radimrehurek.com/gensim/models/ldamodel.html#gensim.models.ldamodel.LdaModel.get_term_topics
It returns topics, & relative probabilities, for the given word *by its integer ID within the model) - optional clipped to some optional
minimum_probability
. (I'm not certain if the probabilities are guaranteed to sum to1.0
- check that & consider scaling its results if you need to.)