资源简介
COAE2015数据集,用做简单的机器学习情感分析的训练集很不错
代码片段和文件信息
import pandas as pd
corpus = pd.Dataframe(pd.read_csv(‘./data/FinalAll.csv‘))
labels = corpus[‘8Label‘]
text = corpus[‘7Text‘]
print(text[1])
negfile = open(‘negfile.txt‘ ‘w‘ encoding = ‘utf-8‘)
posfile = open(‘posfile.txt‘ ‘w‘ encoding = ‘utf-8‘)
objfile = open(‘objfile.txt‘ ‘w‘ encoding = ‘utf-8‘)
for i in range(len(text)):
if labels[i] == 0:
objfile.write(‘{}‘.format(text[i]))
objfile.write(‘\n‘)
if labels[i] == -1:
negfile.write(‘{}‘.format(text[i]))
negfile.write(‘\n‘)
else :
posfile.write(‘{}‘.format(text[i]))
posfile.write(‘\n‘)
objfile.close()
negfile.close()
posfile.close()
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-05-14 21:04 coae2015-master\
文件 20 2016-02-03 16:26 coae2015-master\README.md
目录 0 2018-05-11 22:53 coae2015-master\data\
文件 613776 2016-02-03 16:26 coae2015-master\data\FinalAll.csv
文件 1895330 2016-02-03 16:26 coae2015-master\data\FinalAllConcatSeg.csv
文件 635115 2016-02-03 16:26 coae2015-master\data\FinalAllSeg.csv
文件 1600176 2016-02-03 16:26 coae2015-master\data\OriginalTest.csv
文件 406924 2016-02-03 16:26 coae2015-master\data\OriginalTrain.csv
文件 108105 2018-05-14 15:12 coae2015-master\negfile.txt
文件 0 2018-05-14 21:03 coae2015-master\objfile.txt
文件 317545 2018-05-14 15:12 coae2015-master\posfile.txt
文件 647 2018-05-14 15:12 coae2015-master\readcsv.py
- 上一篇:课堂抽奖随机点名系统
- 下一篇:bootstrap.chm 离线中文文档 免费
评论
共有 条评论