有没有办法检查一个单词将在哪个主题中?

发布于 2025-01-20 00:34:20 字数 298 浏览 0 评论 0原文

我已经使用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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

扛刀软妹 2025-01-27 00:34:20

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 to 1.0 - check that & consider scaling its results if you need to.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文