我想将其添加为评论,但那里还不够清楚。
好吧,我使用了以下代码:
Anaconda 命令提示符:
pip install rake-nltk
木星:
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。