postcards_chuck_norris.py 文件源码

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

项目:postcards 作者: abertschi 项目源码 文件源码
def _find_nouns(self, sentence):
        tokens = nltk.word_tokenize(sentence)
        tagged = nltk.pos_tag(tokens)
        nouns = [word for word, pos in tagged \
                 if (pos == 'NN' or pos == 'NNP' or pos == 'NNS' or pos == 'NNPS')]

        filter_keywords = ['chuck', 'norris', 'quot']
        filtered = [i for i in nouns if not any(f in i.lower() for f in filter_keywords)]
        return filtered
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号