datahandle.py 文件源码

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

项目:Graduation-design 作者: Baichenjia 项目源码 文件源码
def Delete_stopwords():
    print '????????...'
    f_stop = open('emotion_file/stopwords.txt')  # ???????
    f_stop_list = []
    for word in f_stop.readlines():
        f_stop_list.append(word)
    f_stop.close()

    f_text = open("emotion_file/data_zhuguan.txt", "r")   # ????
    f_nostop = codecs.open('emotion_file/data_zhuguan_nostop.txt', 'w', encoding='UTF-8')
    for text in f_text.readlines():  # ??????????????
        f_seg_list = list(jieba.cut(text, cut_all=False))  # ????
        for word in f_seg_list:
            if word in f_stop_list:
                print word
            else:
                f_nostop.write(word)
    f_text.close()
    print"???????..."  # ????


# ??????????????? data_jixing.txt ??????????
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号