文本分析过程中,中文文本分析是一个非常重要的环节,而停用词表的选择也是非常关键的,网络流行了多种版本的停用词表,都具有各自的特点,现在对网络流行的多种停用词表继续去重处理,综合实现新的停用词表。
不同版本的停用词表:
去重合并:
# -*-coding:utf-8-*-import os
"""合并文本文件
"""
mergefiledir = os.getcwd()+'\\stopwords'
filenames = os.listdir(mergefiledir)
file = open('stopwords.txt', 'w')for filename in filenames:filepath = mergefiledir + '\\' + filenamefor line in open(filepath):file.writelines(line)file.write('\n')"""去重
"""
lines = open('stopwords.txt', 'r')
newfile = open('stopword.txt', 'w')
new = []
for line in lines.readlines():if line not in new:new.append(line)newfile.writelines(line)file.close()
newfile.close()
获得停用词表,共2792个停用词:下载
,
?
、
。
“
”
《
》
!
,
:
;
?
人民
末##末
啊
阿
哎
哎呀
哎哟
唉
俺
俺们
按
按照
吧
吧哒
把
罢了
被
本
本着
比
比方
比如
鄙人
彼
彼此
边
别
别的
别说
并
。。。
欢迎关注微信公众号:数据分析科学
墨竹专栏,为CSDN博客而生,您有任何问题,欢迎进行探讨!