rake_nltk包中的函数返回无关键字

时间:2017-10-10 09:48:50

标签: python nlp

以下代码返回无关键字: -

from rake_nltk import Rake

r=Rake()
testscenario='''This document is very important as it has a lot of business objectives mentioned in it.'''
defect='''Current day per security file is going to Bloomberg and we are getting data back from Bloomberg but it is not loading into the MarkIt tables.  Last date on MarkIt tables for data loaded was June 29, 2016.BBG Run date for what is going into per security matcher is June 29th.See attached for screen shots.'''
print(r.extract_keywords_from_text(testscenario))

我得到的输出是无。

2 个答案:

答案 0 :(得分:0)

请参阅包装的自述文件。它清楚地描述了获得排名短语所需的内容

r.extract_keywords_from_text(testscenario)

从给定文本中提取关键字。使用

r.get_ranked_phrases()
r.get_ranked_phrases_with_scores()

获得排名分数及其权重。

自述文件链接:https://github.com/csurfer/rake-nltk/blob/master/README.md

答案 1 :(得分:0)

可以使用以下代码。它对我有用。

from rake_nltk import Rake
r=Rake()
testscenario='This document is very important as it has a lot of business objectives mentioned in it.'
r.extract_keywords_from_text(testscenario)
print(r.get_ranked_phrases())

参考:https://pypi.org/project/rake-nltk/