{"id":172041,"date":"2024-11-07T09:47:22","date_gmt":"2024-11-07T01:47:22","guid":{"rendered":"https:\/\/server.hk\/cnblog\/172041\/"},"modified":"2024-11-07T09:47:22","modified_gmt":"2024-11-07T01:47:22","slug":"%e6%83%85%e6%84%9f%e5%88%86%e6%9e%90%e7%9a%84%e9%87%8d%e8%a6%81%e6%80%a7%ef%bc%9a%e5%9f%ba%e6%96%bc%e6%95%b8%e6%93%9a%e5%ba%ab%e7%9a%84%e6%8a%80%e8%a1%93%e6%87%89%e7%94%a8-%e6%83%85%e6%84%9f%e5%88%86","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/172041\/","title":{"rendered":"\u60c5\u611f\u5206\u6790\u7684\u91cd\u8981\u6027\uff1a\u57fa\u65bc\u6578\u64da\u5eab\u7684\u6280\u8853\u61c9\u7528 (\u60c5\u611f\u5206\u6790 \u6578\u64da\u5eab)"},"content":{"rendered":"<h1 id=\"%e6%83%85%e6%84%9f%e5%88%86%e6%9e%90%e7%9a%84%e9%87%8d%e8%a6%81%e6%80%a7%ef%bc%9a%e5%9f%ba%e6%96%bc%e6%95%b8%e6%93%9a%e5%ba%ab%e7%9a%84%e6%8a%80%e8%a1%93%e6%87%89%e7%94%a8-pcOSJJdiuH\">\u60c5\u611f\u5206\u6790\u7684\u91cd\u8981\u6027\uff1a\u57fa\u65bc\u6578\u64da\u5eab\u7684\u6280\u8853\u61c9\u7528<\/h1>\n<p>\u5728\u7576\u4eca\u6578\u5b57\u5316\u7684\u6642\u4ee3\uff0c\u60c5\u611f\u5206\u6790\uff08Sentiment Analysis\uff09\u5df2\u6210\u70ba\u4f01\u696d\u548c\u7814\u7a76\u4eba\u54e1\u7406\u89e3\u6d88\u8cbb\u8005\u60c5\u7dd2\u548c\u610f\u898b\u7684\u91cd\u8981\u5de5\u5177\u3002\u60c5\u611f\u5206\u6790\u5229\u7528\u81ea\u7136\u8a9e\u8a00\u8655\u7406\uff08NLP\uff09\u3001\u6a5f\u5668\u5b78\u7fd2\u548c\u6578\u64da\u6316\u6398\u6280\u8853\uff0c\u5f9e\u6587\u672c\u6578\u64da\u4e2d\u63d0\u53d6\u60c5\u611f\u4fe1\u606f\u3002\u9019\u4e9b\u4fe1\u606f\u53ef\u4ee5\u5e6b\u52a9\u4f01\u696d\u505a\u51fa\u66f4\u660e\u667a\u7684\u6c7a\u7b56\uff0c\u6539\u5584\u7522\u54c1\u548c\u670d\u52d9\uff0c\u4e26\u589e\u5f37\u5ba2\u6236\u6eff\u610f\u5ea6\u3002<\/p>\n<h2 id=\"%e6%83%85%e6%84%9f%e5%88%86%e6%9e%90%e7%9a%84%e5%9f%ba%e6%9c%ac%e6%a6%82%e5%bf%b5-pcOSJJdiuH\">\u60c5\u611f\u5206\u6790\u7684\u57fa\u672c\u6982\u5ff5<\/h2>\n<p>\u60c5\u611f\u5206\u6790\u7684\u6838\u5fc3\u5728\u65bc\u8b58\u5225\u548c\u63d0\u53d6\u6587\u672c\u4e2d\u7684\u4e3b\u89c0\u4fe1\u606f\u3002\u9019\u4e9b\u4fe1\u606f\u901a\u5e38\u5305\u62ec\u6b63\u9762\u3001\u8ca0\u9762\u6216\u4e2d\u7acb\u7684\u60c5\u611f\u3002\u60c5\u611f\u5206\u6790\u7684\u61c9\u7528\u7bc4\u570d\u5ee3\u6cdb\uff0c\u5f9e\u793e\u4ea4\u5a92\u9ad4\u76e3\u63a7\u5230\u5e02\u5834\u8abf\u67e5\uff0c\u751a\u81f3\u662f\u7522\u54c1\u8a55\u50f9\u5206\u6790\u3002\u901a\u904e\u5206\u6790\u5927\u91cf\u7684\u6578\u64da\uff0c\u4f01\u696d\u53ef\u4ee5\u7372\u5f97\u6709\u95dc\u6d88\u8cbb\u8005\u60c5\u7dd2\u7684\u6df1\u5165\u898b\u89e3\u3002<\/p>\n<h2 id=\"%e6%95%b8%e6%93%9a%e5%ba%ab%e5%9c%a8%e6%83%85%e6%84%9f%e5%88%86%e6%9e%90%e4%b8%ad%e7%9a%84%e8%a7%92%e8%89%b2-pcOSJJdiuH\">\u6578\u64da\u5eab\u5728\u60c5\u611f\u5206\u6790\u4e2d\u7684\u89d2\u8272<\/h2>\n<p>\u6578\u64da\u5eab\u5728\u60c5\u611f\u5206\u6790\u4e2d\u626e\u6f14\u8457\u81f3\u95dc\u91cd\u8981\u7684\u89d2\u8272\u3002\u9996\u5148\uff0c\u6578\u64da\u5eab\u7528\u65bc\u5b58\u5132\u548c\u7ba1\u7406\u5927\u91cf\u7684\u6587\u672c\u6578\u64da\u3002\u9019\u4e9b\u6578\u64da\u53ef\u4ee5\u4f86\u81ea\u793e\u4ea4\u5a92\u9ad4\u3001\u8a55\u8ad6\u7db2\u7ad9\u3001\u8ad6\u58c7\u7b49\u3002\u5176\u6b21\uff0c\u6578\u64da\u5eab\u9084\u53ef\u4ee5\u652f\u6301\u9ad8\u6548\u7684\u67e5\u8a62\u548c\u6578\u64da\u6aa2\u7d22\uff0c\u9019\u5c0d\u65bc\u60c5\u611f\u5206\u6790\u7684\u5be6\u6642\u6027\u81f3\u95dc\u91cd\u8981\u3002<\/p>\n<h3 id=\"%e6%95%b8%e6%93%9a%e5%ba%ab%e7%9a%84%e9%81%b8%e6%93%87-pcOSJJdiuH\">\u6578\u64da\u5eab\u7684\u9078\u64c7<\/h3>\n<p>\u5728\u9078\u64c7\u6578\u64da\u5eab\u6642\uff0c\u4f01\u696d\u9700\u8981\u8003\u616e\u6578\u64da\u7684\u6027\u8cea\u548c\u5206\u6790\u7684\u9700\u6c42\u3002\u95dc\u4fc2\u578b\u6578\u64da\u5eab\uff08\u5982MySQL\u3001PostgreSQL\uff09\u9069\u5408\u7d50\u69cb\u5316\u6578\u64da\u7684\u5b58\u5132\uff0c\u800c\u975e\u95dc\u4fc2\u578b\u6578\u64da\u5eab\uff08\u5982MongoDB\u3001Cassandra\uff09\u5247\u66f4\u9069\u5408\u8655\u7406\u975e\u7d50\u69cb\u5316\u6578\u64da\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u898b\u7684\u6578\u64da\u5eab\u9078\u64c7\uff1a<\/p>\n<ul>\n<li><strong>MySQL\uff1a<\/strong>\u9069\u5408\u5c0f\u578b\u5230\u4e2d\u578b\u61c9\u7528\uff0c\u652f\u6301SQL\u67e5\u8a62\u3002<\/li>\n<li><strong>PostgreSQL\uff1a<\/strong>\u529f\u80fd\u5f37\u5927\uff0c\u652f\u6301\u8907\u96dc\u67e5\u8a62\u548c\u6578\u64da\u985e\u578b\u3002<\/li>\n<li><strong>MongoDB\uff1a<\/strong>\u9069\u5408\u5b58\u5132JSON\u683c\u5f0f\u7684\u975e\u7d50\u69cb\u5316\u6578\u64da\u3002<\/li>\n<li><strong>Cassandra\uff1a<\/strong>\u9069\u5408\u5927\u898f\u6a21\u6578\u64da\u5b58\u5132\uff0c\u5177\u5099\u9ad8\u53ef\u7528\u6027\u3002<\/li>\n<\/ul>\n<h2 id=\"%e6%83%85%e6%84%9f%e5%88%86%e6%9e%90%e7%9a%84%e6%8a%80%e8%a1%93%e5%af%a6%e7%8f%be-pcOSJJdiuH\">\u60c5\u611f\u5206\u6790\u7684\u6280\u8853\u5be6\u73fe<\/h2>\n<p>\u60c5\u611f\u5206\u6790\u7684\u5be6\u73fe\u901a\u5e38\u5305\u62ec\u4ee5\u4e0b\u5e7e\u500b\u6b65\u9a5f\uff1a<\/p>\n<ol>\n<li><strong>\u6578\u64da\u6536\u96c6\uff1a<\/strong>\u5f9e\u5404\u7a2e\u4f86\u6e90\u6536\u96c6\u6587\u672c\u6578\u64da\u3002<\/li>\n<li><strong>\u6578\u64da\u9810\u8655\u7406\uff1a<\/strong>\u6e05\u7406\u548c\u6a19\u6e96\u5316\u6578\u64da\uff0c\u5305\u62ec\u53bb\u9664\u505c\u7528\u8a5e\u3001\u6a19\u9ede\u7b26\u865f\u7b49\u3002<\/li>\n<li><strong>\u7279\u5fb5\u63d0\u53d6\uff1a<\/strong>\u4f7f\u7528\u6280\u8853\u5982TF-IDF\u6216\u8a5e\u5d4c\u5165\uff08Word Embedding\uff09\u5c07\u6587\u672c\u8f49\u63db\u70ba\u6578\u5b57\u7279\u5fb5\u3002<\/li>\n<li><strong>\u6a21\u578b\u8a13\u7df4\uff1a<\/strong>\u4f7f\u7528\u6a5f\u5668\u5b78\u7fd2\u7b97\u6cd5\uff08\u5982\u652f\u6301\u5411\u91cf\u6a5f\u3001\u96a8\u6a5f\u68ee\u6797\u6216\u6df1\u5ea6\u5b78\u7fd2\uff09\u8a13\u7df4\u60c5\u611f\u5206\u985e\u6a21\u578b\u3002<\/li>\n<li><strong>\u60c5\u611f\u9810\u6e2c\uff1a<\/strong>\u5c0d\u65b0\u6578\u64da\u9032\u884c\u60c5\u611f\u9810\u6e2c\uff0c\u4e26\u5c07\u7d50\u679c\u5b58\u5132\u56de\u6578\u64da\u5eab\u3002<\/li>\n<\/ol>\n<h3 id=\"%e7%a4%ba%e4%be%8b%e4%bb%a3%e7%a2%bc-pcOSJJdiuH\">\u793a\u4f8b\u4ee3\u78bc<\/h3>\n<p>\u4ee5\u4e0b\u662f\u4e00\u500b\u4f7f\u7528Python\u548cNLTK\u5eab\u9032\u884c\u60c5\u611f\u5206\u6790\u7684\u7c21\u55ae\u793a\u4f8b\uff1a<\/p>\n<pre><code>\nimport nltk\nfrom nltk.sentiment import SentimentIntensityAnalyzer\n\n# \u521d\u59cb\u5316\u60c5\u611f\u5206\u6790\u5668\nnltk.download('vader_lexicon')\nsia = SentimentIntensityAnalyzer()\n\n# \u5206\u6790\u6587\u672c\ntext = \"\u9019\u662f\u4e00\u500b\u5f88\u68d2\u7684\u7522\u54c1\uff01\"\nscore = sia.polarity_scores(text)\n\nprint(score)\n<\/code><\/pre>\n<p>\u5728\u9019\u500b\u793a\u4f8b\u4e2d\uff0c\u6211\u5011\u4f7f\u7528\u4e86NLTK\u5eab\u4e2d\u7684VADER\u60c5\u611f\u5206\u6790\u5de5\u5177\uff0c\u5c0d\u4e00\u6bb5\u6587\u672c\u9032\u884c\u60c5\u611f\u8a55\u5206\u3002\u7d50\u679c\u5c07\u986f\u793a\u6587\u672c\u7684\u6b63\u9762\u3001\u8ca0\u9762\u548c\u4e2d\u7acb\u60c5\u611f\u5206\u6578\u3002<\/p>\n<h2 id=\"%e6%83%85%e6%84%9f%e5%88%86%e6%9e%90%e7%9a%84%e6%87%89%e7%94%a8%e6%a1%88%e4%be%8b-pcOSJJdiuH\">\u60c5\u611f\u5206\u6790\u7684\u61c9\u7528\u6848\u4f8b<\/h2>\n<p>\u60c5\u611f\u5206\u6790\u5728\u5404\u884c\u5404\u696d\u4e2d\u90fd\u6709\u5ee3\u6cdb\u7684\u61c9\u7528\u3002\u4f8b\u5982\uff1a<\/p>\n<ul>\n<li><strong>\u5e02\u5834\u71df\u92b7\uff1a<\/strong>\u4f01\u696d\u53ef\u4ee5\u901a\u904e\u5206\u6790\u793e\u4ea4\u5a92\u9ad4\u4e0a\u7684\u6d88\u8cbb\u8005\u53cd\u994b\uff0c\u8abf\u6574\u71df\u92b7\u7b56\u7565\u3002<\/li>\n<li><strong>\u7522\u54c1\u958b\u767c\uff1a<\/strong>\u901a\u904e\u5206\u6790\u7528\u6236\u8a55\u50f9\uff0c\u4f01\u696d\u53ef\u4ee5\u8b58\u5225\u7522\u54c1\u7684\u512a\u7f3a\u9ede\uff0c\u9032\u884c\u6539\u9032\u3002<\/li>\n<li><strong>\u5ba2\u6236\u670d\u52d9\uff1a<\/strong>\u60c5\u611f\u5206\u6790\u53ef\u4ee5\u5e6b\u52a9\u5ba2\u670d\u5718\u968a\u8b58\u5225\u4e0d\u6eff\u610f\u7684\u5ba2\u6236\uff0c\u53ca\u6642\u9032\u884c\u5e72\u9810\u3002<\/li>\n<\/ul>\n<h2 id=\"%e7%b8%bd%e7%b5%90-pcOSJJdiuH\">\u7e3d\u7d50<\/h2>\n<p>\u60c5\u611f\u5206\u6790\u4f5c\u70ba\u4e00\u7a2e\u5f37\u5927\u7684\u6578\u64da\u5206\u6790\u5de5\u5177\uff0c\u80fd\u5920\u5e6b\u52a9\u4f01\u696d\u6df1\u5165\u4e86\u89e3\u6d88\u8cbb\u8005\u7684\u60c5\u611f\u548c\u9700\u6c42\u3002\u901a\u904e\u6709\u6548\u7684\u6578\u64da\u5eab\u7ba1\u7406\u548c\u5148\u9032\u7684\u5206\u6790\u6280\u8853\uff0c\u4f01\u696d\u53ef\u4ee5\u5728\u7af6\u722d\u6fc0\u70c8\u7684\u5e02\u5834\u4e2d\u7372\u5f97\u512a\u52e2\u3002\u82e5\u60a8\u5c0d\u65bc\u5982\u4f55\u5229\u7528\u60c5\u611f\u5206\u6790\u63d0\u5347\u696d\u52d9\u904b\u71df\u6709\u8208\u8da3\uff0c\u6216\u9700\u8981\u9ad8\u6548\u7684<a href=\"https:\/\/server.hk\">VPS<\/a>\u89e3\u6c7a\u65b9\u6848\u4f86\u652f\u6301\u60a8\u7684\u6578\u64da\u5206\u6790\u9700\u6c42\uff0c\u6b61\u8fce\u8a2a\u554f\u6211\u5011\u7684\u7db2\u7ad9\u4ee5\u7372\u53d6\u66f4\u591a\u4fe1\u606f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u63a2\u7d22\u60c5\u611f\u5206\u6790\u5728\u6578\u64da\u5eab\u6280\u8853\u61c9\u7528\u4e2d\u7684\u91cd\u8981\u6027\uff0c\u63ed\u793a\u5176\u5982\u4f55\u63d0\u5347\u6c7a\u7b56\u3001\u589e\u5f37\u7528\u6236\u9ad4\u9a57\u548c\u63a8\u52d5\u5546\u696d\u6210\u529f\u3002<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-172041","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/172041","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=172041"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/172041\/revisions"}],"predecessor-version":[{"id":172042,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/172041\/revisions\/172042"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=172041"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=172041"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=172041"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}