得到句子分词后的结果,并把类别标签保存为y_train.npy,y_test.npy
# 加载文件,导入数据,分词
def loadfile():
neg=pd.read_excel(config.NEG_PATH,header=None,index=None)
pos=pd.read_excel(config.POS_PATH,header=None,index=None)
cw = lambda x: list(jieba.cut(x))
pos['words'] = pos[0].apply(cw)
neg['words'] = neg[0].apply(cw)
#print pos['words']
#use 1 for positive sentiment, 0 for negative
y = np.concatenate((np.ones(len