WordExtractor.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:Rnews 作者: suemi994 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号