wordNet停用词

from nltk.corpus import stopwords
import nltk

nltk.download("stopwords")

def stop_words():
    sw = stopwords.words("english")
    return sw
def sentence_test():
    sentence = "Text Summarization is the procedure by which the significant portions of a text are retrieved"
    sentence = sentence.split(" ")
    for i in sentence:
        if i not in stop_words():
            print(i, wn.synsets(i))
if __name__ == '__main__':
    sw = stop_words()
    print(sw)
    sentence_test()

 

output:

['i', 'me', 'my', 'myself', 'we', 'our', 'ours', 'ourselves', 'you', "you're", "you've", "you'll", "you'd", 'your', 'yours', 'yourself', 'yourselves', 'he', 'him', 'his', 'himself', 'she', "she's", 'her', 'hers', 'herself', 'it', "it's", 'its', 'itself', 'they', 'them', 'their', 'theirs', 'themselves', 'what', 'which', 'who', 'whom', 'this', 'that', "that'll", 'these', 'those', 'am', 'is', 'are', 'was', 'were', 'be', 'been', 'being', 'have', 'has', 'had', 'having', 'do', 'does', 'did', 'doing', 'a', 'an', 'the', 'and', 'but', 'if', 'or', 'because', 'as', 'until', 'while', 'of', 'at', 'by', 'for', 'with', 'about', 'against', 'between', 'into', 'through', 'during', 'before', 'after', 'above', 'below', 'to', 'from', 'up', 'down', 'in', 'out', 'on', 'off', 'over', 'under', 'again', 'further', 'then', 'once', 'here', 'there', 'when', 'where', 'why', 'how', 'all', 'any', 'both', 'each', 'few', 'more', 'most', 'other', 'some', 'such', 'no', 'nor', 'not', 'only', 'own', 'same', 'so', 'than', 'too', 'very', 's', 't', 'can', 'will', 'just', 'don', "don't", 'should', "should've", 'now', 'd', 'll', 'm', 'o', 're', 've', 'y', 'ain', 'aren', "aren't", 'couldn', "couldn't", 'didn', "didn't", 'doesn', "doesn't", 'hadn', "hadn't", 'hasn', "hasn't", 'haven', "haven't", 'isn', "isn't", 'ma', 'mightn', "mightn't", 'mustn', "mustn't", 'needn', "needn't", 'shan', "shan't", 'shouldn', "shouldn't", 'wasn', "wasn't", 'weren', "weren't", 'won', "won't", 'wouldn', "wouldn't"]

Text [Synset('text.n.01'), Synset('text.n.02'), Synset('textbook.n.01'), Synset('text.n.04')]
Summarization [Synset('summarization.n.01')]
procedure [Synset('procedure.n.01'), Synset('operation.n.07'), Synset('routine.n.03'), Synset('procedure.n.04')]
significant [Synset('significant.a.01'), Synset('significant.s.02'), Synset('significant.a.03'), Synset('meaning.s.01')]
portions [Synset('part.n.01'), Synset('part.n.02'), Synset('parcel.n.02'), Synset('share.n.01'), Synset('fortune.n.04'), Synset('dowry.n.01'), Synset('helping.n.01'), Synset('assign.v.02')]
text [Synset('text.n.01'), Synset('text.n.02'), Synset('textbook.n.01'), Synset('text.n.04')]
retrieved [Synset('recover.v.01'), Synset('retrieve.v.02'), Synset('retrieve.v.03'), Synset('remember.v.01')]

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值