In [5]:
import pandas as pd #导入Pandas
import numpy as np #导入Numpy
import jieba #导入结巴分词
jieba.enable_parallel(32)

from keras.preprocessing import sequence
from keras.optimizers import SGD, RMSprop, Adagrad
from keras.utils import np_utils
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation
from keras.layers.embeddings import Embedding
from keras.layers.recurrent import LSTM, GRU

from __future__ import absolute_import #导入3.x的特征函数
from __future__ import print_function

In [3]:
neg=pd.read_excel('neg.xls',header=None,index=None)
pos=pd.read_excel('pos.xls',header=None,index=None) #读取训练语料完毕
pos['mark']=1
neg['mark']=0 #给训练语料贴上标签
pn=pd.concat([pos,neg],ignore_index=True) #合并语料
neglen=len(neg)
poslen=len(pos) #计算语料数目

In [4]:
cw = lambda x: list(jieba.cut(x)) #定义分词函数
pn['words'] = pn[0].apply(cw)

comment = pd.read_excel('sum.xls') #读入评论内容
#comment = pd.read_csv('a.csv', encoding='utf-8')
comment = comment[comment['rateContent'].notnull()] #仅读取非空评论
comment['words'] = comment['rateContent'].apply(cw) #评论分词 

d2v_train = pd.concat([pn['words'], comment['words']], ignore_index = True)


Building prefix dict from the default dictionary ...
Dumping model to file cache /tmp/jieba.cache
Loading model cost 1.918 seconds.
Prefix dict has been built succesfully.

In [6]:
w = [] #将所有词语整合在一起
for i in d2v_train:
  w.extend(i)

dict = pd.DataFrame(pd.Series(w).value_counts()) #统计词的出现次数
del w,d2v_train
dict['id']=list(range(1,len(dict)+1))

get_sent = lambda x: list(dict['id'][x])
pn['sent'] = pn['words'].apply(get_sent) #速度太慢

maxlen = 50

print("Pad sequences (samples x time)")
pn['sent'] = list(sequence.pad_sequences(pn['sent'], maxlen=maxlen))


Pad sequences (samples x time)

In [7]:
x = np.array(list(pn['sent']))[::2] #训练集
y = np.array(list(pn['mark']))[::2]
xt = np.array(list(pn['sent']))[1::2] #测试集
yt = np.array(list(pn['mark']))[1::2]
xa = np.array(list(pn['sent'])) #全集
ya = np.array(list(pn['mark']))

In [8]:
print('Build model...')
model = Sequential()
model.add(Embedding(len(dict)+1, 256))
model.add(LSTM(128)) # try using a GRU instead, for fun


Build model...

In [9]:
model.add(Dropout(0.5))
model.add(Dense(1))
model.add(Activation('sigmoid'))

model.compile(loss='binary_crossentropy', optimizer='adam', class_mode="binary")

In [10]:
from keras.utils import plot_model
plot_model(model, to_file='model.png')


---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-10-437440fcd987> in <module>()
      1 from keras.utils import plot_model
----> 2 plot_model(model, to_file='model.png')

/home/da/miniconda3/envs/idp3/lib/python3.5/site-packages/keras/utils/vis_utils.py in plot_model(model, to_file, show_shapes, show_layer_names)
     98                show_shapes=False,
     99                show_layer_names=True):
--> 100     dot = model_to_dot(model, show_shapes, show_layer_names)
    101     _, extension = os.path.splitext(to_file)
    102     if not extension:

/home/da/miniconda3/envs/idp3/lib/python3.5/site-packages/keras/utils/vis_utils.py in model_to_dot(model, show_shapes, show_layer_names)
     33     from ..models import Sequential
     34 
---> 35     _check_pydot()
     36     dot = pydot.Dot()
     37     dot.set('rankdir', 'TB')

/home/da/miniconda3/envs/idp3/lib/python3.5/site-packages/keras/utils/vis_utils.py in _check_pydot()
     15 def _check_pydot():
     16     if not (pydot and pydot.find_graphviz()):
---> 17         raise ImportError('Failed to import pydot. You must install pydot'
     18                           ' and graphviz for `pydotprint` to work.')
     19 

ImportError: Failed to import pydot. You must install pydot and graphviz for `pydotprint` to work.

In [ ]:
model.fit(xa, ya, batch_size=16, nb_epoch=10) #训练时间为若干个小时

In [ ]:
classes = model.predict_classes(xa)
acc = np_utils.accuracy(classes, ya)
print('Test accuracy:', acc)

In [3]:
# -*- coding:utf-8 -*-
'''
使用训练语料和扩展语料构造一个词典后,
构建LSTM网络训练情感分类模型
'''
from __future__ import absolute_import #导入3.x的特征函数
from __future__ import print_function
import pandas as pd #导入Pandas
import numpy as np #导入Numpy
import jieba #导入结巴分词
import h5py
import sys
import gensim
import keras

from keras.preprocessing import sequence
from keras.optimizers import SGD, RMSprop, Adagrad
from keras.utils import plot_model
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation
from keras.layers.embeddings import Embedding
from keras.layers.recurrent import LSTM, GRU
from keras.layers.wrappers import Bidirectional
from keras.callbacks import TensorBoard
from keras.metrics import binary_accuracy
from keras import backend as K
from pickle import dump, load
# import json


Using TensorFlow backend.

In [15]:
margin = 0.6
theta = lambda t: (K.sign(t)+1.)/2.

print('Build from raw data.')
jieba.enable_parallel(32)
data = pd.read_excel("sentiment_data.xlsx")
pn = pd.DataFrame()
pn['sent'] = data.sentence
pn['mark'] = data.emotion_1
cw = lambda x: list(jieba.cut(str(x))) #定义分词函数
pn['words'] = pn['sent'].apply(cw)
d2v_train = pn['words']
w = [] #将所有词语整合在一起
for i in d2v_train:
    w.extend(i)
dict_w = pd.DataFrame(pd.Series(w).value_counts()) #统计词的出现次数
del w,d2v_train
dict_w['id']=list(range(1,len(dict_w)+1))

get_sent = lambda x: list(dict_w['id'][x])
pn['sent'] = pn['words'].apply(get_sent) #速度太慢
maxlen = 50
print("Pad sequences (samples x time)")
pn['sent'] = list(sequence.pad_sequences(pn['sent'], maxlen=maxlen, padding='post', truncating='post'))


Building prefix dict from the default dictionary ...
Loading model from cache /tmp/jieba.cache
Build from raw data.
Loading model cost 1.251 seconds.
Prefix dict has been built succesfully.
Pad sequences (samples x time)

In [7]:
margin = 0.6
theta = lambda t: (K.sign(t)+1.)/2.

data = pd.read_excel("sentiment_data.xlsx")


Out[7]:
13

In [31]:
a = emotion_encoder(emotion)
a = a[2:]
len(a)
print(a)
emo = []
emo_reverse_dict = dict(zip(range(8), ['none', 'disgust', 'like', 'happiness', 'sadness', 'surprise', 'anger', 'fear']))
for i in range(len(a)):
    if a[i]=='1':
        emo.append(emo_reverse_dict[i])
emo


10001101
Out[31]:
['none', 'sadness', 'surprise', 'fear']

In [42]:
emotion = ['happiness','like','none','fear']
def emotion_list_encoder(emo_list):
    emo_dict = dict(zip(['none', 'disgust', 'like', 'happiness', 'sadness', 'surprise', 'anger', 'fear'], range(8)))
    emo_encrypt_list = [2**emo_dict[x] for x in emo_list]
    code = bin(sum(emo_encrypt_list))
    return code
print(emotion_encoder(emotion))
def emotion_list_decoder(emo_index):
    emotion_index = emo_index[2:]
    emo_reverse_dict = dict(zip(range(8), ['none', 'disgust', 'like', 'happiness', 'sadness', 'surprise', 'anger', 'fear']))
    emo_list = []
    for i in range(len(emotion_index)):
        if emotion_index[i]=='1':
            emo_list.append(emo_reverse_dict[i])
    return emo_list
print(emotion_list_decoder(emotion_list_encoder(emotion)))


0b10001101
['none', 'sadness', 'surprise', 'fear']

In [37]:
print([(a,b) for a in range(5) for b in range(5)])
data.shape[0]


[(0, 0), (0, 1), (0, 2), (0, 3), (0, 4), (1, 0), (1, 1), (1, 2), (1, 3), (1, 4), (2, 0), (2, 1), (2, 2), (2, 3), (2, 4), (3, 0), (3, 1), (3, 2), (3, 3), (3, 4), (4, 0), (4, 1), (4, 2), (4, 3), (4, 4)]
Out[37]:
16706

In [44]:
data['mark'] = [emotion_list_encoder([data.emotion_1[i], data.emotion2[i]]) for i in range(data.shape[0])]
data['raw_emotion'] = data['mark'].apply(emotion_list_decoder)
data


Out[44]:
sentence emotion_1 emotion2 mark raw_emotion
0 今儿老爸逮着我一顿狠念! none none 0b10 [none]
1 念得我各种烦躁…… disgust none 0b11 [none, disgust]
2 我要不要考虑下降低回家的频率啊 回来一次吵一次= =真烦人!!! disgust none 0b11 [none, disgust]
3 在考虑是否要回刷2.3Rom,黑/锁屏状态,屏幕微微亮; none none 0b10 [none]
4 发烫耗电快… none none 0b10 [none]
5 这让我蛋疼! disgust none 0b11 [none, disgust]
6 不过,喜欢4.0原生态的界面! like none 0b101 [none, like]
7 去年的今天我去上了政治辅导班,回来看芒果台的跨年晚会,然后叠了纸飞机在上面许下了心愿。 none none 0b10 [none]
8 又要重复我每年必说的台词了,2010就要过去了,我很怀念它。 like none 0b101 [none, like]
9 至少,它看上去很美。 like none 0b101 [none, like]
10 欢迎你,2011,新年快乐! happiness like 0b1100 [none, disgust]
11 下午到台里,吴凤花和方亚芬正在换装。 none none 0b10 [none]
12 我刚过去打个招呼,就被德才老师说耽误他们录像。 none none 0b10 [none]
13 我那个冤呢。 sadness none 0b10001 [none, sadness]
14 我说我没采访。 none none 0b10 [none]
15 他说聊天也不行,耽误穿服装。 none none 0b10 [none]
16 方姐姐说腿好的话就来段对花枪了。 none none 0b10 [none]
17 好难过 为什么每天都回忆你 为什么每天都想起你 为什么每天都好痴累 早结束了 怎么还在爱 sadness none 0b10001 [none, sadness]
18 为什么我的房间那么干呢,嗓子疼啊~! sadness none 0b10001 [none, sadness]
19 今早起来更体现出了我昨天排练的成果,腰酸背痛!!! sadness none 0b10001 [none, sadness]
20 不过彭老师今早出门说的那句话我也赞同...... none none 0b10 [none]
21 这家位于槟城George Town,Tunes Hotel斜对面的饼家,家庭式作业,她的咸蛋... like none 0b101 [none, like]
22 今天是个值得开心和崩溃的日子~ sadness happiness 0b11000 [none, disgust]
23 大腿再次拉伤,痛到我眼泪都出了… sadness none 0b10001 [none, sadness]
24 回到宿舍连续拉肚子,崩溃… sadness none 0b10001 [none, sadness]
25 接下来继续红红的红歌赛~ happiness none 0b1001 [none, happiness]
26 OMG,是我不关心八卦太久了吗?! surprise none 0b100001 [none, surprise]
27 白天还在跟小黑讨论Jensen过生日,跟大J一起回温哥华机场的事,我忍不住想JQ肯定又燃烧起... none none 0b10 [none]
28 结果刚刚KANA来跟我说八卦:J2周末一起公然出现在某个GAY BAR(CLUB 560),... surprise none 0b100001 [none, surprise]
29 谁能告诉我这是不是真的啊啊啊啊啊啊,我要疯狂了~~~~~~~~~ surprise none 0b100001 [none, surprise]
... ... ... ... ... ...
16676 3学会宽容。宽容像春天的阳光,照耀别人也温暖自己。 none none 0b10 [none]
16677 4学会隐忍。隐而不发不是不发。 none none 0b10 [none]
16678 5学会简单。美丽和幸福都是简单的,把握了简单就是不简单。 none none 0b10 [none]
16679 6学会换位思考。换个角度,世界就会大不相同.. none none 0b10 [none]
16680 thx @王力群Alex none none 0b10 [none]
16681 东南网-海峡都市报讯 昨日下午2时许,送完孩子准备回家的万女士,路过福州五四北路省体东门前路... none none 0b10 [none]
16682 事故发生在往二环路的车道上,肇事小车停在斑马线上,伤者已被送往医院。 none none 0b10 [none]
16683 目击者林女士说,当时万女士就站在斑马线上准备过马路,可人没动,这车就冲过来了。 none none 0b10 [none]
16684 太古三里屯北区-围合式分布的旗舰街区,商铺以纵向分割为主(1-2/3-4),沿袭南区1-2层... none none 0b10 [none]
16685 品牌:阿一鲍鱼、阿玛尼、巴黎世家、浪凡、范思哲、思睿、万宝龙、劳力士、APE、派、我的2次方 none none 0b10 [none]
16686 我................ none none 0b10 [none]
16687 轻度失忆症,轻度妄想症,轻度自闭症,轻度抑郁症。 none none 0b10 [none]
16688 一个月配三次锁匙,我都唔知我搞乜! none none 0b10 [none]
16689 我仲以为前几晚醉左翻黎系我自己开门,原来系打电话叫人开门噶! none none 0b10 [none]
16690 唉,千杯不醉变左三杯就醉! none none 0b10 [none]
16691 连自己醉左都唔知,翻时好清醒甘,训醒就完全断片![左哼哼] none none 0b10 [none]
16692 近日,甘肃省政府向14个市(州)、省政府有关部门发出《通知》,印发经国务院批准的《甘肃省土地... none none 0b10 [none]
16693 金厉旭我只在乎你真的好好听哦崇拜! like none 0b101 [none, like]
16694 下午场都录嘞,现在休息休惨了哈哈哈哈哈,崔始源今天被说崔老板,被叫到后来他说我不是他们老板,... like happiness 0b1100 [none, disgust]
16695 玩游戏,看电影,小姑娘吃过西瓜摸着肚子睡着了…… none none 0b10 [none]
16696 一看就舒服,这才是完美的夏天~我想放暑假! like happiness 0b1100 [none, disgust]
16697 还有谁想放暑假? none none 0b10 [none]
16698 腿上的伤口好明显 T T 这又不是玩命啊 去他的节目啊咱本来就够优秀了不是吗? anger none 0b1000001 [none, anger]
16699 戴了护膝还摔成这样那冲击是有多大[泪] surprise none 0b100001 [none, surprise]
16700 麦兜说:有事情是要说出来的,不要等着对方去领悟,因为对方不是你,不知道你想要什么,等到最后只... none none 0b10 [none]
16701 一个做二手车生意的哥哥和我说时我还不信,这下看来是真的了。 none none 0b10 [none]
16702 每次有新政出台就会有一批人富起来! anger surprise 0b1100000 [none, disgust]
16703 [惊恐][愤怒] anger fear 0b11000000 [none, disgust]
16704 人生不止,寂寞不已。 sadness none 0b10001 [none, sadness]
16705 寂寞人生爱无休,寂寞是爱永远的主题、我和我的影子独处、它说它有悄悄话想跟我说、它说它很想念你... sadness none 0b10001 [none, sadness]

16706 rows × 5 columns


In [51]:
len(data.mark.unique())
labels = data.mark.unique()
type(labels)
trans_dict = dict(zip(labels, range(len(labels))))
rev_trans_dict = dict(zip(range(len(labels)), labels))
trans_dict
trans_fun = lambda x:trans_dict[x]
rev_trans_dict
data['new_mark'] = data['mark'].apply(trans_fun)


Out[51]:
sentence emotion_1 emotion2 mark raw_emotion new_mark
0 今儿老爸逮着我一顿狠念! none none 0b10 [none] 0
1 念得我各种烦躁…… disgust none 0b11 [none, disgust] 1
2 我要不要考虑下降低回家的频率啊 回来一次吵一次= =真烦人!!! disgust none 0b11 [none, disgust] 1
3 在考虑是否要回刷2.3Rom,黑/锁屏状态,屏幕微微亮; none none 0b10 [none] 0
4 发烫耗电快… none none 0b10 [none] 0
5 这让我蛋疼! disgust none 0b11 [none, disgust] 1
6 不过,喜欢4.0原生态的界面! like none 0b101 [none, like] 2
7 去年的今天我去上了政治辅导班,回来看芒果台的跨年晚会,然后叠了纸飞机在上面许下了心愿。 none none 0b10 [none] 0
8 又要重复我每年必说的台词了,2010就要过去了,我很怀念它。 like none 0b101 [none, like] 2
9 至少,它看上去很美。 like none 0b101 [none, like] 2
10 欢迎你,2011,新年快乐! happiness like 0b1100 [none, disgust] 3
11 下午到台里,吴凤花和方亚芬正在换装。 none none 0b10 [none] 0
12 我刚过去打个招呼,就被德才老师说耽误他们录像。 none none 0b10 [none] 0
13 我那个冤呢。 sadness none 0b10001 [none, sadness] 4
14 我说我没采访。 none none 0b10 [none] 0
15 他说聊天也不行,耽误穿服装。 none none 0b10 [none] 0
16 方姐姐说腿好的话就来段对花枪了。 none none 0b10 [none] 0
17 好难过 为什么每天都回忆你 为什么每天都想起你 为什么每天都好痴累 早结束了 怎么还在爱 sadness none 0b10001 [none, sadness] 4
18 为什么我的房间那么干呢,嗓子疼啊~! sadness none 0b10001 [none, sadness] 4
19 今早起来更体现出了我昨天排练的成果,腰酸背痛!!! sadness none 0b10001 [none, sadness] 4
20 不过彭老师今早出门说的那句话我也赞同...... none none 0b10 [none] 0
21 这家位于槟城George Town,Tunes Hotel斜对面的饼家,家庭式作业,她的咸蛋... like none 0b101 [none, like] 2
22 今天是个值得开心和崩溃的日子~ sadness happiness 0b11000 [none, disgust] 5
23 大腿再次拉伤,痛到我眼泪都出了… sadness none 0b10001 [none, sadness] 4
24 回到宿舍连续拉肚子,崩溃… sadness none 0b10001 [none, sadness] 4
25 接下来继续红红的红歌赛~ happiness none 0b1001 [none, happiness] 6
26 OMG,是我不关心八卦太久了吗?! surprise none 0b100001 [none, surprise] 7
27 白天还在跟小黑讨论Jensen过生日,跟大J一起回温哥华机场的事,我忍不住想JQ肯定又燃烧起... none none 0b10 [none] 0
28 结果刚刚KANA来跟我说八卦:J2周末一起公然出现在某个GAY BAR(CLUB 560),... surprise none 0b100001 [none, surprise] 7
29 谁能告诉我这是不是真的啊啊啊啊啊啊,我要疯狂了~~~~~~~~~ surprise none 0b100001 [none, surprise] 7
... ... ... ... ... ... ...
16676 3学会宽容。宽容像春天的阳光,照耀别人也温暖自己。 none none 0b10 [none] 0
16677 4学会隐忍。隐而不发不是不发。 none none 0b10 [none] 0
16678 5学会简单。美丽和幸福都是简单的,把握了简单就是不简单。 none none 0b10 [none] 0
16679 6学会换位思考。换个角度,世界就会大不相同.. none none 0b10 [none] 0
16680 thx @王力群Alex none none 0b10 [none] 0
16681 东南网-海峡都市报讯 昨日下午2时许,送完孩子准备回家的万女士,路过福州五四北路省体东门前路... none none 0b10 [none] 0
16682 事故发生在往二环路的车道上,肇事小车停在斑马线上,伤者已被送往医院。 none none 0b10 [none] 0
16683 目击者林女士说,当时万女士就站在斑马线上准备过马路,可人没动,这车就冲过来了。 none none 0b10 [none] 0
16684 太古三里屯北区-围合式分布的旗舰街区,商铺以纵向分割为主(1-2/3-4),沿袭南区1-2层... none none 0b10 [none] 0
16685 品牌:阿一鲍鱼、阿玛尼、巴黎世家、浪凡、范思哲、思睿、万宝龙、劳力士、APE、派、我的2次方 none none 0b10 [none] 0
16686 我................ none none 0b10 [none] 0
16687 轻度失忆症,轻度妄想症,轻度自闭症,轻度抑郁症。 none none 0b10 [none] 0
16688 一个月配三次锁匙,我都唔知我搞乜! none none 0b10 [none] 0
16689 我仲以为前几晚醉左翻黎系我自己开门,原来系打电话叫人开门噶! none none 0b10 [none] 0
16690 唉,千杯不醉变左三杯就醉! none none 0b10 [none] 0
16691 连自己醉左都唔知,翻时好清醒甘,训醒就完全断片![左哼哼] none none 0b10 [none] 0
16692 近日,甘肃省政府向14个市(州)、省政府有关部门发出《通知》,印发经国务院批准的《甘肃省土地... none none 0b10 [none] 0
16693 金厉旭我只在乎你真的好好听哦崇拜! like none 0b101 [none, like] 2
16694 下午场都录嘞,现在休息休惨了哈哈哈哈哈,崔始源今天被说崔老板,被叫到后来他说我不是他们老板,... like happiness 0b1100 [none, disgust] 3
16695 玩游戏,看电影,小姑娘吃过西瓜摸着肚子睡着了…… none none 0b10 [none] 0
16696 一看就舒服,这才是完美的夏天~我想放暑假! like happiness 0b1100 [none, disgust] 3
16697 还有谁想放暑假? none none 0b10 [none] 0
16698 腿上的伤口好明显 T T 这又不是玩命啊 去他的节目啊咱本来就够优秀了不是吗? anger none 0b1000001 [none, anger] 9
16699 戴了护膝还摔成这样那冲击是有多大[泪] surprise none 0b100001 [none, surprise] 7
16700 麦兜说:有事情是要说出来的,不要等着对方去领悟,因为对方不是你,不知道你想要什么,等到最后只... none none 0b10 [none] 0
16701 一个做二手车生意的哥哥和我说时我还不信,这下看来是真的了。 none none 0b10 [none] 0
16702 每次有新政出台就会有一批人富起来! anger surprise 0b1100000 [none, disgust] 16
16703 [惊恐][愤怒] anger fear 0b11000000 [none, disgust] 26
16704 人生不止,寂寞不已。 sadness none 0b10001 [none, sadness] 4
16705 寂寞人生爱无休,寂寞是爱永远的主题、我和我的影子独处、它说它有悄悄话想跟我说、它说它很想念你... sadness none 0b10001 [none, sadness] 4

16706 rows × 6 columns


In [85]:
trans_dict1 = dict(zip(data.mark.unique(),range(len(data.mark.unique()))))
trans_emo1 = lambda x:trans_dict1[x]
data['mark'] = data['mark'].apply(trans_emo1)
data


Out[85]:
sentence emotion_1 emotion2 mark
0 今儿老爸逮着我一顿狠念! 1 1 0
1 念得我各种烦躁…… 2 1 1
2 我要不要考虑下降低回家的频率啊 回来一次吵一次= =真烦人!!! 2 1 1
3 在考虑是否要回刷2.3Rom,黑/锁屏状态,屏幕微微亮; 1 1 0
4 发烫耗电快… 1 1 0
5 这让我蛋疼! 2 1 1
6 不过,喜欢4.0原生态的界面! 4 1 2
7 去年的今天我去上了政治辅导班,回来看芒果台的跨年晚会,然后叠了纸飞机在上面许下了心愿。 1 1 0
8 又要重复我每年必说的台词了,2010就要过去了,我很怀念它。 4 1 2
9 至少,它看上去很美。 4 1 2
10 欢迎你,2011,新年快乐! 8 4 3
11 下午到台里,吴凤花和方亚芬正在换装。 1 1 0
12 我刚过去打个招呼,就被德才老师说耽误他们录像。 1 1 0
13 我那个冤呢。 16 1 4
14 我说我没采访。 1 1 0
15 他说聊天也不行,耽误穿服装。 1 1 0
16 方姐姐说腿好的话就来段对花枪了。 1 1 0
17 好难过 为什么每天都回忆你 为什么每天都想起你 为什么每天都好痴累 早结束了 怎么还在爱 16 1 4
18 为什么我的房间那么干呢,嗓子疼啊~! 16 1 4
19 今早起来更体现出了我昨天排练的成果,腰酸背痛!!! 16 1 4
20 不过彭老师今早出门说的那句话我也赞同...... 1 1 0
21 这家位于槟城George Town,Tunes Hotel斜对面的饼家,家庭式作业,她的咸蛋... 4 1 2
22 今天是个值得开心和崩溃的日子~ 16 8 5
23 大腿再次拉伤,痛到我眼泪都出了… 16 1 4
24 回到宿舍连续拉肚子,崩溃… 16 1 4
25 接下来继续红红的红歌赛~ 8 1 6
26 OMG,是我不关心八卦太久了吗?! 32 1 7
27 白天还在跟小黑讨论Jensen过生日,跟大J一起回温哥华机场的事,我忍不住想JQ肯定又燃烧起... 1 1 0
28 结果刚刚KANA来跟我说八卦:J2周末一起公然出现在某个GAY BAR(CLUB 560),... 32 1 7
29 谁能告诉我这是不是真的啊啊啊啊啊啊,我要疯狂了~~~~~~~~~ 32 1 7
... ... ... ... ...
16676 3学会宽容。宽容像春天的阳光,照耀别人也温暖自己。 1 1 0
16677 4学会隐忍。隐而不发不是不发。 1 1 0
16678 5学会简单。美丽和幸福都是简单的,把握了简单就是不简单。 1 1 0
16679 6学会换位思考。换个角度,世界就会大不相同.. 1 1 0
16680 thx @王力群Alex 1 1 0
16681 东南网-海峡都市报讯 昨日下午2时许,送完孩子准备回家的万女士,路过福州五四北路省体东门前路... 1 1 0
16682 事故发生在往二环路的车道上,肇事小车停在斑马线上,伤者已被送往医院。 1 1 0
16683 目击者林女士说,当时万女士就站在斑马线上准备过马路,可人没动,这车就冲过来了。 1 1 0
16684 太古三里屯北区-围合式分布的旗舰街区,商铺以纵向分割为主(1-2/3-4),沿袭南区1-2层... 1 1 0
16685 品牌:阿一鲍鱼、阿玛尼、巴黎世家、浪凡、范思哲、思睿、万宝龙、劳力士、APE、派、我的2次方 1 1 0
16686 我................ 1 1 0
16687 轻度失忆症,轻度妄想症,轻度自闭症,轻度抑郁症。 1 1 0
16688 一个月配三次锁匙,我都唔知我搞乜! 1 1 0
16689 我仲以为前几晚醉左翻黎系我自己开门,原来系打电话叫人开门噶! 1 1 0
16690 唉,千杯不醉变左三杯就醉! 1 1 0
16691 连自己醉左都唔知,翻时好清醒甘,训醒就完全断片![左哼哼] 1 1 0
16692 近日,甘肃省政府向14个市(州)、省政府有关部门发出《通知》,印发经国务院批准的《甘肃省土地... 1 1 0
16693 金厉旭我只在乎你真的好好听哦崇拜! 4 1 2
16694 下午场都录嘞,现在休息休惨了哈哈哈哈哈,崔始源今天被说崔老板,被叫到后来他说我不是他们老板,... 4 8 3
16695 玩游戏,看电影,小姑娘吃过西瓜摸着肚子睡着了…… 1 1 0
16696 一看就舒服,这才是完美的夏天~我想放暑假! 4 8 3
16697 还有谁想放暑假? 1 1 0
16698 腿上的伤口好明显 T T 这又不是玩命啊 去他的节目啊咱本来就够优秀了不是吗? 64 1 9
16699 戴了护膝还摔成这样那冲击是有多大[泪] 32 1 7
16700 麦兜说:有事情是要说出来的,不要等着对方去领悟,因为对方不是你,不知道你想要什么,等到最后只... 1 1 0
16701 一个做二手车生意的哥哥和我说时我还不信,这下看来是真的了。 1 1 0
16702 每次有新政出台就会有一批人富起来! 64 32 16
16703 [惊恐][愤怒] 64 128 26
16704 人生不止,寂寞不已。 16 1 4
16705 寂寞人生爱无休,寂寞是爱永远的主题、我和我的影子独处、它说它有悄悄话想跟我说、它说它很想念你... 16 1 4

16706 rows × 4 columns


In [73]:
len(data.mark.unique())


Out[73]:
29

In [8]:
# margin = 0.6
# theta = lambda t: (K.sign(t)+1.)/2.

jieba.enable_parallel(32)
data = pd.read_excel("sentiment_data.xlsx")
trans_dict = dict(zip(data.emotion_1.unique(), range(8)))
trans_emo = lambda x:trans_dict[x]
data['mark'] = data['emotion_1'].apply(trans_emo)
pn = pd.DataFrame()
pn['sent'] = data.sentence
pn['mark'] = data.mark
cw = lambda x: list(jieba.cut(str(x))) #定义分词函数
pn['words'] = pn['sent'].apply(cw)

print('try loading pretrained word2vec model.')
wordvec_model = gensim.models.word2vec.Word2Vec.load('/home/da/nlp_repo/rnn_test/word2vec_wx/word2vec_wx')
wordvec_weight = wordvec_model.wv.syn0
vocab = dict([(k, v.index) for k, v in wordvec_model.wv.vocab.items()])
word_embedding_layer = Embedding(
        input_dim=wordvec_weight.shape[0],
        output_dim=wordvec_weight.shape[1],
        weights=[wordvec_weight],
        trainable=True)
word_to_id = lambda word: not (vocab.get(word) is None) and vocab.get(word) or 0
words_to_ids = lambda words: list(map(word_to_id, words))
pn['sent'] = pn['words'].apply(words_to_ids) #速度太慢
maxlen = 50
reverse_seq = lambda id_seq: id_seq[::-1]
concat_seq = lambda a,b: list(np.hstack((a, b)))
print("Pad sequences (samples x time)")
pn['sent_rev'] = list(sequence.pad_sequences(pn['sent'], maxlen=maxlen))
pn['sent_rev'] = pn['sent_rev'].apply(reverse_seq)
pn['sent'] = list(sequence.pad_sequences(pn['sent'], maxlen=maxlen, padding='post', truncating='post'))
pn['sent'] = pn['sent'].combine(pn['sent_rev'], func=concat_seq)


try loading pretrained word2vec model.
Pad sequences (samples x time)

In [9]:
num_classes = len(data.mark.unique())
x = np.array(list(pn['sent']))[::2] #训练集
y = np.array(list(pn['mark']))[::2]

In [10]:
y = keras.utils.to_categorical(y, num_classes)
xt = np.array(list(pn['sent']))[1::2] #测试集
yt = np.array(list(pn['mark']))[1::2]
yt = keras.utils.to_categorical(yt, num_classes)
xa = np.array(list(pn['sent'])) #全集
ya = np.array(list(pn['mark']))

In [19]:
print('Build model...')
model = Sequential()
model.add(Embedding(len(dict_w)+1, 256))
#model.add(Bidirectional(LSTM(128)))
model.add(GRU(128))  # try using a GRU instead, for fun
model.add(Dropout(0.5))
model.add(Dense(1))
model.add(Activation('softmax'))
improved_loss = lambda y_true, y_pred: -(1-theta(y_true-margin)*theta(y_pred-margin)-theta(1-margin-y_true)*theta(1-margin-y_pred))*(y_true*K.log(y_pred)+(1-y_true)*K.log(1-y_pred))
# using the user defined improved loss fun
model.compile(loss=improved_loss, optimizer='adam', metrics=['mae', 'acc'])
# using the default binary crossentropy loss fun
#model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['mae', 'acc'])


Build model...

In [11]:
print('Build model...')
model = Sequential()
model.add(word_embedding_layer)
model.add(Dropout(0.1))
# model.add(Bidirectional(LSTM(128))) # for looped input sentence sequence, no need Bidirectional
#model.add(LSTM(128))
model.add(GRU(128))
# model.add(LSTM(256, 128)) # try using a GRU instead, for fun
model.add(Dropout(0.5))
model.add(Dense(1))
model.add(Activation('softmax'))
#improved_loss = lambda y_true, y_pred: -(1-theta(y_true-margin)*theta(y_pred-margin)-theta(1-margin-y_true)*theta(1-margin-y_pred))*(y_true*K.log(y_pred)+(1-y_true)*K.log(1-y_pred))
# using the user defined improved loss fun
model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['mae', 'acc'])


Build model...

In [12]:
model.summary()


_________________________________________________________________
Layer (type)                 Output Shape              Param #   
=================================================================
embedding_2 (Embedding)      (None, None, 256)         90162176  
_________________________________________________________________
dropout_1 (Dropout)          (None, None, 256)         0         
_________________________________________________________________
gru_1 (GRU)                  (None, 128)               147840    
_________________________________________________________________
dropout_2 (Dropout)          (None, 128)               0         
_________________________________________________________________
dense_1 (Dense)              (None, 1)                 129       
_________________________________________________________________
activation_1 (Activation)    (None, 1)                 0         
=================================================================
Total params: 90,310,145.0
Trainable params: 90,310,145.0
Non-trainable params: 0.0
_________________________________________________________________

In [32]:
model.fit(x, y, batch_size=16, epochs=10, validation_data=(xt, yt)) #训练时间为若干个小时 # avg 440s per epoch on server with 32 cores.


Train on 8353 samples, validate on 8353 samples
Epoch 1/10
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-32-08ddccbebf1b> in <module>()
----> 1 model.fit(x, y, batch_size=16, epochs=10, validation_data=(xt, yt)) #训练时间为若干个小时 # avg 440s per epoch on server with 32 cores.

/home/da/miniconda3/envs/idp3/lib/python3.5/site-packages/keras/models.py in fit(self, x, y, batch_size, epochs, verbose, callbacks, validation_split, validation_data, shuffle, class_weight, sample_weight, initial_epoch, **kwargs)
    843                               class_weight=class_weight,
    844                               sample_weight=sample_weight,
--> 845                               initial_epoch=initial_epoch)
    846 
    847     def evaluate(self, x, y, batch_size=32, verbose=1,

/home/da/miniconda3/envs/idp3/lib/python3.5/site-packages/keras/engine/training.py in fit(self, x, y, batch_size, epochs, verbose, callbacks, validation_split, validation_data, shuffle, class_weight, sample_weight, initial_epoch, **kwargs)
   1483                               val_f=val_f, val_ins=val_ins, shuffle=shuffle,
   1484                               callback_metrics=callback_metrics,
-> 1485                               initial_epoch=initial_epoch)
   1486 
   1487     def evaluate(self, x, y, batch_size=32, verbose=1, sample_weight=None):

/home/da/miniconda3/envs/idp3/lib/python3.5/site-packages/keras/engine/training.py in _fit_loop(self, f, ins, out_labels, batch_size, epochs, verbose, callbacks, val_f, val_ins, shuffle, callback_metrics, initial_epoch)
   1138                 batch_logs['size'] = len(batch_ids)
   1139                 callbacks.on_batch_begin(batch_index, batch_logs)
-> 1140                 outs = f(ins_batch)
   1141                 if not isinstance(outs, list):
   1142                     outs = [outs]

/home/da/miniconda3/envs/idp3/lib/python3.5/site-packages/keras/backend/tensorflow_backend.py in __call__(self, inputs)
   2071         session = get_session()
   2072         updated = session.run(self.outputs + [self.updates_op],
-> 2073                               feed_dict=feed_dict)
   2074         return updated[:len(self.outputs)]
   2075 

/home/da/miniconda3/envs/idp3/lib/python3.5/site-packages/tensorflow/python/client/session.py in run(self, fetches, feed_dict, options, run_metadata)
    765     try:
    766       result = self._run(None, fetches, feed_dict, options_ptr,
--> 767                          run_metadata_ptr)
    768       if run_metadata:
    769         proto_data = tf_session.TF_GetBuffer(run_metadata_ptr)

/home/da/miniconda3/envs/idp3/lib/python3.5/site-packages/tensorflow/python/client/session.py in _run(self, handle, fetches, feed_dict, options, run_metadata)
    936                 ' to a larger type (e.g. int64).')
    937 
--> 938           np_val = np.asarray(subfeed_val, dtype=subfeed_dtype)
    939 
    940           if not subfeed_t.get_shape().is_compatible_with(np_val.shape):

/home/da/miniconda3/envs/idp3/lib/python3.5/site-packages/numpy/core/numeric.py in asarray(a, dtype, order)
    529 
    530     """
--> 531     return array(a, dtype, copy=False, order=order)
    532 
    533 

ValueError: could not convert string to float: 'none'

In [ ]:
scores = model.evaluate(xt, yt, verbose=0)
print("%s: %.2f%%" % (model.metrics_names[1], scores[1]*100))
print("%s: %.2f%%" % (model.metrics_names[2], scores[2]*100))

In [ ]:
model.save('models/Bi_lstm_senti_0406_improve_loss_post.h5')
json_string = model.to_json()
with open('models/Bi_lstm_senti_0406_improve_loss_post.json', 'wt') as f:
    f.write(json_string)
model.save_weights('models/Bi_lstm_senti_0406_improve_loss_post_weights.h5')
print('Model struct and weights saved.')
#classes = model.predict(xt)
#acc = np_utils.accuracy(classes, yt)
#variable(value, dtype='float32', name=None))
#acc = binary_accuracy(variable(yt, dtype='float64'), variable(classes, dtype='float64'))
#print('Test accuracy:', acc)
pred_x = np.array(list(comment['sent']))
pred_y = model.predict(pred_x)
comment['mark']=list(pred_y)
dump(comment, open('cache/comment_senti_predict.pkl', 'wb'))
writer = pd.ExcelWriter('output/predict_comment_senti.xlsx')
comment.to_excel(writer, sheet_name='senti', encoding = 'utf-8', index = False)
writer.save()

In [54]:
import pymysql

def get_db_data(query_str):
        conn = pymysql.connect(host='127.0.0.1',port=3306,user='analyzer',password='analyzer@tbs2016',database='dp_relation',charset='utf8mb4',cursorclass=pymysql.cursors.DictCursor)
        cur=conn.cursor()
        doc = pd.read_sql_query(query_str, conn)
        doc = pd.DataFrame(doc)
        for column in doc.columns:
            column_null = pd.isnull(doc[column])
            column_null_true = column_null[column_null == True]
            if len(column_null_true) == len(doc):
                del doc[column]
        cur.close()
        conn.close()
        return doc

test_data = get_db_data("select * from weibo_raw_data where keyword_id='37_5'")
test_data.loc[0:10,'content']
comment = test_data

In [56]:
jieba.enable_parallel(32)
cw = lambda x: list(jieba.cut(str(x))) #定义分词函数
maxlen = 50
print('try loading pretrained word2vec model.')
wordvec_model = gensim.models.word2vec.Word2Vec.load('/home/da/nlp_repo/rnn_test/word2vec_wx/word2vec_wx')
wordvec_weight = wordvec_model.wv.syn0
vocab = dict([(k, v.index) for k, v in wordvec_model.wv.vocab.items()])
word_to_id = lambda word: not (vocab.get(word) is None) and vocab.get(word) or 0
words_to_ids = lambda words: list(map(word_to_id, words))
reverse_seq = lambda id_seq: id_seq[::-1]
# concat_seq = lambda df: np.concatenate((df.sent, df.sent_rev))
concat_seq = lambda a,b: list(np.hstack((a, b)))
comment = comment[comment['content'].notnull()] #仅读取非空评论
comment['words'] = comment['content'].apply(cw) #评论分词
comment['sent'] = comment['words'].apply(words_to_ids)
comment['sent_rev'] = list(sequence.pad_sequences(comment['sent'], maxlen=maxlen, padding='pre', truncating='pre'))
comment['sent_rev'] = comment['sent_rev'].apply(reverse_seq)
comment['sent'] = list(sequence.pad_sequences(comment['sent'], maxlen=maxlen, padding='post', truncating='post'))
# print(comment['sent'].shape, comment['sent_rev'].shape)
comment['sent'] = comment['sent'].combine(comment['sent_rev'], func=concat_seq)
print(comment['sent'][0])
# comment['sent'] = comment.apply(concat_seq, axis=1, raw=True, reduce=True)
comment


try loading pretrained word2vec model.
[411, 121, 1, 35, 25284, 5, 30244, 3465, 18, 5, 125790, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 125790, 5, 18, 3465, 30244, 5, 25284, 35, 1, 121, 411, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
Out[56]:
id project_id project_name keyword_id keyword user_id content created_at url comment_count attitude_count repost_count source words sent sent_rev
0 2077339 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130788 这么小的一个电阻 510欧! ​ 2017-04-09 17:45:00 +0800 http://weibo.com/2076419035/EDJ2F3kDF 0 2 0 Weibo.intl [这么, 小, 的, 一个, 电阻, , 510, 欧, !, , ​] [411, 121, 1, 35, 25284, 5, 30244, 3465, 18, 5... [125790, 5, 18, 3465, 30244, 5, 25284, 35, 1, ...
1 2077340 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130788 我以后再也不相信女的不会秃顶这种屁话了。 ​ 2017-04-09 13:50:48 +0800 http://weibo.com/2076419035/EDHvBb6hB 2 0 0 Weibo.intl [我, 以后, 再也, 不, 相信, 女, 的, 不会, 秃顶, 这种, 屁话, 了, 。,... [20, 563, 2919, 19, 702, 807, 1, 236, 42043, 2... [125790, 5, 3, 7, 98264, 241, 42043, 236, 1, 8...
2 2077341 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130788 护肤然后害熬夜 是不是有病啊 ​ 2017-04-09 04:01:35 +0800 http://weibo.com/2076419035/EDDEr4Iz5 1 1 0 Weibo.intl [护肤, 然后, 害, 熬夜, , 是不是, 有病, 啊, , ​] [2426, 372, 5979, 4361, 5, 854, 0, 332, 5, 125... [125790, 5, 332, 0, 854, 5, 4361, 5979, 372, 2...
3 2077342 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130788 现在竟然还有这个 我感觉这个是卖烤冷面的大爷用来呲水的 ​ 2017-04-08 12:39:10 +0800 http://weibo.com/2076419035/EDxC1wPvC 3 1 0 Weibo.intl [现在, 竟然, 还有, 这个, , 我, 感觉, 这个, 是, 卖, 烤, 冷面, 的,... [199, 2191, 230, 101, 5, 20, 393, 101, 6, 1012... [125790, 5, 1, 281, 44042, 2227, 8540, 1, 3041...
4 2077343 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130788 他走得好慢,好驼,好弱。好苦。\n我看着他过马路,既为他担心,也觉得那样缓慢孤独被遗弃的命运... 2017-04-06 23:49:40 +0800 http://weibo.com/2076419035/EDj9cc4vm 0 3 0 Weibo.intl [他, 走, 得, 好慢, ,, 好, 驼, ,, 好弱, 。, 好苦, 。, \n, 我,... [39, 261, 127, 0, 0, 58, 28550, 0, 0, 3, 0, 3,... [125790, 5, 3, 379, 1, 2861, 42, 75, 0, 2833, ...
5 2077344 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130788 我估计是我天天想着为啥我这么倒霉然后我就倒霉了。以后我要天天高歌我真幸运!我真幸运! ​ 2017-04-04 17:31:54 +0800 http://weibo.com/2076419035/ECXORjMev 2 0 0 Weibo.intl [我, 估计, 是, 我, 天天, 想着, 为啥, 我, 这么, 倒霉, 然后, 我, 就,... [20, 3642, 6, 20, 2026, 3980, 7967, 20, 411, 1... [125790, 5, 18, 3337, 704, 20, 18, 3337, 704, ...
6 2077345 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130788 为啥出租车要按公里算钱呢?按时间算是不能走的快点儿?? ​ 2017-04-04 17:18:57 +0800 http://weibo.com/2076419035/ECXJBnX1N 5 0 0 Weibo.intl [为啥, 出租车, 要, 按, 公里, 算钱, 呢, ?, 按, 时间, 算是, 不能, 走... [7967, 5287, 31, 112, 1259, 0, 179, 36, 112, 1... [125790, 5, 36, 36, 103617, 1, 261, 182, 3704,...
7 2077346 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130788 东北一家人太好看了!!!大家快追起来!! ​ 2017-04-04 15:12:20 +0800 http://weibo.com/2076419035/ECWUd9Hxl 4 0 0 Weibo.intl [东北, 一家人, 太, 好看, 了, !, !, !, 大家, 快追, 起来, !, !,... [3184, 6477, 217, 2412, 7, 18, 18, 18, 151, 27... [125790, 5, 18, 18, 311, 275007, 151, 18, 18, ...
8 2077347 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130788 我喜欢的表情的排名\n1号可爱表情:[熊猫]2:[兔子]3:[羞嗒嗒]4:[傻眼] ​ 2017-04-04 00:40:31 +0800 http://weibo.com/2076419035/ECRcl7C59 4 0 0 Weibo.intl [我, 喜欢, 的, 表情, 的, 排名, \n, 1, 号, 可爱, 表情, :, [, ... [20, 233, 1, 3478, 1, 2431, 2, 44, 190, 2001, ... [125790, 5, 1152, 35844, 1149, 47, 99, 1152, 6...
9 2077348 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130788 我好朋友真的讲话都挺厉害的还。我记得我高中去看他辩论会的时候,同学A举起两张白纸说:假设这是... 2017-04-04 00:30:28 +0800 http://weibo.com/2076419035/ECR8ganjm 2 0 0 Weibo.intl [我, 好, 朋友, 真的, 讲话, 都, 挺, 厉害, 的, 还, 。, 我, 记得, 我... [20, 58, 215, 474, 3287, 24, 1992, 3191, 1, 65... [125790, 5, 3, 158, 78, 20, 6, 25185, 0, 11626...
10 2077349 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130788 我贼喜欢给我喜欢的博主发[熊猫]这个表情。就是咋的呢 觉得你在我心中的可爱程度已经超越国宝了。 ​ 2017-04-03 23:31:27 +0800 http://weibo.com/2076419035/ECQKj1jcZ 0 0 0 Weibo.intl [我贼, 喜欢, 给, 我, 喜欢, 的, 博主发, [, 熊猫, ], 这个, 表情, 。... [0, 233, 88, 20, 233, 1, 0, 1149, 9320, 1152, ... [125790, 5, 3, 7, 20851, 3253, 156, 940, 2001,...
11 2077351 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130788 人际交往太复杂了。面儿上互相点赞 心里说不定互相拉黑几百遍了呢。 ​ 2017-04-03 21:58:46 +0800 http://weibo.com/2076419035/ECQ8Grxi9 3 1 1 Weibo.intl [人际交往, 太, 复杂, 了, 。, 面儿, 上, 互相, 点赞, , 心里, 说不定,... [15109, 217, 1975, 7, 3, 0, 33, 3077, 0, 5, 11... [125790, 5, 3, 179, 7, 154914, 24628, 3077, 78...
12 2077352 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130788 告诉大家一个秘密:摩登家庭改名叫停播伐木累在A站悄悄更新! ​ 2017-04-02 22:08:42 +0800 http://weibo.com/2076419035/ECGMe8Gk5 0 3 1 Weibo.intl [告诉, 大家, 一个, 秘密, :, 摩登, 家庭, 改名, 叫, 停播, 伐木, 累, ... [509, 151, 35, 2857, 8, 18997, 470, 14469, 480... [125790, 5, 18, 2282, 6968, 562, 631, 9, 1644,...
13 2077353 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130788 好看的东西 什么都好 就是贵点,可不好看的东西除了便宜,一无是处。 ​ 2017-04-01 09:22:58 +0800 http://weibo.com/2076419035/ECskUvfmF 0 0 0 Weibo.intl [好看, 的, 东西, , 什么, 都, 好, , 就是, 贵点, ,, 可不, 好看,... [2412, 1, 408, 5, 123, 24, 58, 5, 76, 87621, 0... [125790, 5, 3, 33477, 0, 2653, 565, 408, 1, 24...
14 2077354 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130788 给我推荐的这是个什么玩意儿??? ​ 2017-04-01 09:12:58 +0800 http://weibo.com/2076419035/ECsgRjRiw 1 0 0 Weibo.intl [给, 我, 推荐, 的, 这, 是, 个, 什么, 玩意儿, ?, ?, ?, , ​] [88, 20, 522, 1, 37, 6, 89, 123, 27291, 36, 36... [125790, 5, 36, 36, 36, 27291, 123, 89, 6, 37,...
15 2077355 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130788 英语课你划我猜\n同学A:Monday Tuesday Wednesday...(趁老师不注... 2017-03-29 14:31:47 +0800 http://weibo.com/2076419035/EC24M1ztz 1 0 0 Weibo.intl [英语课, 你划, 我, 猜, \n, 同学, A, :, Monday, , Tuesd... [49910, 0, 20, 4823, 2, 542, 631, 8, 62635, 5,... [125790, 5, 36, 36, 36, 332, 88711, 2202, 6, 1...
16 2077356 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130788 二月春风似剪刀这诗在东北有些地方它是不成立的,因为快他妈四月了,春风害跟剪刀一样,piapi... 2017-03-29 09:01:13 +0800 http://weibo.com/2076419035/EBZUB1az2 5 2 0 Weibo.intl [二月, 春风, 似, 剪刀, 这诗, 在, 东北, 有些, 地方, 它, 是, 不, 成立... [15417, 11929, 3555, 11614, 0, 9, 3184, 513, 3... [125790, 5, 3, 0, 187649, 0, 258, 11614, 279, ...
17 2077357 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130788 今天早上我收作业的时候,我班一个男的没有写,然后就打算从我收的作业里拍个照。结果老师一直盯着... 2017-03-28 23:09:09 +0800 http://weibo.com/2076419035/EBW2h8vK6 10 1 0 Weibo.intl [今天, 早上, 我收, 作业, 的, 时候, ,, 我班, 一个, 男, 的, 没有, 写... [335, 1826, 0, 1716, 1, 138, 0, 0, 35, 1076, 1... [125790, 5, 25, 40760, 4309, 446, 14210, 1, 27...
18 2077358 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130788 今天我班一个男的 给我俩芒果说:给你俩橙子。我:它基因突变了??? ​ 2017-03-28 19:06:01 +0800 http://weibo.com/2076419035/EBUrAl9oh 2 2 0 Weibo.intl [今天, 我班, 一个, 男, 的, , 给, 我俩, 芒果, 说, :, 给, 你, 俩... [335, 0, 35, 1076, 1, 5, 88, 20091, 9497, 49, ... [125790, 5, 36, 36, 36, 7, 43537, 149, 8, 20, ...
19 2077359 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130788 现在这感冒药是真上头啊 吃上不到俩点儿我就困的天外飞仙了。 ​ 2017-03-26 23:15:56 +0800 http://weibo.com/2076419035/EBDe2dYRh 0 1 0 Weibo.intl [现在, 这, 感冒药, 是, 真, 上头, 啊, , 吃, 上, 不到, 俩, 点儿, ... [199, 37, 13532, 6, 704, 33807, 332, 5, 145, 3... [125790, 5, 3, 7, 141390, 1, 6695, 23, 20, 872...
20 2077360 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130788 分享单曲http://t.cn/R6xMTyX (@网易云音乐 ) ​ 2017-03-26 10:11:53 +0800 http://weibo.com/2076419035/EBy5N0gEc 0 0 0 网易云音乐 [分享, 单曲, http, :, /, /, t, ., cn, /, R6xMTyX, ... [277, 25860, 1331, 47, 67, 67, 3408, 12, 2041,... [125790, 5, 25, 5, 894, 994, 12270, 611, 26, 5...
21 2077361 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130788 现在婚纱照拍的都太正式了 我结婚的时候想整套表情包的! ​ 2017-03-25 23:16:45 +0800 http://weibo.com/2076419035/EBtNS15NN 0 2 0 Weibo.intl [现在, 婚纱照, 拍, 的, 都, 太, 正式, 了, , 我, 结婚, 的, 时候, ... [199, 15787, 1059, 1, 24, 217, 930, 7, 5, 20, ... [125790, 5, 18, 1, 1198, 3478, 23332, 117, 138...
22 2077362 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130788 第988543955679次奶茶洒鞋上[哼] ​ 2017-03-24 15:53:47 +0800 http://weibo.com/2076419035/EBhtztpRz 3 2 0 Weibo.intl [第, 988543955679, 次, 奶茶, 洒鞋, 上, [, 哼, ], , ​] [558, 0, 678, 11963, 0, 33, 1149, 12926, 1152,... [125790, 5, 1152, 12926, 1149, 33, 0, 11963, 6...
23 2077363 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130788 wo艹 我今天才知道 周一的时候白敬亭竟然来我们学校了 ​ 2017-03-23 22:57:20 +0800 http://weibo.com/2076419035/EBaOZzA5m 0 0 0 Weibo.intl [wo, 艹, , 我, 今天, 才, 知道, , 周一, 的, 时候, 白敬亭, 竟然... [16565, 79477, 5, 20, 335, 161, 169, 5, 4174, ... [125790, 5, 7, 394, 30, 70, 2191, 0, 138, 1, 4...
24 2077364 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130788 笑晕过去了 ​ 2017-03-23 17:34:56 +0800 http://weibo.com/2076419035/EB8I8if9n 4 3 0 Weibo.intl [笑, 晕过去, 了, , ​] [1098, 81671, 7, 5, 125790, 0, 0, 0, 0, 0, 0, ... [125790, 5, 7, 81671, 1098, 0, 0, 0, 0, 0, 0, ...
25 2077365 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130788 我同学真情演绎大树 我感动的留下了泪水 拍照都手抖了 ​ 2017-03-21 15:11:04 +0800 http://weibo.com/2076419035/EAOUKdbdp 0 2 0 Weibo.intl [我, 同学, 真情, 演绎, 大树, , 我, 感动, 的, 留下, 了, 泪水, ,... [20, 542, 8417, 5260, 10841, 5, 20, 2370, 1, 1... [125790, 5, 7, 57509, 24, 3549, 5, 8511, 7, 14...
26 2077366 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130788 我决定用激将法上课学习了!举例:我上课一定得玩手机!我百分百玩手机!矮砍玩手机! ​ 2017-03-20 14:37:00 +0800 http://weibo.com/2076419035/EAFgq9aCm 0 2 0 Weibo.intl [我, 决定, 用, 激将法, 上课, 学习, 了, !, 举例, :, 我, 上课, 一定... [20, 548, 79, 115298, 3054, 166, 7, 18, 12119,... [125790, 5, 18, 446, 711, 10023, 9946, 18, 446...
27 2077367 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130788 分享一个却黑! ​ 2017-03-19 22:53:09 +0800 http://weibo.com/2076419035/EAz5jh5Xt 0 1 0 Weibo.intl [分享, 一个, 却, 黑, !, , ​] [277, 35, 196, 1233, 18, 5, 125790, 0, 0, 0, 0... [125790, 5, 18, 1233, 196, 35, 277, 0, 0, 0, 0...
28 2077368 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130788 我从3点多开始 一口气睡到现在 。完了 饭都不能吃就得飞奔去上晚自习了。我63 的老年大学果... 2017-03-19 18:31:36 +0800 http://weibo.com/2076419035/EAxn9ev1D 0 0 0 Weibo.intl [我, 从, 3, 点多, 开始, , 一口气, 睡, 到, 现在, , 。, 完, 了... [20, 94, 60, 0, 154, 5, 8997, 1370, 41, 199, 5... [125790, 5, 3, 33, 830, 5953, 36268, 1, 5, 578...
29 2077369 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130788 淘宝给我推荐了这个! hhhhhh我真的破口大笑了! ​ 2017-03-19 15:07:08 +0800 http://weibo.com/2076419035/EAw29urT2 4 2 0 Weibo.intl [淘宝, 给, 我, 推荐, 了, 这个, !, , hhhhhh, 我, 真的, 破口,... [2518, 88, 20, 522, 7, 101, 18, 5, 248553, 20,... [125790, 5, 18, 7, 14927, 99859, 474, 20, 2485...
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
9840 2097362 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130980 中午十二点聚餐,我七点就醒了[二哈][二哈]我好困 ​ 2017-01-22 09:06:37 +0800 http://weibo.com/1654489357/ErXK0DoEr 2 0 2 薛之谦送的iPhone [中午, 十二点, 聚餐, ,, 我, 七点, 就, 醒, 了, [, 二哈, ], [, ... [3215, 33464, 12012, 0, 20, 23282, 23, 5114, 7... [125790, 5, 120611, 20, 1152, 0, 1149, 1152, 0...
9841 2097368 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130980 #火星情报局# 一眨眼第二季又要结束了,多少的舍不得@火星情报局 希望被你们抽中一起旅行呀! ​ 2017-01-20 18:32:01 +0800 http://weibo.com/1654489357/ErIAw6dL4 0 1 0 薛之谦送的iPhone [#, 火星, 情报局, #, , 一眨眼, 第二季, 又, 要, 结束, 了, ,, 多... [221, 12669, 72495, 221, 5, 49883, 18610, 108,... [125790, 5, 18, 1630, 1549, 216, 28, 4369, 454...
9842 2097370 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130980 tessdoll奶茶\n从原材料,到外包装,都经过精心取材,精心设计。推广全靠口碑,没有把一... 2017-01-20 13:19:20 +0800 http://weibo.com/1654489357/ErGxB8Exa 0 0 3 薛之谦送的iPhone [tessdoll, 奶茶, \n, 从, 原材料, ,, 到, 外包装, ,, 都, 经过... [0, 11963, 2, 94, 7075, 0, 41, 25620, 0, 24, 6... [125790, 125790, 125790, 5, 8102, 174909, 149,...
9843 2097371 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130980 【初八见】\nTessdoll奶茶是0香精0反式脂肪酸的健康饮品口感丝滑、浓浓的茶香、微甜、... 2017-01-20 13:16:23 +0800 http://weibo.com/1654489357/ErGwp20Qo 0 0 0 薛之谦送的iPhone [【, 初八, 见, 】, \n, Tessdoll, 奶茶, 是, 0, 香精, 0, 反... [119, 32338, 708, 118, 2, 0, 11963, 6, 304, 20... [125790, 5, 3541, 5320, 0, 16487, 49, 24, 0, 7...
9844 2097372 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130980 有你真好! ​ 2017-01-19 23:27:19 +0800 http://weibo.com/1654489357/ErB5SAued 0 0 2 薛之谦送的iPhone [有, 你, 真, 好, !, , ​] [16, 15, 704, 58, 18, 5, 125790, 0, 0, 0, 0, 0... [125790, 5, 18, 58, 704, 15, 16, 0, 0, 0, 0, 0...
9845 2097373 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130980 偶尔装装可爱[哈哈][哈哈][哈哈][哈哈][哈哈] ​ 2017-01-19 16:51:44 +0800 http://weibo.com/1654489357/Eryvjso48 0 0 2 薛之谦送的iPhone [偶尔, 装装, 可爱, [, 哈哈, ], [, 哈哈, ], [, 哈哈, ], [, ... [3350, 99370, 2001, 1149, 5655, 1152, 1149, 56... [125790, 5, 1152, 5655, 1149, 1152, 5655, 1149...
9846 2097375 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130980 保养的路上从来没停歇! ​ 2017-01-19 10:51:14 +0800 http://weibo.com/1654489357/Erw8ZeMMG 0 0 2 薛之谦送的iPhone [保养, 的, 路上, 从来, 没, 停歇, !, , ​] [1525, 1, 1379, 2988, 193, 21431, 18, 5, 12579... [125790, 5, 18, 21431, 193, 2988, 1379, 1, 152...
9847 2097378 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130980 #美图秀秀手绘# 果然了不起啊! ​ 2017-01-18 14:38:26 +0800 http://weibo.com/1654489357/ErocIdVt0 0 0 2 薛之谦送的iPhone [#, 美图秀, 秀, 手绘, #, , 果然, 了不起, 啊, !, , ​] [221, 0, 1901, 12817, 221, 5, 5953, 10572, 332... [125790, 5, 18, 332, 10572, 5953, 5, 221, 1281...
9848 2097379 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130980 【轻氧燕窝】\n不美颜也要出镜,\n努力做一个不美颜的仙女!\n(图三无美颜) ​ 2017-01-18 14:18:35 +0800 http://weibo.com/1654489357/Ero4EvI1L 0 0 1 薛之谦送的iPhone [【, 轻氧, 燕窝, 】, \n, 不, 美颜, 也, 要, 出镜, ,, \n, 努力,... [119, 0, 9758, 118, 2, 19, 13195, 22, 31, 2782... [125790, 5, 25, 13195, 0, 286, 26, 2, 18, 1702...
9849 2097385 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130980 【轻氧燕窝】\n今天你喝了嘛? ​ 2017-01-17 13:54:22 +0800 http://weibo.com/1654489357/EreukkneE 0 0 1 薛之谦送的iPhone [【, 轻氧, 燕窝, 】, \n, 今天, 你, 喝, 了, 嘛, ?, , ​] [119, 0, 9758, 118, 2, 335, 15, 634, 7, 2974, ... [125790, 5, 36, 2974, 7, 634, 15, 335, 2, 118,...
9850 2097387 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130980 【轻氧燕窝】\n睡前喝一瓶,\n十年后仍貌美如花,\n你依然爱我不变![偷笑][偷笑] ​​​ 2017-01-17 01:27:33 +0800 http://weibo.com/1654489357/Er9Bc9l52 0 0 1 薛之谦送的iPhone [【, 轻氧, 燕窝, 】, \n, 睡前, 喝, 一瓶, ,, \n, 十年, 后, 仍,... [119, 0, 9758, 118, 2, 4800, 634, 6636, 0, 2, ... [125790, 125790, 125790, 5, 1152, 43884, 1149,...
9851 2097392 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130981 注会开始报名了。我想先报两三门试试手,犹豫报两门还是三门,毕竟报名费也不少嘛。lo问你啥时候... 2017-04-05 18:49:26 +0800 http://weibo.com/1771477130/ED7KPjBI6 1 4 0 iPhone 7 Plus [注, 会, 开始, 报名, 了, 。, 我想, 先报, 两, 三门, 试试, 手, ,, ... [2123, 27, 154, 366, 7, 3, 0, 0, 459, 24698, 3... [125790, 5, 100, 100, 8, 20, 11, 3, 73, 3873, ...
9852 2097395 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130981 我跟lo说昨天买花了55,今天买又花了30,感觉自己太能花钱了。我lo回道,你比昨天还省了2... 2017-04-02 15:56:06 +0800 http://weibo.com/1771477130/ECEkZ2oyu 2 2 0 iPhone 7 Plus [我, 跟, lo, 说, 昨天, 买花, 了, 55, ,, 今天, 买, 又, 花, 了... [20, 279, 37971, 49, 2317, 0, 7, 2866, 0, 335,... [125790, 5, 3, 6947, 58, 42, 301, 0, 75471, 57...
9853 2097398 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130981 如果法律不能让人民感到安全,那么这法律就是用来羞辱人民的。『"辱母杀人案"网友:法律不能保护... 2017-03-25 21:25:12 +0800 http://weibo.com/1771477130/EBt4AxZF7 0 0 0 iPhone 7 Plus [如果, 法律, 不能, 让, 人民, 感到, 安全, ,, 那么, 这, 法律, 就是, ... [93, 891, 182, 48, 974, 1351, 354, 0, 231, 37,... [125790, 5, 0, 67, 0, 67, 2041, 12, 19874, 12,...
9854 2097403 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130981 【2005年】《抢救切尔诺贝利》【Discovery Networks】#哔哩哔哩动画# h... 2017-03-17 13:41:17 +0800 http://weibo.com/1771477130/EAcCk3w3M 0 0 0 哔哩哔哩 [【, 2005, 年, 】, 《, 抢救, 切尔诺贝利, 》, 【, Discovery,... [119, 4952, 77, 118, 57, 8443, 129915, 56, 119... [125790, 5, 0, 67, 2041, 12, 3408, 67, 67, 47,...
9855 2097405 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130981 离别日,☔️ ​ 2017-03-12 14:07:27 +0800 http://weibo.com/1771477130/EzrEs9jIx 0 0 0 iPhone 7 Plus [离别, 日, ,, ☔, ️, , ​] [17782, 66, 0, 194223, 8102, 5, 125790, 0, 0, ... [125790, 5, 8102, 194223, 0, 66, 17782, 0, 0, ...
9856 2097409 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130981 Goodbye,Maki. ​ 2017-03-08 21:58:47 +0800 http://weibo.com/1771477130/EyT1MpCgJ 0 0 0 iPhone 7 Plus [Goodbye, ,, Maki, ., , ​] [108888, 63, 300836, 12, 5, 125790, 0, 0, 0, 0... [125790, 5, 12, 300836, 63, 108888, 0, 0, 0, 0...
9857 2097412 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130981 每次来就跟打仗一样 ​ 2017-02-19 09:28:27 +0800 http://weibo.com/1771477130/EwdQLELdH 0 0 0 iPhone 7 Plus [每次, 来, 就, 跟, 打仗, 一样, , ​] [1173, 70, 23, 279, 16598, 258, 5, 125790, 0, ... [125790, 5, 258, 16598, 279, 23, 70, 1173, 0, ...
9858 2097413 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130981 #微博益起来#已捐,也希望有更多的人伸出援助之手 我分享了http://t.cn/RJQ3A... 2017-02-17 21:16:01 +0800 http://weibo.com/1771477130/EvZCZhzjA 0 0 0 iPhone 7 Plus [#, 微博益, 起来, #, 已, 捐, ,, 也, 希望, 有, 更, 多, 的, 人,... [221, 0, 311, 221, 235, 14035, 0, 22, 351, 16,... [125790, 5, 0, 67, 2041, 12, 3408, 67, 67, 47,...
9859 2097414 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130981 我刚刚为“山东八岁女孩为捐髓救母增肥”献出了自己的爱心,每份微小的善举都能凝聚无限能量,共同... 2017-02-17 21:12:12 +0800 http://weibo.com/1771477130/EvZBrdPk2 0 0 0 微公益 [我, 刚刚, 为, “, 山东, 八岁, 女孩, 为, 捐髓, 救母, 增肥, ”, 献出... [20, 2188, 29, 10, 2077, 37421, 1836, 29, 2133... [125790, 5, 0, 67, 2041, 12, 3408, 67, 67, 47,...
9860 2097415 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130981 看到这样的公益项目,我忍不住要支持一把了,一起帮助“山东八岁女孩为捐髓救母增肥(http:/... 2017-02-17 21:12:09 +0800 http://weibo.com/1771477130/EvZBq1w2o 0 0 0 微公益 [看到, 这样, 的, 公益, 项目, ,, 我, 忍不住, 要, 支持, 一把, 了, ,... [278, 131, 1, 1983, 213, 0, 20, 4897, 31, 533,... [125790, 5, 3, 538, 1344, 13950, 0, 11, 25, 0,...
9861 2097423 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130981 赠人玫瑰,手有余香。宁愿把捐给有困难的人,也不愿给那些无厘头叫嚣要抢红包的闲人。 ​ 2017-02-05 08:57:43 +0800 http://weibo.com/1771477130/Eu5FlF1cm 0 0 0 iPhone 7 Plus [赠人, 玫瑰, ,, 手有余香, 。, 宁愿, 把, 捐给, 有, 困难, 的, 人, ,... [0, 4901, 0, 36408, 3, 9341, 86, 37528, 16, 13... [125790, 5, 3, 35982, 1, 16753, 31, 43948, 394...
9862 2097424 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130981 独处守住心,群处守住嘴 ​ 2017-02-03 11:36:56 +0800 http://weibo.com/1771477130/EtNQZbHBP 0 1 0 iPhone 7 Plus [独处, 守住, 心, ,, 群处, 守, 住嘴, , ​] [14225, 14846, 262, 0, 0, 4176, 118868, 5, 125... [125790, 5, 118868, 4176, 0, 0, 262, 14846, 14...
9863 2097425 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130981 wishes about dad,mom,him and me ​ 2017-01-27 23:09:57 +0800 http://weibo.com/1771477130/EsOoOmQBP 0 0 0 iPhone 7 Plus [wishes, , about, , dad, ,, mom, ,, him, , ... [132513, 5, 11913, 5, 120874, 63, 96959, 63, 2... [125790, 5, 7643, 5, 1298, 5, 23641, 63, 96959...
9864 2097426 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130981 [蛋糕]mom ​ 2017-01-26 14:58:56 +0800 http://weibo.com/1771477130/EsBL0iT8C 0 1 0 iPhone 7 Plus [[, 蛋糕, ], mom, , ​] [1149, 4264, 1152, 96959, 5, 125790, 0, 0, 0, ... [125790, 5, 96959, 1152, 4264, 1149, 0, 0, 0, ...
9865 2097427 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130981 分享歌词:二嬢二嬢,我穷得响叮当,小嘞时候营养不良,哦oh 卡角生疮。 -来自尧十三的单曲《... 2017-01-25 20:00:00 +0800 http://weibo.com/1771477130/EsuiIs3BK 0 0 0 iPad客户端 [分享, 歌词, :, 二, 嬢, 二, 嬢, ,, 我穷, 得, 响叮当, ,, 小, 嘞... [277, 10079, 8, 263, 81407, 263, 81407, 0, 0, ... [125790, 5, 105, 894, 994, 12270, 611, 113, 5,...
9866 2097428 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130981 逼哥的歌,越听越耐听。 ​ 2017-01-25 19:52:05 +0800 http://weibo.com/1771477130/Esufv0Rpt 0 0 0 iPad客户端 [逼哥, 的, 歌, ,, 越, 听, 越, 耐, 听, 。, , ​] [221421, 1, 2505, 0, 353, 502, 353, 7490, 502,... [125790, 5, 3, 502, 7490, 353, 502, 353, 0, 25...
9867 2097429 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130981 来自网易云音乐•歌词分享 ​ 2017-01-23 21:22:29 +0800 http://weibo.com/1771477130/EsbZciimP 0 0 0 网易云音乐 [来自, 网易, 云, 音乐, •, 歌词, 分享, , ​] [580, 12270, 994, 894, 1438, 10079, 277, 5, 12... [125790, 5, 277, 10079, 1438, 894, 994, 12270,...
9868 2097431 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130981 http://t.cn/RxhBJef ​ 2017-01-21 21:31:25 +0800 http://weibo.com/1771477130/ErTbPvKza 0 0 0 手机百度客户端 [http, :, /, /, t, ., cn, /, RxhBJef, , ​] [1331, 47, 67, 67, 3408, 12, 2041, 67, 0, 5, 1... [125790, 5, 0, 67, 2041, 12, 3408, 67, 67, 47,...
9869 2097432 37 美素化妆品_170411 37_5 倩碧_消费者用户微博原创 130981 DAY 1 ​ 2017-01-14 22:50:07 +0800 http://weibo.com/1771477130/EqPIiu5Qe 1 0 0 iPhone 7 Plus [DAY, , 1, , ​] [29903, 5, 44, 5, 125790, 0, 0, 0, 0, 0, 0, 0,... [125790, 5, 44, 5, 29903, 0, 0, 0, 0, 0, 0, 0,...

9870 rows × 16 columns


In [59]:
rev_trans_dict = load(open('/home/jeffmxh/rnn_test/models/bi_trans_dict.pickle','rb'))

In [62]:
from keras.models import Sequential, load_model, model_from_json

print('data ready. begin predicting.')
# model = load_model('Bi_lstm_senti_0406_improve_loss_post.h5')
with open('/home/jeffmxh/rnn_test/models/combine_emo_GRU_senti_0420.json', 'rt') as f:
    json_string=f.read()
model = model_from_json(json_string)
model.load_weights('/home/jeffmxh/rnn_test/models/combine_emo_LSTM_senti_0420_weights.h5')

pred_x = np.array(list(comment['sent']))
pred_y = model.predict(pred_x)
comment['mark']=list(pred_y)
comment.loc[0:5,['content','mark']]


data ready. begin predicting.
Out[62]:
content mark
0 这么小的一个电阻 510欧! ​ [0.531539, 0.0223912, 0.191103, 0.0218594, 0.0...
1 我以后再也不相信女的不会秃顶这种屁话了。 ​ [0.0980624, 0.215746, 0.0409109, 0.0103792, 0....
2 护肤然后害熬夜 是不是有病啊 ​ [0.191436, 0.184627, 0.0376403, 0.00470487, 0....
3 现在竟然还有这个 我感觉这个是卖烤冷面的大爷用来呲水的 ​ [0.0629487, 0.0226193, 0.102648, 0.088204, 0.0...
4 他走得好慢,好驼,好弱。好苦。\n我看着他过马路,既为他担心,也觉得那样缓慢孤独被遗弃的命运... [0.826319, 0.00783627, 0.0649442, 0.00315705, ...
5 我估计是我天天想着为啥我这么倒霉然后我就倒霉了。以后我要天天高歌我真幸运!我真幸运! ​ [0.0322943, 0.113635, 0.0139241, 0.00496496, 0...

In [79]:
def emotion_list_decoder(emo_index):
    emotion_index = emo_index[2:]
    emo_reverse_dict = dict(zip(range(8), ['none', 'disgust', 'like', 'happiness', 'sadness', 'surprise', 'anger', 'fear']))
    emo_list = []
    for i in range(len(emotion_index)):
        if emotion_index[i]=='1':
            emo_list.append(emo_reverse_dict[i])
    return emo_list
def result_translate(prob_list):
    sign_dict = dict(zip(prob_list, rev_trans_dict.values()))
    result_emotion_code = sign_dict[max(prob_list)]
    return emotion_list_decoder(result_emotion_code)

comment['emotion_result'] = comment['mark'].apply(result_translate)
comment = comment.loc[:,['content','emotion_result']]
comment
#result_translate(comment.mark[3])


Out[79]:
content emotion_result
0 这么小的一个电阻 510欧! ​ [none]
1 我以后再也不相信女的不会秃顶这种屁话了。 ​ [none, anger]
2 护肤然后害熬夜 是不是有病啊 ​ [none, anger]
3 现在竟然还有这个 我感觉这个是卖烤冷面的大爷用来呲水的 ​ [none, happiness]
4 他走得好慢,好驼,好弱。好苦。\n我看着他过马路,既为他担心,也觉得那样缓慢孤独被遗弃的命运... [none]
5 我估计是我天天想着为啥我这么倒霉然后我就倒霉了。以后我要天天高歌我真幸运!我真幸运! ​ [none, anger]
6 为啥出租车要按公里算钱呢?按时间算是不能走的快点儿?? ​ [none, disgust]
7 东北一家人太好看了!!!大家快追起来!! ​ [none, like]
8 我喜欢的表情的排名\n1号可爱表情:[熊猫]2:[兔子]3:[羞嗒嗒]4:[傻眼] ​ [none, happiness]
9 我好朋友真的讲话都挺厉害的还。我记得我高中去看他辩论会的时候,同学A举起两张白纸说:假设这是... [none]
10 我贼喜欢给我喜欢的博主发[熊猫]这个表情。就是咋的呢 觉得你在我心中的可爱程度已经超越国宝了。 ​ [none, like]
11 人际交往太复杂了。面儿上互相点赞 心里说不定互相拉黑几百遍了呢。 ​ [none]
12 告诉大家一个秘密:摩登家庭改名叫停播伐木累在A站悄悄更新! ​ [none]
13 好看的东西 什么都好 就是贵点,可不好看的东西除了便宜,一无是处。 ​ [none, like]
14 给我推荐的这是个什么玩意儿??? ​ [none, anger]
15 英语课你划我猜\n同学A:Monday Tuesday Wednesday...(趁老师不注... [none]
16 二月春风似剪刀这诗在东北有些地方它是不成立的,因为快他妈四月了,春风害跟剪刀一样,piapi... [none]
17 今天早上我收作业的时候,我班一个男的没有写,然后就打算从我收的作业里拍个照。结果老师一直盯着... [none]
18 今天我班一个男的 给我俩芒果说:给你俩橙子。我:它基因突变了??? ​ [none]
19 现在这感冒药是真上头啊 吃上不到俩点儿我就困的天外飞仙了。 ​ [none]
20 分享单曲http://t.cn/R6xMTyX (@网易云音乐 ) ​ [none]
21 现在婚纱照拍的都太正式了 我结婚的时候想整套表情包的! ​ [none, happiness]
22 第988543955679次奶茶洒鞋上[哼] ​ [none]
23 wo艹 我今天才知道 周一的时候白敬亭竟然来我们学校了 ​ [none, surprise]
24 笑晕过去了 ​ [none, happiness]
25 我同学真情演绎大树 我感动的留下了泪水 拍照都手抖了 ​ [none, happiness]
26 我决定用激将法上课学习了!举例:我上课一定得玩手机!我百分百玩手机!矮砍玩手机! ​ [none]
27 分享一个却黑! ​ [none]
28 我从3点多开始 一口气睡到现在 。完了 饭都不能吃就得飞奔去上晚自习了。我63 的老年大学果... [none]
29 淘宝给我推荐了这个! hhhhhh我真的破口大笑了! ​ [none, happiness]
... ... ...
9840 中午十二点聚餐,我七点就醒了[二哈][二哈]我好困 ​ [none, happiness]
9841 #火星情报局# 一眨眼第二季又要结束了,多少的舍不得@火星情报局 希望被你们抽中一起旅行呀! ​ [none, happiness]
9842 tessdoll奶茶\n从原材料,到外包装,都经过精心取材,精心设计。推广全靠口碑,没有把一... [none]
9843 【初八见】\nTessdoll奶茶是0香精0反式脂肪酸的健康饮品口感丝滑、浓浓的茶香、微甜、... [none, like]
9844 有你真好! ​ [none, like]
9845 偶尔装装可爱[哈哈][哈哈][哈哈][哈哈][哈哈] ​ [none, happiness]
9846 保养的路上从来没停歇! ​ [none]
9847 #美图秀秀手绘# 果然了不起啊! ​ [none, happiness]
9848 【轻氧燕窝】\n不美颜也要出镜,\n努力做一个不美颜的仙女!\n(图三无美颜) ​ [none]
9849 【轻氧燕窝】\n今天你喝了嘛? ​ [none]
9850 【轻氧燕窝】\n睡前喝一瓶,\n十年后仍貌美如花,\n你依然爱我不变![偷笑][偷笑] ​​​ [none, happiness]
9851 注会开始报名了。我想先报两三门试试手,犹豫报两门还是三门,毕竟报名费也不少嘛。lo问你啥时候... [none, surprise]
9852 我跟lo说昨天买花了55,今天买又花了30,感觉自己太能花钱了。我lo回道,你比昨天还省了2... [none]
9853 如果法律不能让人民感到安全,那么这法律就是用来羞辱人民的。『"辱母杀人案"网友:法律不能保护... [none, disgust]
9854 【2005年】《抢救切尔诺贝利》【Discovery Networks】#哔哩哔哩动画# h... [none]
9855 离别日,☔️ ​ [none, sadness]
9856 Goodbye,Maki. ​ [none]
9857 每次来就跟打仗一样 ​ [none]
9858 #微博益起来#已捐,也希望有更多的人伸出援助之手 我分享了http://t.cn/RJQ3A... [none, happiness]
9859 我刚刚为“山东八岁女孩为捐髓救母增肥”献出了自己的爱心,每份微小的善举都能凝聚无限能量,共同... [none, like]
9860 看到这样的公益项目,我忍不住要支持一把了,一起帮助“山东八岁女孩为捐髓救母增肥(http:/... [none, like]
9861 赠人玫瑰,手有余香。宁愿把捐给有困难的人,也不愿给那些无厘头叫嚣要抢红包的闲人。 ​ [none]
9862 独处守住心,群处守住嘴 ​ [none]
9863 wishes about dad,mom,him and me ​ [none]
9864 [蛋糕]mom ​ [none]
9865 分享歌词:二嬢二嬢,我穷得响叮当,小嘞时候营养不良,哦oh 卡角生疮。 -来自尧十三的单曲《... [none]
9866 逼哥的歌,越听越耐听。 ​ [none]
9867 来自网易云音乐•歌词分享 ​ [none]
9868 http://t.cn/RxhBJef ​ [none]
9869 DAY 1 ​ [none]

9870 rows × 2 columns


In [81]:
# dump(comment, open('comment_senti_predict.pkl', 'wb'))
print('save result to excel...')
writer = pd.ExcelWriter('37_5predict_emotion.xlsx')
comment.to_excel(writer, sheet_name='senti', encoding = 'utf-8', index = False)
writer.save()
print('task done.')


save result to excel...
task done.