提交 7edf3987 编写于 作者: 片刻小哥哥's avatar 片刻小哥哥

优化格式

上级 6955df04
......@@ -175,6 +175,7 @@
"\n",
"def func(line, ngrams=[]):\n",
" # 加入我们的组合词,保证分词的准确性\n",
" \n",
" if ngrams != []:\n",
" for word in ngrams:\n",
" jieba.add_word(\"\".join(word.lower()))\n",
......@@ -182,8 +183,7 @@
" words = [word for word in jieba.cut(str(line).lower(), cut_all=False)]\n",
" # print(\">>> \", train)\n",
" return \" \".join(words)\n",
"x = df[\"comment\"].apply(lambda line: func(line))\n",
"y"
"x = df[\"comment\"].apply(lambda line: func(line))\n"
]
}
]
......
......@@ -210,4 +210,4 @@ if __name__ == '__main__':
status = True
res = model.predict(text)
label_dic = {0:"消极的", 1:"中性的", 2:"积极的"}
print(res, " : ",label_dic[np.argmax(res)])
print(res, " : ", label_dic[np.argmax(res)])
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册