python 去除停用词  结巴分词


 

import jieba

#stopwords = {}.fromkeys([ line.rstrip() for line in open('stopword.txt') ])

stopwords = {}.fromkeys(['的', '附近'])

segs = jieba.cut('北京附近的租房', cut_all=False)
final = ''
for seg in segs:
    seg = seg.encode('gbk')
    if seg not in stopwords:
            final += seg
print final

相关文章:

  • 2022-03-06
  • 2021-09-20
  • 2022-12-23
  • 2022-12-23
  • 2021-07-13
  • 2021-07-27
  • 2021-09-09
  • 2021-10-24
猜你喜欢
  • 2022-12-23
  • 2021-11-30
  • 2022-12-23
  • 2021-08-07
  • 2022-01-05
  • 2021-09-16
  • 2022-12-23
相关资源
相似解决方案