def extractKeyWordByTextRank(self,sentence):
wordList=[]
if self.conf["threshold"]:
threshold=self.conf["threshold"]
tmpList=jieba.analyse.textrank(sentence,topK=self.conf["topK"],withWeight=True,allowPOS=self.conf["allowPOS"])
for pair in tmpList:
if pair[1]>=threshold:
wordList.append(pair[0])
else:
wordList=list(jieba.analyse.textrank(sentence,topK=self.conf["topK"],withWeight=self.conf["withWeight"],allowPOS=self.conf["allowPOS"]))
return wordList
评论列表
文章目录