{"id":3088,"date":"2022-02-27T11:17:38","date_gmt":"2022-02-27T03:17:38","guid":{"rendered":"https:\/\/egonlin.com\/?p=3088"},"modified":"2022-02-27T11:17:38","modified_gmt":"2022-02-27T03:17:38","slug":"%e7%ac%ac%e4%ba%8c%e8%8a%82%ef%bc%9a%e6%9c%b4%e7%b4%a0%e8%b4%9d%e5%8f%b6%e6%96%af%e5%9e%83%e5%9c%be%e9%82%ae%e4%bb%b6%e5%88%86%e7%b1%bb","status":"publish","type":"post","link":"https:\/\/egonlin.com\/?p=3088","title":{"rendered":"\u7b2c\u4e8c\u8282\uff1a\u6734\u7d20\u8d1d\u53f6\u65af(\u5783\u573e\u90ae\u4ef6\u5206\u7c7b)"},"content":{"rendered":"<h1>\u6734\u7d20\u8d1d\u53f6\u65af(\u5783\u573e\u90ae\u4ef6\u5206\u7c7b)<\/h1>\n<h1>\u90ae\u7bb1\u8bad\u7ec3\u96c6\u4e0b\u8f7d\u5730\u5740<\/h1>\n<p>&emsp;&emsp;\u90ae\u4ef6\u8bad\u7ec3\u96c6\u4e0b\u8f7d\u5730\u5740https:\/\/pan.baidu.com\/s\/1uwDJJeJAr-DX82XlCRGR9Q<\/p>\n<h1>\u6a21\u5757\u5bfc\u5165<\/h1>\n<pre><code class=\"language-python\">import re\nimport os\nfrom jieba import cut\nfrom itertools import chain\nfrom collections import Counter\nimport numpy as np\nfrom sklearn.naive_bayes import MultinomialNB<\/code><\/pre>\n<h1>\u6587\u672c\u9884\u5904\u7406<\/h1>\n<pre><code class=\"language-python\">def get_words(filename):\n    &quot;&quot;&quot;\u8bfb\u53d6\u6587\u672c\u5e76\u8fc7\u6ee4\u65e0\u6548\u5b57\u7b26\u548c\u957f\u5ea6\u4e3a1\u7684\u8bcd&quot;&quot;&quot;\n    words = []\n    with open(filename, &#039;r&#039;, encoding=&#039;utf-8&#039;) as fr:\n        for line in fr:\n            line = line.strip()\n            # \u8fc7\u6ee4\u65e0\u6548\u5b57\u7b26\n            line = re.sub(r&#039;[.\u3010\u30110-9\u3001\u2014\u2014\u3002\uff0c\uff01~\\*]&#039;, &#039;&#039;, line)\n            # \u4f7f\u7528jieba.cut()\u65b9\u6cd5\u5bf9\u6587\u672c\u5207\u8bcd\u5904\u7406\n            line = cut(line)\n            # \u8fc7\u6ee4\u957f\u5ea6\u4e3a1\u7684\u8bcd\n            line = filter(lambda word: len(word) &gt; 1, line)\n            words.extend(line)\n\n    return words<\/code><\/pre>\n<h1>\u904d\u5386\u90ae\u4ef6<\/h1>\n<p><\/p><div id=\"rml_readmorelogin_placeholder\" style=\"position:relative;\"><div id=\"rml_fade_content\" style=\"position: absolute;\r\ntop:-10em;\r\nwidth:100%;\r\nheight:10em;\r\nbackground: -webkit-linear-gradient(rgba(255, 255, 255, 0) 0%,#ffffff 100%);\r\nbackground-image: -moz-linear-gradient(rgba(255, 255, 255, 0) 0%,#ffffff 100%);\r\nbackground-image: -o-linear-gradient(rgba(255, 255, 255, 0) 0%,#ffffff 100%);\r\nbackground-image: linear-gradient(rgba(255, 255, 255, 0) 0%,#ffffff 100%);\r\nbackground-image: -ms-linear-gradient(rgba(255, 255, 255, 0) 0%,#ffffff 100%);\"><\/div><div class=\"wpf-controller aru_rml_from_in_post\" style=\"background-color:#eeeeee;border:5px solid #cce6ff;\" id=\"ARU_ReadMoreLogin_ReadMoreLoginController\"><h2 id=\"Header\">\u67e5\u770b\u66f4\u591a<\/h2><div id=\"Message\"><p>\u8054\u7cfb\u7ba1\u7406\u5458\u5fae\u4fe1tutu19192010\uff0c\u6ce8\u518c\u8d26\u53f7<\/p>\n<\/div><div id=\"StatusBarHeader\"><\/div><form id=\"ARU_ReadMoreLogin_ReadMoreLoginController\"><input name=\"post_id\" value=\"3088\" type=\"hidden\"\/><input name=\"_init_callback\" value=\"InitLogin\" type=\"hidden\"\/><input name=\"post_id\" value=\"3088\" type=\"hidden\"\/><input name=\"rt_ype\" value=\"1\" type=\"hidden\"\/><input name=\"nonce\" value=\"305df5a645\" type=\"hidden\"\/><input name=\"_wpnonce\" value=\"ee095c8387\" type=\"hidden\"\/><input name=\"_controller\" value=\"ARU_ReadMoreLogin\\ReadMoreLoginController\" type=\"hidden\"\/><input name=\"_proxy_controller\" value=\"ARU_ReadMoreLogin\\ReadMoreLoginController\" type=\"hidden\"\/><input name=\"_view\" value=\"ARU_ReadMoreLogin\\ReadMoreLoginView\" type=\"hidden\"\/><table class=\"wpf-table-placeholder\"><tbody class=\"wpf-table-placeholder\"><tr class=\"wpf-table-placeholder\"><td class=\"wpf-table-placeholder-input\" width=\"400px\"><table class=\"wpf-table-placeholder\"><tbody class=\"wpf-table-placeholder\"><tr class=\"wpf-table-placeholder\"><th class=\"wpf-table-placeholder-input\"><label class=\"wpf-label\">Username:<\/label><\/th><\/tr><tr class=\"wpf-table-placeholder\"><td class=\"wpf-table-placeholder-input\"><input class=\"regular-text text_input\" name=\"username\" value=\"\" type=\"text\"\/><\/td><\/tr><tr class=\"wpf-table-placeholder\"><th class=\"wpf-table-placeholder-input\"><label class=\"wpf-label\">Password:<\/label><\/th><\/tr><tr class=\"wpf-table-placeholder\"><td class=\"wpf-table-placeholder-input\"><input class=\"regular-text text_input\" name=\"password\" value=\"\" type=\"password\"\/><\/td><\/tr><\/tbody><\/table><p class=\"wpf-table-placeholder submit\"><button class=\"wp_plugin_framework_ajax_button\" type=\"button\" style=\"background-color:#4D90FE;;color:#ffffff;;border:1px solid #3079ed;\" name=\"_event\" value=\"ButtonLogin\">Log in<\/button><\/p><\/td><td class=\"wpf-table-placeholder-input\"><\/td><\/tr><\/tbody><\/table><\/form><div id=\"ButtonStartRegister\"><a href=\"https:\/\/egonlin.com\/wp-login.php?action=register\">Register<\/a><\/div><div id=\"Link1\"><a href=\"https:\/\/egonlin.com\/wp-login.php?action=lostpassword\">Forgotten username or password?<\/a><\/div><div id=\"StatusBarFooter\"><\/div><\/div><\/div><div id=aru_remaining_content><\/div>","protected":false},"excerpt":{"rendered":"<p>\u6734\u7d20\u8d1d\u53f6\u65af(\u5783\u573e\u90ae\u4ef6\u5206\u7c7b) \u90ae\u7bb1\u8bad\u7ec3\u96c6\u4e0b\u8f7d\u5730\u5740 &emsp;&emsp;\u90ae\u4ef6\u8bad\u7ec3\u96c6\u4e0b\u8f7d\u5730\u5740https:\/\/pa [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[276,290],"tags":[],"_links":{"self":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/posts\/3088"}],"collection":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3088"}],"version-history":[{"count":0,"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/posts\/3088\/revisions"}],"wp:attachment":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3088"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3088"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3088"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}