由于没有共享代码,因此我将这个问题分解为以下步骤:
-
您已经找到了情感
-
对于情绪积极的句子组,从每个句子中找出最重要的单词
-
计算该单词出现在积极情绪中的次数
-
根据每个单词可用的次数创建单词云
-
对带有负面情绪的句子重复步骤2-4
检查以下链接:https://amueller.github.io/word_cloud/generated/wordcloud.WordCloud.html。
让我知道我是否错过了了解您的确切问题的机会。
,
我想将其添加为评论,但在那里不够清晰。
好吧,我使用下面的代码:
Anaconda命令提示符:
pip install rake-nltk
Jupyter:
from rake_nltk import Rake
r = Rake()
myText = ''' The watch has a good dial. The good thing about the product is the
leather strap '''
r.extract_keywords_from_text(myText)
r.get_ranked_phrases()
输出:
['leather strap','good thing','good dial','watch','product']
我认为您可以在实际文本中尝试此算法并获得排名短语。希望这会有所帮助。
检查此链接以获取更多详细信息:https://pypi.org/project/rake-nltk/#:~:text=RAKE%20short%20for%20Rapid%20Automatic,other%20words%20in%20the%20text.
本文链接:https://www.f2er.com/2023623.html