{"id":9415,"date":"2025-06-10T19:11:07","date_gmt":"2025-06-10T11:11:07","guid":{"rendered":"\/?p=9415"},"modified":"2025-06-10T19:13:10","modified_gmt":"2025-06-10T11:13:10","slug":"%e5%81%9c%e7%94%a8%e8%af%8d","status":"publish","type":"post","link":"\/?p=9415","title":{"rendered":"\u505c\u7528\u8bcd"},"content":{"rendered":"<p>\u505c\u7528\u8bcd\uff08Stop Words\uff09\u662f\u6307\u5728\u81ea\u7136\u8bed\u8a00\u5904\u7406\uff08NLP\uff09\u6216\u4fe1\u606f\u68c0\u7d22\u4e2d\uff0c\u56e0\u51fa\u73b0\u9891\u7387\u6781\u9ad8\u3001\u8bed\u4e49\u8d21\u732e\u4f4e\u800c\u88ab\u81ea\u52a8\u8fc7\u6ee4\u7684\u8bcd\u6c47\u3002\u5176\u6838\u5fc3\u76ee\u7684\u662f<strong>\u8282\u7701\u5b58\u50a8\u7a7a\u95f4\u3001\u63d0\u5347\u5904\u7406\u6548\u7387\uff0c\u5e76\u51cf\u5c11\u8bed\u4e49\u5e72\u6270<\/strong>\u3002\u4ee5\u4e0b\u662f\u8be6\u7ec6\u89e3\u6790\uff1a<\/p>\n<hr \/>\n<h3>\ud83d\udcda <strong>\u4e00\u3001\u505c\u7528\u8bcd\u7684\u5b9a\u4e49\u4e0e\u4f5c\u7528<\/strong><\/h3>\n<ol>\n<li><strong>\u6838\u5fc3\u7279\u70b9<\/strong>\n<ul>\n<li><strong>\u9ad8\u9891\u7387\u4f4e\u4fe1\u606f\u91cf<\/strong>\uff1a\u5982\u4e2d\u6587\u7684\u201c\u7684\u201d\u201c\u4e86\u201d\u201c\u5728\u201d\uff0c\u82f1\u6587\u7684\u201cthe\u201d\u201cis\u201d\u201cand\u201d\u7b49\uff0c\u5728\u6587\u672c\u4e2d\u9891\u7e41\u51fa\u73b0\u4f46\u5f88\u5c11\u643a\u5e26\u6838\u5fc3\u8bed\u4e49\u3002<\/li>\n<li><strong>\u8bed\u8a00\u4f9d\u8d56\u6027<\/strong>\uff1a\u4e0d\u540c\u8bed\u8a00\u9700\u5b9a\u5236\u4e13\u5c5e\u505c\u7528\u8bcd\u8868\uff08\u5982\u4e2d\u6587\u865a\u8bcd\u3001\u82f1\u6587\u51a0\u8bcd\uff09\u3002<\/li>\n<li><strong>\u529f\u80fd\u8bcd\u4e3a\u4e3b<\/strong>\uff1a\u5305\u62ec\u52a9\u8bcd\u3001\u4ecb\u8bcd\u3001\u8fde\u8bcd\u3001\u8bed\u6c14\u8bcd\u7b49\u8bed\u6cd5\u8fde\u63a5\u8bcd\u3002<\/li>\n<\/ul>\n<\/li>\n<li><strong>\u4e3b\u8981\u4f5c\u7528<\/strong>\n<ul>\n<li><strong>\u964d\u566a\u63d0\u6548<\/strong>\uff1a\u8fc7\u6ee4\u5197\u4f59\u8bcd\u6c47\uff0c\u63d0\u5347\u6587\u672c\u5206\u6790\uff08\u5982\u60c5\u611f\u5206\u6790\u3001\u4e3b\u9898\u5efa\u6a21\uff09\u7684\u51c6\u786e\u6027\u3002<\/li>\n<li><strong>\u4f18\u5316\u5b58\u50a8<\/strong>\uff1a\u51cf\u5c11\u7d22\u5f15\u4f53\u79ef\uff0c\u52a0\u901f\u641c\u7d22\u5f15\u64ce\u54cd\u5e94\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<hr \/>\n<h3>\ud83c\udde8\ud83c\uddf3 <strong>\u4e8c\u3001\u4e2d\u6587\u5178\u578b\u505c\u7528\u8bcd\u793a\u4f8b<\/strong><\/h3>\n<p>\u4e2d\u6587\u505c\u7528\u8bcd\u4ee5\u865a\u8bcd\u548c\u5e38\u7528\u4ee3\u8bcd\u4e3a\u4e3b\uff0c\u5178\u578b\u7c7b\u522b\u5305\u62ec\uff1a<\/p>\n<table>\n<thead>\n<tr>\n<th><strong>\u7c7b\u522b<\/strong><\/th>\n<th><strong>\u793a\u4f8b\u8bcd\u6c47<\/strong><\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><strong>\u52a9\u8bcd<\/strong><\/td>\n<td>\u7684\u3001\u4e86\u3001\u7740\u3001\u8fc7\u3001\u5462\u3001\u554a\u3001\u5427<\/td>\n<\/tr>\n<tr>\n<td><strong>\u4ecb\u8bcd<\/strong><\/td>\n<td>\u5728\u3001\u4ece\u3001\u5411\u3001\u4ee5\u3001\u4e8e\u3001\u5bf9\u3001\u5173\u4e8e<\/td>\n<\/tr>\n<tr>\n<td><strong>\u8fde\u8bcd<\/strong><\/td>\n<td>\u548c\u3001\u4e0e\u3001\u53ca\u3001\u6216\u3001\u4f46\u3001\u800c\u3001\u56e0\u6b64<\/td>\n<\/tr>\n<tr>\n<td><strong>\u4ee3\u8bcd<\/strong><\/td>\n<td>\u6211\u3001\u4f60\u3001\u4ed6\u3001\u8fd9\u3001\u90a3\u3001\u54ea\u3001\u4ec0\u4e48<\/td>\n<\/tr>\n<tr>\n<td><strong>\u526f\u8bcd<\/strong><\/td>\n<td>\u5c31\u3001\u4e5f\u3001\u90fd\u3001\u5f88\u3001\u975e\u5e38\u3001\u592a\u3001\u66f4<\/td>\n<\/tr>\n<tr>\n<td><strong>\u6570\u91cf\u8bcd<\/strong><\/td>\n<td>\u4e00\u3001\u4e2a\u3001\u4e9b\u3001\u6240\u6709\u3001\u4efb\u4f55<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<blockquote>\n<p>\u2705 <strong>\u5e38\u7528\u505c\u7528\u8bcd\u8868\u6765\u6e90<\/strong>\uff1a<\/p>\n<ul>\n<li>\u901a\u7528\u5e93\uff1a<code>jieba<\/code>\uff08\u5185\u7f6e\u54c8\u5de5\u5927\u505c\u7528\u8bcd\u8868\uff09\u3001<code>sklearn<\/code>\u7684<code>ENGLISH_STOP_WORDS<\/code>\u3002<\/li>\n<li>\u81ea\u5b9a\u4e49\u573a\u666f\uff1a\u9700\u7ed3\u5408\u9886\u57df\u6dfb\u52a0\u8bcd\u6c47\uff08\u5982\u533b\u7597\u6587\u672c\u9700\u8fc7\u6ee4\u201c\u60a3\u8005\u201d\u201c\u6cbb\u7597\u201d\u7b49\u9ad8\u9891\u975e\u5173\u952e\u540d\u8bcd\uff09\u3002<\/li>\n<\/ul>\n<\/blockquote>\n<hr \/>\n<h3>\u2699\ufe0f <strong>\u4e09\u3001\u5b9e\u9645\u5e94\u7528\u573a\u666f\u4e0e\u6ce8\u610f\u4e8b\u9879<\/strong><\/h3>\n<ol>\n<li>\n<p><strong>\u5904\u7406\u6d41\u7a0b\u793a\u4f8b\uff08Python\uff09<\/strong><\/p>\n<pre><code class=\"language-python\">import jieba\nfrom nltk.corpus import stopwords\n\n# \u4e2d\u6587\u505c\u7528\u8bcd\u8fc7\u6ee4\nstopwords_cn = set(open(\"stopwords.txt\", encoding=\"utf-8\").read().splitlines())  # \u52a0\u8f7d\u81ea\u5b9a\u4e49\u8bcd\u8868\ntext_cn = \"\u6211\u559c\u6b22\u5728\u5468\u672b\u53bb\u516c\u56ed\u6563\u6b65\uff0c\u4eab\u53d7\u5927\u81ea\u7136\u7684\u5b81\u9759\u3002\"\nwords_cn = [word for word in jieba.lcut(text_cn) if word not in stopwords_cn]\n# \u8f93\u51fa\uff1a['\u559c\u6b22', '\u5468\u672b', '\u516c\u56ed', '\u6563\u6b65', '\uff0c', '\u4eab\u53d7', '\u5927\u81ea\u7136', '\u5b81\u9759', '\u3002']\n\n# \u82f1\u6587\u505c\u7528\u8bcd\u8fc7\u6ee4\nstopwords_en = set(stopwords.words('english'))\ntext_en = \"The quick brown fox jumps over the lazy dog.\"\nwords_en = [word for word in text_en.split() if word.lower() not in stopwords_en]\n# \u8f93\u51fa\uff1a['quick', 'brown', 'fox', 'jumps', 'lazy', 'dog.'] <\/code><\/pre>\n<\/li>\n<li>\n<p><strong>\u6ce8\u610f\u4e8b\u9879<\/strong><\/p>\n<ul>\n<li><strong>\u907f\u514d\u8fc7\u5ea6\u8fc7\u6ee4<\/strong>\uff1a\u7279\u5b9a\u573a\u666f\u9700\u4fdd\u7559\u529f\u80fd\u8bcd\uff08\u5982\u641c\u7d22\u77ed\u8bed\u201cTake That\u201d\u4e2d\u7684\u201cThe\u201d\uff09\u3002<\/li>\n<li><strong>\u9886\u57df\u9002\u5e94\u6027<\/strong>\uff1a\u6cd5\u5f8b\/\u533b\u7597\u6587\u672c\u9700\u5b9a\u5236\u8bcd\u8868\uff08\u5982\u4fdd\u7559\u201c\u6cd5\u6761\u201d\u201c\u8bca\u65ad\u201d\u7b49\u5173\u952e\u672f\u8bed\uff09\u3002<\/li>\n<li><strong>\u52a8\u6001\u66f4\u65b0<\/strong>\uff1a\u7f51\u7edc\u65b0\u8bcd\uff08\u5982\u201c\u7edd\u7edd\u5b50\u201d\uff09\u53ef\u80fd\u9700\u52a0\u5165\u505c\u7528\u8bcd\u8868\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><img src=\"https:\/\/lemon-guess.oss-cn-hangzhou.aliyuncs.com\/img\/image-20250610191258796.png\" alt=\"image-20250610191258796\" \/><\/p>\n<hr \/>\n<h3>\ud83d\udc8e <strong>\u603b\u7ed3<\/strong><\/h3>\n<p>\u505c\u7528\u8bcd\u662fNLP\u9884\u5904\u7406\u7684\u6838\u5fc3\u73af\u8282\uff0c\u4e2d\u6587\u5178\u578b\u505c\u7528\u8bcd\u4ee5<strong>\u865a\u8bcd\u3001\u4ee3\u8bcd\u3001\u9ad8\u9891\u526f\u8bcd<\/strong>\u4e3a\u4e3b\u3002\u5b9e\u9645\u5e94\u7528\u4e2d\u9700\u7ed3\u5408\u9886\u57df\u9700\u6c42\u52a8\u6001\u8c03\u6574\u8bcd\u8868\uff0c\u5e73\u8861\u8fc7\u6ee4\u6548\u7387\u4e0e\u8bed\u4e49\u5b8c\u6574\u6027\u3002\u63a8\u8350\u4f18\u5148\u4f7f\u7528\u6743\u5a01\u8bcd\u8868\uff08\u5982\u54c8\u5de5\u5927\u3001\u767e\u5ea6\u505c\u7528\u8bcd\u5e93\uff09\uff0c\u5e76\u901a\u8fc7\u4ee3\u7801\u5de5\u5177\uff08<code>jieba<\/code>\/<code>NLTK<\/code>\uff09\u5feb\u901f\u96c6\u6210\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u505c\u7528\u8bcd\uff08Stop Words\uff09\u662f\u6307\u5728\u81ea\u7136\u8bed\u8a00\u5904\u7406\uff08NLP\uff09\u6216\u4fe1\u606f\u68c0\u7d22\u4e2d\uff0c\u56e0\u51fa\u73b0\u9891\u7387\u6781\u9ad8\u3001\u8bed\u4e49\u8d21\u732e\u4f4e\u800c\u88ab\u81ea\u52a8\u8fc7\u6ee4\u7684\u8bcd\u6c47\u3002\u5176\u6838\u5fc3\u76ee\u7684\u662f\u8282\u7701\u5b58   \u2026 &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0},"categories":[225],"tags":[226],"_links":{"self":[{"href":"\/index.php?rest_route=\/wp\/v2\/posts\/9415"}],"collection":[{"href":"\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=9415"}],"version-history":[{"count":2,"href":"\/index.php?rest_route=\/wp\/v2\/posts\/9415\/revisions"}],"predecessor-version":[{"id":9417,"href":"\/index.php?rest_route=\/wp\/v2\/posts\/9415\/revisions\/9417"}],"wp:attachment":[{"href":"\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=9415"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=9415"},{"taxonomy":"post_tag","embeddable":true,"href":"\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=9415"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}