{"id":204468,"date":"2025-05-29T15:19:54","date_gmt":"2025-05-29T07:19:54","guid":{"rendered":"https:\/\/server.hk\/cnblog\/204468\/"},"modified":"2025-05-29T15:19:54","modified_gmt":"2025-05-29T07:19:54","slug":"%e4%b8%ba%e4%bb%80%e4%b9%88%e6%88%91%e5%9c%a8-pycharm-%e4%b8%ad%e6%97%a0%e6%b3%95%e4%bd%bf%e7%94%a8-nltk-%e5%8c%85%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/204468\/","title":{"rendered":"\u4e3a\u4ec0\u4e48\u6211\u5728 PyCharm \u4e2d\u65e0\u6cd5\u4f7f\u7528 nltk \u5305\uff1f"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>\u4e3a\u4ec0\u4e48\u6211\u5728 PyCharm \u4e2d\u65e0\u6cd5\u4f7f\u7528 nltk \u5305\uff1f<\/h1>\n<p>\u54c8\u55bd\uff01\u5927\u5bb6\u597d\uff0c\u5f88\u9ad8\u5174\u53c8\u89c1\u9762\u4e86\uff0c\u6211\u662f\u7684\u4e00\u540d\u4f5c\u8005\uff0c\u4eca\u5929\u7531\u6211\u7ed9\u5927\u5bb6\u5e26\u6765\u4e00\u7bc7\uff0c\u672c\u6587\u4e3b\u8981\u4f1a\u8bb2\u5230<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\"><\/span>\u7b49\u7b49\u77e5\u8bc6\u70b9\uff0c\u5e0c\u671b\u5927\u5bb6\u4e00\u8d77\u5b66\u4e60\u8fdb\u6b65\uff0c\u4e5f\u6b22\u8fce\u5927\u5bb6\u5173\u6ce8\u3001\u70b9\u8d5e\u3001\u6536\u85cf\u3001\u8f6c\u53d1! \u4e0b\u9762\u5c31\u4e00\u8d77\u6765\u770b\u770b\u5427\uff01<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241108\/1731052128672dc26086dbb.jpg\" class=\"aligncenter\"><\/p>\n<p><strong>pycharm \u4e0b nltk \u5305\u65e0\u6cd5\u4f7f\u7528<\/strong><\/p>\n<p>\u5728 pycharm \u4e2d\u5373\u4f7f\u4e0b\u8f7d\u4e86 nltk \u5305\uff0c\u5374\u53d1\u73b0\u65e0\u6cd5\u8c03\u7528\u5176\u529f\u80fd\u3002\u4f8b\u5982\uff0c\u8fd0\u884c\u4ee5\u4e0b\u4ee3\u7801\u4f1a\u5bfc\u81f4\u9519\u8bef\uff1a<\/p>\n<pre>import nltk\nfor_test = 'Xi is the chairman of China in the year 2013.'\nprint(nltk.word_tokenize(for_test))<\/pre>\n<p><strong>attributeerror: module &#8216;nltk&#8217; has no attribute &#8216;word_tokenize&#8217;<\/strong><\/p>\n<p>\u89e3\u51b3\u65b9\u6cd5\uff1a\u53c2\u8003 nltk \u6587\u6863\u3002<\/p>\n<p>\u5230\u8fd9\u91cc\uff0c\u6211\u4eec\u4e5f\u5c31\u8bb2\u5b8c\u4e86\u300a\u4e3a\u4ec0\u4e48\u6211\u5728 PyCharm \u4e2d\u65e0\u6cd5\u4f7f\u7528 nltk \u5305\uff1f\u300b\u7684\u5185\u5bb9\u4e86\u3002\u4e2a\u4eba\u8ba4\u4e3a\uff0c\u57fa\u7840\u77e5\u8bc6\u7684\u5b66\u4e60\u548c\u5de9\u56fa\uff0c\u662f\u4e3a\u4e86\u66f4\u597d\u7684\u5c06\u5176\u8fd0\u7528\u5230\u9879\u76ee\u4e2d\uff0c\u6b22\u8fce\u5173\u6ce8\u516c\u4f17\u53f7\uff0c\u5e26\u4f60\u4e86\u89e3\u66f4\u591a\u5173\u4e8e\u7684\u77e5\u8bc6\u70b9\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e3a\u4ec0\u4e48\u6211\u5728 PyCharm \u4e2d\u65e0&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4925],"tags":[],"class_list":["post-204468","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/204468","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"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=204468"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/204468\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=204468"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=204468"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=204468"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}