{"id":55652,"date":"2025-08-14T06:44:34","date_gmt":"2025-08-13T22:44:34","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/55652.html"},"modified":"2025-08-14T06:44:34","modified_gmt":"2025-08-13T22:44:34","slug":"java%e5%ae%9e%e7%8e%b0%e6%8c%87%e5%ae%9a%e5%ad%97%e7%ac%a6%e4%b8%b2%e4%b8%ad%e7%9a%84%e5%8d%95%e8%af%8d%e7%9a%84%e4%b8%aa%e6%95%b0%e7%ae%97%e6%b3%95%ef%bc%88%e9%99%84%e5%b8%a6%e6%ba%90%e7%a0%81","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/55652.html","title":{"rendered":"JAVA:\u5b9e\u73b0\u6307\u5b9a\u5b57\u7b26\u4e32\u4e2d\u7684\u5355\u8bcd\u7684\u4e2a\u6570\u7b97\u6cd5\uff08\u9644\u5e26\u6e90\u7801\uff09"},"content":{"rendered":"<h3>1. \u9879\u76ee\u80cc\u666f\u8be6\u7ec6\u4ecb\u7ecd<\/h3>\n<p>\u5728\u6587\u672c\u5904\u7406\u3001\u4fe1\u606f\u68c0\u7d22\u3001\u81ea\u7136\u8bed\u8a00\u5904\u7406\u3001\u641c\u7d22\u5f15\u64ce\u7edf\u8ba1\u3001\u65e5\u5fd7\u5206\u6790\u7b49\u8bf8\u591a\u9886\u57df&#xff0c;\u7edf\u8ba1\u6307\u5b9a\u5b57\u7b26\u4e32\u4e2d\u201c\u5355\u8bcd\u201d\u7684\u4e2a\u6570\u662f\u4e00\u4e2a\u975e\u5e38\u57fa\u7840\u4f46\u53c8\u5bb9\u6613\u4ea7\u751f\u6b67\u4e49\u7684\u4efb\u52a1\u3002\u770b\u4f3c\u7b80\u5355\u7684\u201c\u5355\u8bcd\u8ba1\u6570\u201d&#xff08;word count&#xff09;\u5728\u4e0d\u540c\u8bed\u8a00\u3001\u4e0d\u540c\u573a\u666f&#xff08;\u5982\u5e26\u6807\u70b9\u7684\u53e5\u5b50\u3001\u7f29\u5199\u3001\u8fde\u5b57\u7b26\u3001\u6487\u53f7\u3001\u4e2d\u6587\/\u65e5\u6587\u65e0\u7a7a\u683c\u8bed\u8a00\u3001\u6df7\u5408\u8bed\u8a00&#xff09;\u4e0b\u4f1a\u6709\u4e0d\u540c\u7684\u5b9a\u4e49\u4e0e\u5b9e\u73b0\u7ec6\u8282\u3002\u6559\u5b66\u65f6&#xff0c;\u7edf\u8ba1\u5355\u8bcd\u4e2a\u6570\u975e\u5e38\u9002\u5408\u4f5c\u4e3a\u8bb2\u89e3\u6b63\u5219\u8868\u8fbe\u5f0f\u3001\u5b57\u7b26\u4e32\u5206\u5272\u3001\u6709\u9650\u72b6\u6001\u673a&#xff08;FSM&#xff09;\u3001Java \u6587\u672c\u8fb9\u754c\u5de5\u5177&#xff08;BreakIterator&#xff09;\u3001\u4ee5\u53ca\u6027\u80fd\/\u5185\u5b58\u6743\u8861\u7684\u6848\u4f8b\u3002<\/p>\n<p>\u672c\u9879\u76ee\u9762\u5411\u8bfe\u5802\u4e0e\u5de5\u7a0b\u4e24\u65b9\u9762&#xff1a;\u65e2\u8981\u6709\u7b80\u5355\u76f4\u63a5\u3001\u4fbf\u4e8e\u7406\u89e3\u7684\u5b9e\u73b0&#xff0c;\u4e5f\u8981\u63d0\u4f9b\u66f4\u7a33\u5065\u3001\u56fd\u9645\u5316\u7684\u89e3\u51b3\u65b9\u6848&#xff0c;\u5e76\u8ba8\u8bba\u8fb9\u754c\u60c5\u51b5\u4e0e\u6027\u80fd\u8003\u91cf\u3002\u76ee\u6807\u662f\u8ba9\u5b66\u751f\u7406\u89e3\u201c\u4ec0\u4e48\u662f\u5355\u8bcd\u201d\u7684\u591a\u79cd\u5b9a\u4e49&#xff0c;\u4ee5\u53ca\u5982\u4f55\u5728 Java&#xff08;\u517c\u5bb9 Java 8&#xff09;\u4e2d\u5b9e\u73b0\u76f8\u5e94\u7b97\u6cd5\u3002<\/p>\n<hr \/>\n<h3>2. \u9879\u76ee\u9700\u6c42\u8be6\u7ec6\u4ecb\u7ecd<\/h3>\n<li>\n<p>\u63d0\u4f9b\u591a\u79cd Java \u5b9e\u73b0\u65b9\u5f0f\u7528\u4e8e\u7edf\u8ba1\u6307\u5b9a\u5b57\u7b26\u4e32\u4e2d\u7684\u5355\u8bcd\u6570&#xff0c;\u81f3\u5c11\u5305\u542b&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u7b80\u5355\u7684\u6309\u7a7a\u767d\u5206\u5272\u5b9e\u73b0&#xff08;\u9002\u5408\u82f1\u6587\u7b80\u5355\u6587\u672c&#xff09;&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u57fa\u4e8e\u6b63\u5219\u7684\u5b9e\u73b0&#xff08;\u53ef\u81ea\u5b9a\u4e49\u89c4\u5219&#xff0c;\u652f\u6301\u5e38\u89c1\u7f29\u5199\/\u6487\u53f7\/\u8fde\u5b57\u7b26&#xff09;&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u57fa\u4e8e BreakIterator \u7684\u533a\u57df\/\u8bed\u8a00\u611f\u77e5\u5b9e\u73b0&#xff08;\u652f\u6301\u56fd\u9645\u5316&#xff09;&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u57fa\u4e8e\u6709\u9650\u72b6\u6001\u673a&#xff08;FSM&#xff09;\u7684\u9c81\u68d2\u5b9e\u73b0&#xff08;\u9010\u5b57\u7b26\u5224\u65ad&#xff0c;\u4f4e\u4f9d\u8d56\u3001\u53ef\u6269\u5c55&#xff09;&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u6f14\u793a\u5bf9\u4e2d\u6587\/\u65e5\u6587\u7b49\u201c\u65e0\u7a7a\u683c\u201d\u8bed\u8a00\u7684\u8bf4\u660e\u4e0e\u5efa\u8bae&#xff08;\u542b\u7b80\u5355\u5b57\u7b26\u8ba1\u6570\u7b56\u7565\u4e0e\u7b2c\u4e09\u65b9\u5206\u8bcd\u5e93\u5efa\u8bae&#xff09;\u3002<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u6240\u6709\u4ee3\u7801\u9700\u517c\u5bb9 Java 8&#043;&#xff0c;\u6ce8\u91ca\u8be6\u7ec6&#xff0c;\u4fbf\u4e8e\u8bfe\u5802\u8bb2\u89e3\u3002<\/p>\n<\/li>\n<li>\n<p>\u6240\u6709\u5b9e\u73b0\u653e\u5728\u5355\u4e2a\u4ee3\u7801\u5757\u5185&#xff0c;\u4e0d\u540c\u201c\u6587\u4ef6\u201d\u7528\u6ce8\u91ca\u533a\u5206&#xff08;\u4f8b\u5982 \/\/ File: &#8230;&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>\u63d0\u4f9b\u4e3b\u65b9\u6cd5\u793a\u4f8b&#xff08;\u542b\u591a\u79cd\u8f93\u5165\u6848\u4f8b&#xff09;&#xff0c;\u8f93\u51fa\u6bcf\u79cd\u65b9\u6cd5\u7684\u8ba1\u6570\u7ed3\u679c\u4ee5\u4fbf\u5bf9\u6bd4\u3002<\/p>\n<\/li>\n<li>\n<p>\u5728\u6587\u6863\u4e2d\u8be6\u7ec6\u8bf4\u660e\u6bcf\u79cd\u5b9e\u73b0\u7684\u4f18\u7f3a\u70b9\u3001\u65f6\u95f4\/\u7a7a\u95f4\u590d\u6742\u5ea6\u3001\u9002\u7528\u573a\u666f\u4e0e\u6ce8\u610f\u4e8b\u9879\u3002<\/p>\n<\/li>\n<li>\n<p>\u6587\u7ae0\u4e2d\u6587\u8be6\u5c3d\u3001\u9762\u5411\u6559\u5b66&#xff1a;\u89e3\u91ca\u4e3a\u4f55\u9009\u62e9\u6b64\u5b9e\u73b0\u3001\u5e38\u89c1\u9677\u9631\u4e0e\u63a8\u8350\u505a\u6cd5\u3002<\/p>\n<\/li>\n<hr \/>\n<h3>3. \u76f8\u5173\u6280\u672f\u8be6\u7ec6\u4ecb\u7ecd<\/h3>\n<ul>\n<li>\n<p>\u5b57\u7b26\u5206\u7c7b&#xff1a;Character.isLetter\u3001Character.isLetterOrDigit\u3001Unicode \u7c7b\u522b \\\\p{L} \u7b49&#xff0c;\u7528\u4e8e\u5224\u65ad\u5b57\u7b26\u662f\u5426\u5c5e\u4e8e\u201c\u8bcd\u5185\u5b57\u7b26\u201d&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u6b63\u5219\u8868\u8fbe\u5f0f&#xff1a;String.split() \u548c Pattern\/Matcher&#xff0c;\u5e38\u89c1\u6b63\u5219\u5982 \\\\b\u3001\\\\p{L}\u3001[A-Za-z0-9&#039;-] \u7b49&#xff1b;<\/p>\n<\/li>\n<li>\n<p>BreakIterator&#xff1a;java.text.BreakIterator.getWordInstance(Locale)&#xff0c;\u7528\u4e8e\u57fa\u4e8e\u8bed\u8a00\u7684\u8bcd\u8fb9\u754c\u68c0\u6d4b&#xff08;\u6bd4\u7b80\u5355\u6b63\u5219\u66f4\u8d34\u5408\u672c\u5730\u5316\u89c4\u5219&#xff09;&#xff1b;<\/p>\n<\/li>\n<li>\n<p>Scanner&#xff1a;java.util.Scanner \u53ef\u4f5c\u4e3a\u5feb\u901f\u7684\u5206\u8bcd\u5de5\u5177&#xff0c;\u4f46\u9700\u8981\u8bbe\u7f6e\u5408\u9002\u7684\u5206\u9694\u7b26&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u6709\u9650\u72b6\u6001\u673a&#xff08;FSM&#xff09;&#xff1a;\u6309\u5b57\u7b26\u9010\u6b65\u5224\u65ad\u72b6\u6001&#xff08;IN_WORD \/ OUT_WORD&#xff09;&#xff0c;\u7cbe\u786e\u63a7\u5236\u4f55\u4e3a\u201c\u5355\u8bcd\u5f00\u59cb\/\u7ed3\u675f\u201d&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u7b2c\u4e09\u65b9\u5206\u8bcd&#xff1a;\u5bf9\u4e8e\u4e2d\u6587\/\u65e5\u6587&#xff0c;\u9700\u4f7f\u7528\u5206\u8bcd\u5e93&#xff08;\u5982jieba\u3001HanLP&#xff09;\u6216 NLP \u5de5\u5177\u5305\u624d\u80fd\u505a\u5230\u771f\u6b63\u7684\u201c\u5355\u8bcd\/\u8bcd\u8bed\u201d\u5206\u5272&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u6027\u80fd\/\u5185\u5b58&#xff1a;\u5b57\u7b26\u4e32\u957f\u5ea6\u6781\u5927\u65f6&#xff0c;\u907f\u514d\u521b\u5efa\u5927\u91cf\u4e2d\u95f4\u5b57\u7b26\u4e32&#xff08;\u5982 split \u4f1a\u4ea7\u751f\u6570\u7ec4&#xff09;&#xff0c;\u5e94\u8003\u8651\u6d41\u5f0f\/\u9010\u5b57\u7b26\u5904\u7406\u6216\u4f7f\u7528 Scanner\/BreakIterator \u589e\u91cf\u5904\u7406\u3002<\/p>\n<\/li>\n<\/ul>\n<hr \/>\n<h3>4. \u5b9e\u73b0\u601d\u8def\u8be6\u7ec6\u4ecb\u7ecd<\/h3>\n<p>\u6211\u4eec\u4f9d\u6b21\u5b9e\u73b0\u4ee5\u4e0b\u65b9\u6cd5\u5e76\u5728 main \u4e2d\u6f14\u793a&#xff1a;<\/p>\n<li>\n<p>countBySimpleSplit(String s)&#xff1a;trim() \u540e\u4f7f\u7528 s.split(&#034;\\\\\\\\s&#043;&#034;) \u5f97\u5230 token \u6570&#xff0c;\u9002\u5408\u4ee5\u7a7a\u767d\u5206\u5272\u7684\u7b80\u5355\u573a\u666f&#xff08;\u82f1\u6587\u77ed\u6587\u672c&#xff09;\u3002\u4f18\u70b9&#xff1a;\u5b9e\u73b0\u6700\u7b80\u5355&#xff1b;\u7f3a\u70b9&#xff1a;\u4e0d\u80fd\u5904\u7406\u9644\u5e26\u6807\u70b9\u7684 token \u8f83\u51c6\u3002<\/p>\n<\/li>\n<li>\n<p>countByRegex(String s)&#xff1a;\u4f7f\u7528\u6b63\u5219 \\\\b[\\\\p{L}\\\\p{Nd}]&#043;(?:[&#039;-][\\\\p{L}\\\\p{Nd}]&#043;)*\\\\b&#xff08;\u652f\u6301\u5b57\u6bcd\/\u6570\u5b57&#xff0c;\u5141\u8bb8\u5185\u90e8\u8fde\u5b57\u7b26\u548c\u6487\u53f7&#xff09;&#xff0c;\u901a\u8fc7 Matcher \u9010\u4e2a\u5339\u914d\u5e76\u8ba1\u6570\u3002\u4f18\u70b9&#xff1a;\u53ef\u901a\u8fc7\u6b63\u5219\u81ea\u5b9a\u4e49\u8bc6\u522b\u89c4\u5219&#xff1b;\u7f3a\u70b9&#xff1a;\u590d\u6742\u6b63\u5219\u8f83\u96be\u8bfb\u61c2\u4e14\u5bf9\u7279\u6b8a\u60c5\u51b5\u6709\u9650\u3002<\/p>\n<\/li>\n<li>\n<p>countByBreakIterator(String s, Locale locale)&#xff1a;\u4f7f\u7528 BreakIterator.getWordInstance(locale) \u904d\u5386\u5019\u9009\u8bcd\u8fb9\u754c&#xff0c;\u8ba1\u6570\u65f6\u53ea\u628a\u5305\u542b\u5b57\u6bcd\/\u6570\u5b57\u5b57\u7b26\u7684\u8fb9\u754c\u4f5c\u4e3a\u8bcd\u3002\u4f18\u70b9&#xff1a;\u56fd\u9645\u5316\u652f\u6301\u66f4\u597d&#xff1b;\u7f3a\u70b9&#xff1a;\u4e0e\u8bed\u8a00\u89c4\u5219\u4e00\u81f4\u6027\u4f9d\u8d56 Java \u7684\u5b9e\u73b0&#xff0c;\u67d0\u4e9b\u8bed\u8a00&#xff08;\u4e2d\u6587&#xff09;\u4ecd\u9700\u5206\u8bcd\u5e93\u3002<\/p>\n<\/li>\n<li>\n<p>countByFSM(String s)&#xff1a;\u5b9e\u73b0\u57fa\u4e8e\u72b6\u6001\u673a\u7684\u9010\u5b57\u7b26\u626b\u63cf&#xff1a;\u5f53\u9047\u5230\u5b57\u6bcd\/\u6570\u5b57\u5219\u8fdb\u5165 IN_WORD \u72b6\u6001&#xff0c;\u9047\u5230\u975e\u8bcd\u5b57\u7b26\u5219\u4ece IN_WORD \u5207\u6362\u5230 OUT_WORD \u5e76\u8ba1\u6570\u3002\u4f18\u70b9&#xff1a;\u5185\u5b58\u53cb\u597d\u3001\u6027\u80fd\u53ef\u63a7\u3001\u5b9e\u73b0\u903b\u8f91\u6e05\u6670&#xff1b;\u7f3a\u70b9&#xff1a;\u9700\u5b9a\u4e49\u201c\u5b57\u6bcd\/\u6570\u5b57\u201d\u7684\u7cbe\u786e\u5224\u5b9a&#xff08;Unicode \u8f83\u590d\u6742&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>countChineseByChar(String s)&#xff1a;\u5bf9\u4e8e\u4e2d\u6587\u548c\u65e5\u6587\u7b49\u65e0\u7a7a\u683c\u8bed\u8a00&#xff0c;\u63d0\u4f9b\u4e00\u4e2a\u53ef\u9009\u7684\u201c\u628a\u6bcf\u4e2a\u6c49\u5b57\/\u6c49\u5b57\u5e8f\u5217\u89c6\u4e3a\u8bcd\u201d\u7684\u7b80\u6613\u7b56\u7565&#xff08;\u975e\u771f\u6b63\u7684\u5206\u8bcd&#xff0c;\u4ec5\u6559\u5b66\u7528\u9014&#xff09;&#xff0c;\u5e76\u5efa\u8bae\u4f7f\u7528\u4e13\u4e1a\u5206\u8bcd\u5e93\u505a\u7cbe\u786e\u5206\u8bcd\u3002<\/p>\n<\/li>\n<li>\n<p>countByScanner(String s)&#xff1a;\u6f14\u793a Scanner \u7684\u7b80\u5355\u7528\u6cd5&#xff08;useDelimiter(&#034;\\\\\\\\s&#043;&#034;)&#xff09;&#xff0c;\u4f46\u8981\u6ce8\u610f\u5176\u5206\u9694\u7b26\u4e0e token \u6e05\u6d17\u3002<\/p>\n<\/li>\n<p>\u4e3b\u65b9\u6cd5\u4f1a\u5bf9\u5e38\u89c1\u793a\u4f8b\u8fdb\u884c\u5bf9\u6bd4&#xff1a;\u5305\u542b\u7b80\u5355\u82f1\u6587\u53e5\u5b50&#xff08;\u5e26\u6807\u70b9&#xff09;\u3001\u5305\u542b\u7f29\u5199\u4e0e\u6487\u53f7&#xff08;don&#039;t, O&#039;Reilly&#xff09;\u3001\u8fde\u5b57\u7b26&#xff08;state-of-the-art&#xff09;\u3001\u6df7\u5408\u4e2d\u82f1\u6587\u3001\u4ee5\u53ca\u4e2d\u6587\u53e5\u5b50&#xff0c;\u5c55\u793a\u4e0d\u540c\u65b9\u6cd5\u4e0b\u8ba1\u6570\u5dee\u5f02\u5e76\u8ba8\u8bba\u539f\u56e0\u3002<\/p>\n<hr \/>\n<h3>5. \u5b8c\u6574\u5b9e\u73b0\u4ee3\u7801<\/h3>\n<p>\/\/ File: WordCountUtils.java<br \/>\n\/\/ \u8bf4\u660e&#xff1a;\u591a\u79cd\u5b9e\u73b0\u7edf\u8ba1\u5b57\u7b26\u4e32\u4e2d\u5355\u8bcd&#xff08;word&#xff09;\u4e2a\u6570\u7684\u5de5\u5177\u7c7b&#xff0c;\u517c\u5bb9 Java 8&#043;\u3002<br \/>\n\/\/ \u65b9\u6cd5\u5305\u62ec&#xff1a;\u7b80\u5355 split\u3001\u6b63\u5219\u5339\u914d\u3001BreakIterator&#xff08;\u56fd\u9645\u5316&#xff09;\u3001FSM&#xff08;\u72b6\u6001\u673a&#xff09;\u3001Scanner \u793a\u4f8b\u3001\u4e2d\u6587\u7b80\u6613\u8ba1\u6570\u3002<br \/>\n\/\/ \u4ee3\u7801\u4ee5\u6559\u5b66\u4e3a\u4e3b&#xff0c;\u6ce8\u91ca\u8be6\u5c3d&#xff0c;\u4fbf\u4e8e\u8bfe\u5802\u8bb2\u89e3\u3002<\/p>\n<p>import java.text.BreakIterator;<br \/>\nimport java.util.Locale;<br \/>\nimport java.util.Scanner;<br \/>\nimport java.util.regex.Matcher;<br \/>\nimport java.util.regex.Pattern;<\/p>\n<p>public class WordCountUtils {<\/p>\n<p>    \/**<br \/>\n     * \u65b9\u6cd51&#xff1a;\u7b80\u5355\u6309\u7a7a\u767d\u7b26\u5206\u5272&#xff08;\u6700\u76f4\u89c2&#xff09;<br \/>\n     * \u8bf4\u660e&#xff1a;<br \/>\n     *  &#8211; \u4f7f\u7528 trim() \u53bb\u6389\u524d\u540e\u7a7a\u767d&#xff0c;\u4f7f\u7528 \\\\s&#043; \u4f5c\u4e3a\u5206\u9694\u7b26\u3002<br \/>\n     *  &#8211; \u8fd4\u56de split \u540e\u7684 token \u6570&#xff08;\u5ffd\u7565\u7a7a\u4e32&#xff09;\u3002<br \/>\n     *  &#8211; \u9002\u7528\u4e8e\u4ee5\u7a7a\u683c\u5206\u9694\u7684\u82f1\u6587\/\u62c9\u4e01\u5b57\u6bcd\u6587\u672c&#xff0c;\u4f46\u4e0d\u80fd\u5904\u7406\u5e26\u6807\u70b9\u7684\u590d\u6742\u60c5\u51b5\u3002<br \/>\n     * \u65f6\u95f4\u590d\u6742\u5ea6&#xff1a;O(n)&#xff0c;\u7a7a\u95f4\u590d\u6742\u5ea6&#xff1a;O(k)&#xff08;\u751f\u6210 token \u6570\u7ec4&#xff09;<br \/>\n     *\/<br \/>\n    public static int countBySimpleSplit(String s) {<br \/>\n        if (s &#061;&#061; null) return 0;<br \/>\n        String trimmed &#061; s.trim();<br \/>\n        if (trimmed.isEmpty()) return 0;<br \/>\n        \/\/ \u6309\u4efb\u610f\u7a7a\u767d\u5b57\u7b26\u5e8f\u5217\u5206\u5272&#xff08;\u7a7a\u683c\u3001\u5236\u8868\u7b26\u3001\u6362\u884c\u7b49&#xff09;<br \/>\n        String[] tokens &#061; trimmed.split(&#034;\\\\\\\\s&#043;&#034;);<br \/>\n        return tokens.length;<br \/>\n    }<\/p>\n<p>    \/**<br \/>\n     * \u65b9\u6cd52&#xff1a;\u57fa\u4e8e\u6b63\u5219\u7684\u66f4\u7cbe\u7ec6\u5339\u914d&#xff08;\u652f\u6301\u5b57\u6bcd\u3001\u6570\u5b57\u3001\u6487\u53f7\u3001\u8fde\u5b57\u7b26&#xff09;<br \/>\n     * \u8bf4\u660e&#xff1a;<br \/>\n     *  &#8211; \u4f7f\u7528 Pattern\/Matcher \u9010\u4e2a\u5339\u914d\u201c\u5355\u8bcd\u201d\u7684\u8fb9\u754c&#xff0c;\u800c\u4e0d\u662f\u5168\u5c40 split\u3002<br \/>\n     *  &#8211; \u4e0b\u9762\u7684\u6b63\u5219\u793a\u4f8b&#xff1a;\\\\b[\\\\p{L}\\\\p{Nd}]&#043;(?:[&#039;-][\\\\p{L}\\\\p{Nd}]&#043;)*\\\\b<br \/>\n     *    \u89e3\u91ca&#xff1a;<br \/>\n     *      \\\\p{L} \u4ee3\u8868 Unicode \u5b57\u6bcd\u7c7b\u522b<br \/>\n     *      \\\\p{Nd} \u4ee3\u8868 Unicode \u5341\u8fdb\u5236\u6570\u5b57<br \/>\n     *      (?:[&#039;-][&#8230;]&#043;)* \u5141\u8bb8\u5185\u90e8\u51fa\u73b0\u8fde\u5b57\u7b26\u6216\u6487\u53f7&#xff08;\u4f8b\u5982 don&#039;t, state-of-the-art&#xff09;<br \/>\n     *  &#8211; \u8be5\u89c4\u5219\u53ef\u6839\u636e\u9700\u8981\u8c03\u6574&#xff08;\u4f8b\u5982\u5141\u8bb8\u4e0b\u5212\u7ebf\u3001\u767e\u5206\u53f7\u7b49&#xff09;\u3002<br \/>\n     * \u65f6\u95f4\u590d\u6742\u5ea6&#xff1a;O(n)&#xff08;\u6b63\u5219\u5339\u914d&#xff09;&#xff0c;\u7a7a\u95f4\u590d\u6742\u5ea6&#xff1a;O(1)&#xff08;\u4e0d\u4fdd\u5b58\u6240\u6709 token&#xff09;<br \/>\n     *\/<br \/>\n    public static int countByRegex(String s) {<br \/>\n        if (s &#061;&#061; null) return 0;<br \/>\n        \/\/ \u4ee5 Unicode \u7c7b\u522b\u4e3a\u57fa\u7840\u7684\u6b63\u5219&#xff0c;\u652f\u6301\u591a\u8bed\u8a00\u5b57\u6bcd\u548c\u6570\u5b57<br \/>\n        String regex &#061; &#034;\\\\\\\\b[\\\\\\\\p{L}\\\\\\\\p{Nd}]&#043;(?:[&#039;-][\\\\\\\\p{L}\\\\\\\\p{Nd}]&#043;)*\\\\\\\\b&#034;;<br \/>\n        Pattern p &#061; Pattern.compile(regex);<br \/>\n        Matcher m &#061; p.matcher(s);<br \/>\n        int count &#061; 0;<br \/>\n        while (m.find()) {<br \/>\n            count&#043;&#043;;<br \/>\n        }<br \/>\n        return count;<br \/>\n    }<\/p>\n<p>    \/**<br \/>\n     * \u65b9\u6cd53&#xff1a;\u4f7f\u7528 BreakIterator&#xff08;\u57fa\u4e8e Locale \u7684\u8bcd\u8fb9\u754c\u68c0\u6d4b&#xff09;<br \/>\n     * \u8bf4\u660e&#xff1a;<br \/>\n     *  &#8211; BreakIterator.getWordInstance(locale) \u63d0\u4f9b\u8bed\u8a00\u654f\u611f\u7684\u201c\u5355\u8bcd\u201d\u8fb9\u754c\u68c0\u6d4b\u3002<br \/>\n     *  &#8211; \u8fed\u4ee3\u6240\u6709\u8fb9\u754c\u533a\u95f4 [start, end)&#xff0c;\u5e76\u68c0\u67e5\u8be5\u533a\u95f4\u5185\u662f\u5426\u5305\u542b\u5b57\u6bcd\u6216\u6570\u5b57\u5b57\u7b26&#xff08;\u6392\u9664\u7a7a\u683c\u548c\u6807\u70b9&#xff09;\u3002<br \/>\n     *  &#8211; \u5bf9\u4e8e\u82f1\u6587\u7b49\u6309\u7a7a\u683c\u5206\u8bcd\u7684\u8bed\u8a00&#xff0c;\u6548\u679c\u901a\u5e38\u5f88\u597d&#xff1b;\u5bf9\u4e8e\u4e2d\u6587\u9700\u8981\u66f4\u590d\u6742\u7684\u5206\u8bcd\u5668\u3002<br \/>\n     * \u65f6\u95f4\u590d\u6742\u5ea6&#xff1a;O(n)&#xff0c;\u7a7a\u95f4\u590d\u6742\u5ea6&#xff1a;O(1)<br \/>\n     *\/<br \/>\n    public static int countByBreakIterator(String s, Locale locale) {<br \/>\n        if (s &#061;&#061; null || s.isEmpty()) return 0;<br \/>\n        BreakIterator boundary &#061; BreakIterator.getWordInstance(locale);<br \/>\n        boundary.setText(s);<br \/>\n        int start &#061; boundary.first();<br \/>\n        int count &#061; 0;<br \/>\n        for (int end &#061; boundary.next(); end !&#061; BreakIterator.DONE; start &#061; end, end &#061; boundary.next()) {<br \/>\n            \/\/ \u5b50\u4e32 [start, end)<br \/>\n            String word &#061; s.substring(start, end);<br \/>\n            \/\/ \u53ea\u628a\u542b\u6709\u5b57\u6bcd\u6216\u6570\u5b57\u7684\u7247\u6bb5\u89c6\u4e3a\u5355\u8bcd&#xff08;\u8fc7\u6ee4\u6807\u70b9\u548c\u7a7a\u767d&#xff09;<br \/>\n            boolean hasLetterOrDigit &#061; false;<br \/>\n            for (int i &#061; 0; i &lt; word.length(); i&#043;&#043;) {<br \/>\n                char ch &#061; word.charAt(i);<br \/>\n                if (Character.isLetterOrDigit(ch)) {<br \/>\n                    hasLetterOrDigit &#061; true;<br \/>\n                    break;<br \/>\n                }<br \/>\n            }<br \/>\n            if (hasLetterOrDigit) count&#043;&#043;;<br \/>\n        }<br \/>\n        return count;<br \/>\n    }<\/p>\n<p>    \/**<br \/>\n     * \u65b9\u6cd54&#xff1a;\u6709\u9650\u72b6\u6001\u673a&#xff08;FSM&#xff09;\u9010\u5b57\u7b26\u626b\u63cf&#xff08;\u9c81\u68d2\u3001\u5185\u5b58\u53cb\u597d&#xff09;<br \/>\n     * \u8bf4\u660e&#xff1a;<br \/>\n     *  &#8211; \u5b9a\u4e49\u4e24\u4e2a\u72b6\u6001&#xff1a;IN_WORD&#xff08;\u5f53\u524d\u5728\u5355\u8bcd\u5185\u90e8&#xff09;&#xff0c;OUT_WORD&#xff08;\u5f53\u524d\u4e0d\u5728\u5355\u8bcd\u5185\u90e8&#xff09;\u3002<br \/>\n     *  &#8211; \u904d\u5386\u5b57\u7b26\u4e32\u7684\u6bcf\u4e2a\u5b57\u7b26&#xff1a;\u5982\u679c\u5b57\u7b26\u88ab\u5224\u5b9a\u4e3a\u201c\u8bcd\u5b57\u7b26\u201d&#xff08;\u9ed8\u8ba4\u4f7f\u7528 isLetterOrDigit&#xff09;&#xff0c;\u5219\u8fdb\u5165\/\u4fdd\u6301 IN_WORD&#xff1b;<br \/>\n     *    \u5426\u5219&#xff08;\u7a7a\u767d\u3001\u6807\u70b9&#xff09;&#xff0c;\u82e5\u4e4b\u524d\u5904\u4e8e IN_WORD&#xff0c;\u5219\u8ba1\u6570\u5e76\u5207\u6362\u5230 OUT_WORD\u3002<br \/>\n     *  &#8211; \u7ed3\u675f\u65f6\u82e5\u5904\u4e8e IN_WORD \u5219\u518d\u8ba1\u6570\u4e00\u6b21\u3002<br \/>\n     *  &#8211; \u4f18\u70b9&#xff1a;\u4e0d\u4ea7\u751f\u989d\u5916\u7684\u4e2d\u95f4\u5b57\u7b26\u4e32\u6216\u6570\u7ec4&#xff0c;\u9002\u5408\u957f\u6587\u672c\u6d41\u5f0f\u5904\u7406\u3002<br \/>\n     *  &#8211; \u53ef\u901a\u8fc7\u66ff\u6362 isLetterOrDigit \u5224\u5b9a\u903b\u8f91\u6765\u81ea\u5b9a\u4e49\u4f55\u4e3a\u201c\u8bcd\u5b57\u7b26\u201d\u3002<br \/>\n     *\/<br \/>\n    public static int countByFSM(String s) {<br \/>\n        if (s &#061;&#061; null || s.isEmpty()) return 0;<br \/>\n        final int OUT_WORD &#061; 0;<br \/>\n        final int IN_WORD &#061; 1;<br \/>\n        int state &#061; OUT_WORD;<br \/>\n        int count &#061; 0;<br \/>\n        for (int i &#061; 0; i &lt; s.length(); i&#043;&#043;) {<br \/>\n            char ch &#061; s.charAt(i);<br \/>\n            boolean isWordChar &#061; Character.isLetterOrDigit(ch); \/\/ \u53ef\u66ff\u6362\u4e3a\u66f4\u590d\u6742\u5224\u65ad<br \/>\n            if (isWordChar) {<br \/>\n                if (state &#061;&#061; OUT_WORD) {<br \/>\n                    state &#061; IN_WORD; \/\/ \u5355\u8bcd\u5f00\u59cb<br \/>\n                }<br \/>\n                \/\/ \u82e5\u5df2\u7ecf\u5728 IN_WORD&#xff0c;\u7ee7\u7eed<br \/>\n            } else {<br \/>\n                if (state &#061;&#061; IN_WORD) {<br \/>\n                    count&#043;&#043;; \/\/ \u5355\u8bcd\u7ed3\u675f<br \/>\n                    state &#061; OUT_WORD;<br \/>\n                }<br \/>\n            }<br \/>\n        }<br \/>\n        if (state &#061;&#061; IN_WORD) count&#043;&#043;; \/\/ \u5b57\u7b26\u4e32\u672b\u5c3e\u7684\u5355\u8bcd<br \/>\n        return count;<br \/>\n    }<\/p>\n<p>    \/**<br \/>\n     * \u65b9\u6cd55&#xff1a;Scanner \u6f14\u793a&#xff08;\u7b80\u6377\u4f46\u9700\u6ce8\u610f\u5206\u9694\u7b26\u548c\u6e05\u6d17&#xff09;<br \/>\n     * \u8bf4\u660e&#xff1a;<br \/>\n     *  &#8211; Scanner \u53ef\u4ee5\u901a\u8fc7 useDelimiter \u8bbe\u7f6e\u5206\u9694\u7b26&#xff0c;\u8fd9\u91cc\u793a\u4f8b\u4f7f\u7528\u9ed8\u8ba4\u7684\u5206\u9694\u7b26&#xff08;\u7a7a\u767d&#xff09;\u3002<br \/>\n     *  &#8211; \u5bf9\u4e8e\u542b\u6807\u70b9\u7684 token&#xff0c;\u9700\u8fdb\u4e00\u6b65\u6e05\u6d17&#xff08;\u4f8b\u5982\u53bb\u6389\u4e24\u7aef\u6807\u70b9&#xff09;\u4ee5\u5f97\u5230\u66f4\u7cbe\u786e\u7684\u5355\u8bcd\u3002<br \/>\n     *  &#8211; Scanner \u5728\u6784\u9020\u5927\u91cf\u5bf9\u8c61\u6216\u9ad8\u5e76\u53d1\u573a\u666f\u53ef\u80fd\u4e0d\u53ca\u7b80\u5355 FSM \u6548\u7387\u9ad8\u3002<br \/>\n     *\/<br \/>\n    public static int countByScanner(String s) {<br \/>\n        if (s &#061;&#061; null) return 0;<br \/>\n        int count &#061; 0;<br \/>\n        Scanner scanner &#061; new Scanner(s);<br \/>\n        \/\/ \u9ed8\u8ba4\u5206\u9694\u7b26\u4e3a\u7a7a\u767d&#xff0c;\u6a21\u62df\u7b80\u5355\u7684\u7a7a\u767d\u5206\u5272\u8ba1\u6570<br \/>\n        while (scanner.hasNext()) {<br \/>\n            String token &#061; scanner.next();<br \/>\n            \/\/ \u53ef\u505a\u8fdb\u4e00\u6b65\u6e05\u6d17&#xff1a;\u53bb\u6389\u4e24\u7aef\u6807\u70b9<br \/>\n            token &#061; token.replaceAll(&#034;^[\\\\\\\\p{Punct}]&#043;|[\\\\\\\\p{Punct}]&#043;$&#034;, &#034;&#034;);<br \/>\n            if (!token.isEmpty()) count&#043;&#043;;<br \/>\n        }<br \/>\n        scanner.close();<br \/>\n        return count;<br \/>\n    }<\/p>\n<p>    \/**<br \/>\n     * \u65b9\u6cd56&#xff1a;\u5bf9\u4e2d\u6587\/\u65e5\u6587\u7b49\u65e0\u7a7a\u683c\u8bed\u8a00\u7684\u7b80\u6613\u7b56\u7565&#xff08;\u6559\u5b66\u6f14\u793a&#xff09;<br \/>\n     * \u8bf4\u660e&#xff1a;<br \/>\n     *  &#8211; \u5bf9\u4e8e\u4e2d\u6587\/\u65e5\u6587&#xff0c;\u5355\u7eaf\u6309\u7a7a\u683c\u6216 \\\\p{L} \u5e76\u4e0d\u8db3\u4ee5\u5f97\u5230\u8bcd\u7ea7\u5206\u5272\u3002\u6700\u51c6\u786e\u7684\u65b9\u6cd5\u662f\u4f7f\u7528\u5206\u8bcd\u5668&#xff08;\u5982 jieba, HanLP \u7b49&#xff09;\u3002<br \/>\n     *  &#8211; \u8fd9\u91cc\u63d0\u4f9b\u4e00\u4e2a\u975e\u5e38\u7b80\u5316\u7684\u7b56\u7565&#xff1a;\u628a\u8fde\u7eed\u7684\u6c49\u5b57\u5e8f\u5217\u89c6\u4e3a\u4e00\u4e2a\u201c\u8bcd\u201d&#xff0c;\u4f7f\u7528 Unicode Block \u5224\u65ad\u662f\u5426\u4e3a CJK\u3002<br \/>\n     *  &#8211; \u8be5\u65b9\u6cd5\u4ec5\u4e3a\u6559\u5b66\u7528\u9014&#xff0c;\u4e0d\u80fd\u66ff\u4ee3\u771f\u6b63\u7684\u5206\u8bcd\u5668\u3002<br \/>\n     *\/<br \/>\n    public static int countChineseByChar(String s) {<br \/>\n        if (s &#061;&#061; null || s.isEmpty()) return 0;<br \/>\n        int count &#061; 0;<br \/>\n        boolean inHan &#061; false;<br \/>\n        for (int i &#061; 0; i &lt; s.length(); i&#043;&#043;) {<br \/>\n            char ch &#061; s.charAt(i);<br \/>\n            boolean isHan &#061; Character.UnicodeBlock.of(ch) &#061;&#061; Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS<br \/>\n                    || Character.UnicodeBlock.of(ch) &#061;&#061; Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A<br \/>\n                    || Character.UnicodeBlock.of(ch) &#061;&#061; Character.UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS<br \/>\n                    || Character.UnicodeBlock.of(ch) &#061;&#061; Character.UnicodeBlock.CJK_SYMBOLS_AND_PUNCTUATION;<br \/>\n            if (isHan) {<br \/>\n                if (!inHan) {<br \/>\n                    inHan &#061; true;<br \/>\n                    count&#043;&#043;;<br \/>\n                }<br \/>\n            } else {<br \/>\n                inHan &#061; false;<br \/>\n            }<br \/>\n        }<br \/>\n        return count;<br \/>\n    }<br \/>\n}<\/p>\n<p>\/\/ File: Main.java<br \/>\n\/\/ \u6f14\u793a\u5404\u79cd\u65b9\u6cd5\u7684\u6548\u679c\u4e0e\u5bf9\u6bd4&#xff0c;\u542b\u591a\u79cd\u6d4b\u8bd5\u7528\u4f8b&#xff0c;\u9002\u5408\u8bfe\u5802\u8fd0\u884c\u548c\u73b0\u573a\u8bb2\u89e3\u3002<\/p>\n<p>import java.util.Locale;<br \/>\nimport java.nio.charset.StandardCharsets;<\/p>\n<p>public class Main {<br \/>\n    public static void main(String[] args) {<br \/>\n        String s1 &#061; &#034;Hello, world! This is a test.&#034;;<br \/>\n        String s2 &#061; &#034;Don&#039;t stop-believing: it&#039;s state-of-the-art.&#034;;<br \/>\n        String s3 &#061; &#034;O&#039;Reilly&#039;s book on C&#043;&#043;: 100% practical.&#034;;<br \/>\n        String s4 &#061; &#034;\u6df7\u5408 English \u548c \u4e2d\u6587 \u7684\u53e5\u5b50\u3002\u6d4b\u8bd5\u5206\u8bcd\u3002&#034;;<br \/>\n        String s5 &#061; &#034;\u8fd9\u662f\u4e2d\u6587\u6ca1\u6709\u7a7a\u683c\u7684\u53e5\u5b50&#xff0c;\u7528\u4e8e\u6f14\u793a\u7b80\u6613\u6c49\u5b57\u7edf\u8ba1\u3002&#034;;<\/p>\n<p>        System.out.println(&#034;\u793a\u4f8b\u6587\u672c\u53ca\u5404\u79cd\u65b9\u6cd5\u7684\u8ba1\u6570\u7ed3\u679c&#xff1a;\\\\n&#034;);<\/p>\n<p>        demo(s1);<br \/>\n        demo(s2);<br \/>\n        demo(s3);<br \/>\n        demo(s4);<br \/>\n        demo(s5);<br \/>\n    }<\/p>\n<p>    private static void demo(String s) {<br \/>\n        System.out.println(&#034;\u539f\u6587: &#034; &#043; s);<br \/>\n        System.out.println(&#034;1) SimpleSplit: &#034; &#043; WordCountUtils.countBySimpleSplit(s));<br \/>\n        System.out.println(&#034;2) Regex: &#034; &#043; WordCountUtils.countByRegex(s));<br \/>\n        System.out.println(&#034;3) BreakIterator (Locale.ENGLISH): &#034; &#043; WordCountUtils.countByBreakIterator(s, Locale.ENGLISH));<br \/>\n        System.out.println(&#034;4) FSM: &#034; &#043; WordCountUtils.countByFSM(s));<br \/>\n        System.out.println(&#034;5) Scanner: &#034; &#043; WordCountUtils.countByScanner(s));<br \/>\n        System.out.println(&#034;6) Chinese simple (\u6c49\u5b57\u5e8f\u5217\u8ba1\u6570): &#034; &#043; WordCountUtils.countChineseByChar(s));<br \/>\n        System.out.println(&#034;&#8212;-\\\\n&#034;);<br \/>\n    }<br \/>\n}<\/p>\n<h3>6. \u4ee3\u7801\u8be6\u7ec6\u89e3\u8bfb<\/h3>\n<p>&#xff08;\u4e0b\u5217\u8bf4\u660e\u4ec5\u63cf\u8ff0\u6bcf\u4e2a\u65b9\u6cd5\u7684\u529f\u80fd\u4e0e\u9002\u7528\u573a\u666f&#xff0c;\u4e0d\u91cd\u590d\u4ee3\u7801\u5b9e\u73b0\u7ec6\u8282\u3002&#xff09;<\/p>\n<ul>\n<li>\n<p>countBySimpleSplit(String s)&#xff1a;\u5bf9\u5b57\u7b26\u4e32 s \u505a trim() \u540e\u4ee5\u7a7a\u767d\u5b57\u7b26\u4e32&#xff08;\\\\\\\\s&#043;&#xff09;\u5206\u5272\u5e76\u8fd4\u56de token \u6570\u3002\u8fd9\u662f\u6700\u76f4\u89c2\u7684\u5b9e\u73b0&#xff0c;\u9002\u5408\u7eaf\u82f1\u6587\u4e14\u4ee5\u7a7a\u683c\u5206\u9694\u7684\u6587\u672c&#xff0c;\u4f46\u5bf9\u6807\u70b9\u3001\u6487\u53f7\u3001\u8fde\u5b57\u7b26\u6ca1\u6709\u7279\u6b8a\u5904\u7406\u3002<\/p>\n<\/li>\n<li>\n<p>countByRegex(String s)&#xff1a;\u4f7f\u7528\u57fa\u4e8e Unicode \u7c7b\u522b\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u5339\u914d\u5355\u8bcd&#xff08;\u652f\u6301\u5b57\u6bcd\u3001\u6570\u5b57\u3001\u5185\u90e8\u6487\u53f7\u6216\u8fde\u5b57\u7b26&#xff09;&#xff0c;\u7528 Matcher.find() \u9010\u4e2a\u8ba1\u6570\u3002\u9002\u7528\u4e8e\u9700\u8981\u7075\u6d3b\u63a7\u5236\u201c\u4ec0\u4e48\u7b97\u4f5c\u5355\u8bcd\u201d\u7684\u573a\u666f&#xff08;\u4f8b\u5982\u5141\u8bb8 don&#039;t\u3001state-of-the-art&#xff09;\u7684\u82f1\u6587\u6587\u672c\u3002<\/p>\n<\/li>\n<li>\n<p>countByBreakIterator(String s, Locale locale)&#xff1a;\u5229\u7528 BreakIterator.getWordInstance(locale) \u83b7\u53d6\u8bed\u8a00\u654f\u611f\u7684\u8bcd\u8fb9\u754c&#xff0c;\u904d\u5386\u8fb9\u754c\u5e76\u7b5b\u9009\u542b\u5b57\u6bcd\u6216\u6570\u5b57\u7684\u533a\u95f4\u4f5c\u4e3a\u5355\u8bcd\u3002\u9002\u5408\u56fd\u9645\u5316\u6587\u672c&#xff0c;\u4f18\u70b9\u662f\u51cf\u5c11\u5bf9\u7b80\u5355\u6b63\u5219\u7684\u624b\u5199\u5224\u65ad&#xff0c;\u4f9d\u8d56 JVM \u63d0\u4f9b\u7684\u8bcd\u8fb9\u754c\u89c4\u5219\u3002<\/p>\n<\/li>\n<li>\n<p>countByFSM(String s)&#xff1a;\u4f7f\u7528\u6709\u9650\u72b6\u6001\u673a&#xff08;IN_WORD \/ OUT_WORD&#xff09;\u5bf9\u5b57\u7b26\u4e32\u9010\u5b57\u7b26\u626b\u63cf&#xff0c;\u901a\u8fc7 Character.isLetterOrDigit \u5224\u65ad\u8bcd\u5b57\u7b26&#xff0c;\u4ece\u800c\u4ee5\u6d41\u5f0f\u3001\u5185\u5b58\u53cb\u597d\u7684\u65b9\u5f0f\u7edf\u8ba1\u5355\u8bcd\u6570\u3002\u9002\u5408\u957f\u6587\u672c\u6216\u6d41\u5f0f\u5904\u7406\u573a\u666f&#xff0c;\u4fbf\u4e8e\u5b9a\u5236\u201c\u8bcd\u5b57\u7b26\u201d\u5224\u5b9a\u7b56\u7565\u3002<\/p>\n<\/li>\n<li>\n<p>countByScanner(String s)&#xff1a;\u6f14\u793a Scanner \u7684\u57fa\u672c\u4f7f\u7528&#xff08;\u9ed8\u8ba4\u6309\u7a7a\u767d\u5206\u9694&#xff09;&#xff0c;\u5e76\u6f14\u793a\u5bf9 token \u505a\u4e24\u7aef\u6807\u70b9\u6e05\u6d17\u540e\u8ba1\u6570\u3002\u9002\u5408\u5feb\u901f\u5b9e\u73b0\u548c\u7b80\u5355\u811a\u672c&#xff0c;\u4f46\u5728\u6027\u80fd\/\u7075\u6d3b\u6027\u4e0a\u4e0d\u5982 FSM \u6216 BreakIterator\u3002<\/p>\n<\/li>\n<li>\n<p>countChineseByChar(String s)&#xff1a;\u5bf9\u4e2d\u6587\/\u65e5\u6587\u7b49\u65e0\u7a7a\u683c\u8bed\u8a00\u63d0\u4f9b\u7684\u6781\u7b80\u7b56\u7565&#xff1a;\u628a\u8fde\u7eed\u7684\u6c49\u5b57\u5e8f\u5217\u89c6\u4e3a\u4e00\u4e2a\u8bcd&#xff08;\u901a\u8fc7 UnicodeBlock \u5224\u65ad CJK \u5b57\u7b26&#xff09;&#xff0c;\u4ec5\u7528\u4e8e\u6559\u5b66\u6f14\u793a\u3002\u771f\u5b9e\u573a\u666f\u5efa\u8bae\u4f7f\u7528\u4e13\u95e8\u7684\u5206\u8bcd\u5e93&#xff08;\u5982 Jieba\u3001HanLP\u3001IKAnalyzer \u7b49&#xff09;\u6765\u5f97\u5230\u8bcd\u7ea7\u5212\u5206\u3002<\/p>\n<\/li>\n<\/ul>\n<hr \/>\n<h3>7. \u9879\u76ee\u8be6\u7ec6\u603b\u7ed3<\/h3>\n<p>\u672c\u6587\u4ece\u591a\u4e2a\u89d2\u5ea6\u5b9e\u73b0\u5e76\u8bb2\u89e3\u4e86\u201c\u7edf\u8ba1\u6307\u5b9a\u5b57\u7b26\u4e32\u4e2d\u5355\u8bcd\u4e2a\u6570\u201d\u7684\u95ee\u9898\u3002\u5173\u952e\u8981\u70b9&#xff1a;<\/p>\n<li>\n<p>\u201c\u5355\u8bcd\u201d\u7684\u5b9a\u4e49\u51b3\u5b9a\u7b97\u6cd5\u590d\u6742\u5ea6&#xff1a;\u5728\u4e0d\u540c\u8bed\u8a00\u4e0e\u4e1a\u52a1\u573a\u666f\u4e0b\u201c\u5355\u8bcd\u201d\u542b\u4e49\u4e0d\u540c\u2014\u2014\u82f1\u6587\u4e2d\u901a\u5e38\u4ee5\u7a7a\u767d\/\u6807\u70b9\u5206\u5272&#xff0c;\u800c\u4e2d\u6587\u9700\u8981\u5206\u8bcd\u5e93&#xff0c;\u4e13\u4e1a\u672f\u8bed\u6216\u7f29\u5199&#xff08;\u5982 e-mail\u3001O&#039;Reilly&#xff09;\u4f1a\u5bfc\u81f4\u7b80\u5355\u65b9\u6cd5\u5931\u6548\u3002<\/p>\n<\/li>\n<li>\n<p>\u591a\u79cd\u5b9e\u73b0\u5404\u6709\u4f18\u7f3a\u70b9&#xff1a;<\/p>\n<ul>\n<li>\n<p>split&#xff1a;\u6700\u7b80\u5355&#xff0c;\u4f46\u5bf9\u6807\u70b9\/\u7f29\u5199\/\u8fde\u5b57\u7b26\u9c81\u68d2\u6027\u5dee&#xff1b;<\/p>\n<\/li>\n<li>\n<p>regex&#xff1a;\u7075\u6d3b\u53ef\u63a7&#xff0c;\u4f46\u6b63\u5219\u590d\u6742\u4e14\u7ef4\u62a4\u6210\u672c\u9ad8&#xff1b;<\/p>\n<\/li>\n<li>\n<p>BreakIterator&#xff1a;\u672c\u5730\u5316\u8868\u73b0\u66f4\u597d&#xff0c;\u63a8\u8350\u7528\u4e8e\u591a\u8bed\u8a00\u73af\u5883&#xff1b;<\/p>\n<\/li>\n<li>\n<p>FSM&#xff1a;\u5185\u5b58\u53cb\u597d\u3001\u6027\u80fd\u7a33\u5b9a&#xff0c;\u9002\u5408\u6d41\u5f0f\u5904\u7406\u548c\u5927\u6587\u672c&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u4e2d\u6587\u7b49\u65e0\u7a7a\u683c\u8bed\u8a00\u9700\u8981\u5206\u8bcd\u5668\u652f\u6301\u3002<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u6027\u80fd\u8003\u8651&#xff1a;\u5bf9\u77ed\u6587\u672c\u4e09\u79cd\u65b9\u6cd5\u5dee\u522b\u4e0d\u5927&#xff1b;\u5bf9\u8d85\u957f\u6587\u672c\u6216\u9ad8\u541e\u5410\u573a\u666f&#xff0c;\u5e94\u4f18\u5148\u4f7f\u7528 FSM \u6216\u8868\u9a71\u52a8\/\u6d41\u5f0f\u65b9\u6cd5&#xff0c;\u907f\u514d split \u4ea7\u751f\u5927\u91cf\u4e2d\u95f4\u5bf9\u8c61\u3002<\/p>\n<\/li>\n<li>\n<p>\u5de5\u7a0b\u5efa\u8bae&#xff1a;\u9ed8\u8ba4\u60c5\u51b5\u53ef\u91c7\u7528 BreakIterator&#xff08;\u56fd\u9645\u5316&#xff09;\u6216 FSM&#xff08;\u9ad8\u6027\u80fd\u901a\u7528&#xff09;&#xff1b;\u5bf9\u4e2d\u6587\/\u65e5\u6587\u6216\u9700\u8981\u8bed\u4e49\u7ea7\u5206\u8bcd\u7684\u573a\u666f&#xff0c;\u63a5\u5165\u6210\u719f\u5206\u8bcd\u5e93\u5e76\u505a\u505c\u7528\u8bcd\/\u8bcd\u5f62\u8fd8\u539f\u7b49\u9884\u5904\u7406\u3002<\/p>\n<\/li>\n<hr \/>\n<h3>8. \u9879\u76ee\u5e38\u89c1\u95ee\u9898\u53ca\u89e3\u7b54<\/h3>\n<p>Q1&#xff1a;\u4e3a\u4ec0\u4e48 split(&#034;\\\\\\\\s&#043;&#034;) \u6709\u65f6\u4f1a\u591a\u7b97\u6216\u5c11\u7b97\u5355\u8bcd&#xff1f;<br \/>\nA1&#xff1a;\u56e0\u4e3a\u5b83\u53ea\u6309\u7a7a\u767d\u5206\u5272&#xff0c;\u4e0d\u4f1a\u5254\u9664\u6807\u70b9\u6216\u8bc6\u522b\u7f29\u5199\u4e0e\u8fde\u5b57\u7b26&#xff0c;\u5bfc\u81f4 &#034;hello,&#034; \u4f1a\u4f5c\u4e3a &#034;hello,&#034;&#xff08;\u542b\u9017\u53f7&#xff09;\u8ba1\u6570\u4e3a\u4e00\u4e2a token&#xff0c;\u4f46\u5982\u679c\u4f60\u8981\u6c42\u5254\u9664\u6807\u70b9\u5c31\u9700\u989d\u5916\u6e05\u6d17\u6216\u7528\u6b63\u5219\u5339\u914d\u3002<\/p>\n<p>Q2&#xff1a;BreakIterator \u80fd\u5426\u5b8c\u7f8e\u5904\u7406\u591a\u8bed\u8a00&#xff1f;<br \/>\nA2&#xff1a;BreakIterator \u63d0\u4f9b\u4e86\u8bed\u8a00\u654f\u611f\u7684\u8fb9\u754c\u68c0\u6d4b&#xff0c;\u5bf9\u4e8e\u82f1\u6587\u3001\u6cd5\u6587\u7b49\u57fa\u4e8e\u7a7a\u683c\u7684\u8bed\u8a00\u8868\u73b0\u826f\u597d&#xff0c;\u4f46\u5bf9\u4e2d\u6587\/\u65e5\u6587\u7b49\u65e0\u7a7a\u683c\u7684\u8bed\u8a00\u5e76\u4e0d\u6267\u884c\u8bed\u4e49\u5206\u8bcd&#xff08;\u4ec5\u80fd\u68c0\u6d4b\u5b57\u7b26\/\u6807\u70b9&#xff09;&#xff0c;\u4ecd\u5efa\u8bae\u4f7f\u7528\u5206\u8bcd\u5668\u3002<\/p>\n<p>Q3&#xff1a;FSM \u662f\u5426\u80fd\u5904\u7406 Unicode \u8f83\u590d\u6742\u7684\u60c5\u51b5&#xff1f;<br \/>\nA3&#xff1a;\u53ef\u4ee5&#xff0c;\u4f46 Character.isLetterOrDigit \u662f\u8f83\u4fdd\u5b88\u7684\u5224\u65ad\u3002\u5177\u4f53\u4e1a\u52a1\u53ef\u6269\u5c55\u5224\u5b9a\u89c4\u5219&#xff08;\u4f8b\u5982\u628a\u6487\u53f7\u3001\u8fde\u5b57\u7b26\u89c6\u4e3a\u8bcd\u5185\u5b57\u7b26&#xff09;&#xff0c;\u4e5f\u53ef\u6839\u636e UnicodeBlock \u8fdb\u4e00\u6b65\u7ec6\u5206\u3002<\/p>\n<p>Q4&#xff1a;\u5982\u4f55\u7edf\u8ba1\u5e26 HTML \u6807\u7b7e\u6216\u5b9e\u4f53\u7684\u6587\u672c\u4e2d\u7684\u5355\u8bcd&#xff1f;<br \/>\nA4&#xff1a;\u5148\u8fdb\u884c\u9884\u5904\u7406&#xff1a;\u5265\u79bb HTML \u6807\u7b7e&#xff08;\u4f8b\u5982\u4f7f\u7528 Jsoup&#xff09;&#xff0c;\u5c06\u5b9e\u4f53\u8f6c\u4e3a\u6587\u672c&#xff0c;\u518d\u5bf9\u7eaf\u6587\u672c\u505a\u5355\u8bcd\u7edf\u8ba1\u3002<\/p>\n<p>Q5&#xff1a;\u5982\u4f55\u5904\u7406\u7f29\u5199\u3001\u6570\u5b57\u3001\u5e26\u767e\u5206\u53f7\u6216\u7279\u6b8a\u7b26\u53f7\u7684 token&#xff1f;<br \/>\nA5&#xff1a;\u8fd9\u5c5e\u4e8e\u4e1a\u52a1\u89c4\u5219&#xff0c;\u9700\u8981\u5b9a\u4e49\u54ea\u4e9b\u7b26\u53f7\u5141\u8bb8\u51fa\u73b0\u5728\u5355\u8bcd\u5185\u90e8&#xff08;\u5982 3rd, 50%, e-mail&#xff09;&#xff0c;\u5e76\u636e\u6b64\u8c03\u6574\u6b63\u5219\u6216 FSM \u5224\u5b9a\u903b\u8f91\u3002<\/p>\n<hr \/>\n<h3>9. \u6269\u5c55\u65b9\u5411\u4e0e\u6027\u80fd\u4f18\u5316<\/h3>\n<li>\n<p>\u5206\u8bcd\u5e93\u96c6\u6210&#xff08;\u4e2d\u6587\/\u65e5\u6587\/\u97e9\u6587&#xff09;&#xff1a;\u96c6\u6210 Jieba\/HanLP\/IKAnalyzer \u7b49\u80fd\u7ed9\u51fa\u8bcd\u7ea7\u5206\u5272\u5e76\u652f\u6301\u505c\u7528\u8bcd\u3001\u8bcd\u6027\u6807\u6ce8\u4e0e\u547d\u540d\u5b9e\u4f53\u8bc6\u522b\u3002<\/p>\n<\/li>\n<li>\n<p>\u6d41\u5f0f\/\u5e76\u884c\u5904\u7406&#xff1a;\u5bf9\u5927\u6587\u4ef6\u6216\u65e5\u5fd7\u6d41\u5206\u5757\u5e76\u53d1\u5904\u7406&#xff0c;\u6ce8\u610f\u5206\u5757\u8fb9\u754c\u5904\u7684\u5355\u8bcd\u65ad\u88c2\u95ee\u9898&#xff08;\u9700 carry-over \u7247\u6bb5&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>\u66f4\u7cbe\u7ec6\u7684 Unicode \u652f\u6301&#xff1a;\u8003\u8651\u590d\u5408\u5b57\u7b26&#xff08;combining marks&#xff09;\u3001emoji&#xff08;\u8868\u60c5\u7b26\u53f7&#xff09;\u4ee5\u53ca\u53f3\u5230\u5de6\u6587\u5b57&#xff08;RTL&#xff09;\u5904\u7406\u3002<\/p>\n<\/li>\n<li>\n<p>\u8bed\u4e49\u5316\u5206\u8bcd&#xff1a;\u5728\u9700\u8981\u8bed\u4e49\u5206\u6790\u573a\u666f\u4e0b&#xff0c;\u5f15\u5165\u8bcd\u5f62\u8fd8\u539f&#xff08;lemmatization&#xff09;\u4e0e\u53bb\u9664\u505c\u7528\u8bcd\u4ee5\u83b7\u5f97\u66f4\u6709\u610f\u4e49\u7684\u201c\u5355\u8bcd\u8ba1\u6570\u201d\u3002<\/p>\n<\/li>\n<li>\n<p>\u5185\u5b58\u4f18\u5316&#xff1a;\u907f\u514d split \u7b49\u521b\u5efa\u5927\u91cf\u4e2d\u95f4\u5bf9\u8c61&#xff0c;\u6539\u7528 FSM\/BreakIterator \u6216 streaming API&#xff08;\u9010\u5757\u8bfb\u53d6\u5e76\u5904\u7406&#xff09;\u4ee5\u964d\u4f4e GC \u538b\u529b\u3002<\/p>\n<\/li>\n<li>\n<p>\u57fa\u51c6\u6d4b\u8bd5&#xff1a;\u4f7f\u7528 JMH \u5bf9\u591a\u79cd\u5b9e\u73b0\u8fdb\u884c\u57fa\u51c6\u6d4b\u8bd5&#xff08;\u4e0d\u540c\u8f93\u5165\u957f\u5ea6\u3001\u4e0d\u540c\u8bed\u8a00&#xff09;&#xff0c;\u627e\u51fa\u5728\u76ee\u6807\u573a\u666f\u4e0b\u6700\u4f18\u7684\u5b9e\u73b0\u3002<\/p>\n<\/li>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb715\u6b21\uff0c\u70b9\u8d5e32\u6b21\uff0c\u6536\u85cf27\u6b21\u3002JAVA:\u5b9e\u73b0\u6307\u5b9a\u5b57\u7b26\u4e32\u4e2d\u7684\u5355\u8bcd\u7684\u4e2a\u6570\u7b97\u6cd5\uff08\u9644\u5e26\u6e90\u7801\uff09<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[99,5373,190,427],"topic":[],"class_list":{"0":"post-55652","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"hentry","6":"category-server","7":"tag-java","9":"tag-190","10":"tag-427"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>JAVA:\u5b9e\u73b0\u6307\u5b9a\u5b57\u7b26\u4e32\u4e2d\u7684\u5355\u8bcd\u7684\u4e2a\u6570\u7b97\u6cd5\uff08\u9644\u5e26\u6e90\u7801\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/55652.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JAVA:\u5b9e\u73b0\u6307\u5b9a\u5b57\u7b26\u4e32\u4e2d\u7684\u5355\u8bcd\u7684\u4e2a\u6570\u7b97\u6cd5\uff08\u9644\u5e26\u6e90\u7801\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb715\u6b21\uff0c\u70b9\u8d5e32\u6b21\uff0c\u6536\u85cf27\u6b21\u3002JAVA:\u5b9e\u73b0\u6307\u5b9a\u5b57\u7b26\u4e32\u4e2d\u7684\u5355\u8bcd\u7684\u4e2a\u6570\u7b97\u6cd5\uff08\u9644\u5e26\u6e90\u7801\uff09\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/55652.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-08-13T22:44:34+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/55652.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/55652.html\",\"name\":\"JAVA:\u5b9e\u73b0\u6307\u5b9a\u5b57\u7b26\u4e32\u4e2d\u7684\u5355\u8bcd\u7684\u4e2a\u6570\u7b97\u6cd5\uff08\u9644\u5e26\u6e90\u7801\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-08-13T22:44:34+00:00\",\"dateModified\":\"2025-08-13T22:44:34+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/55652.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/55652.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/55652.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"JAVA:\u5b9e\u73b0\u6307\u5b9a\u5b57\u7b26\u4e32\u4e2d\u7684\u5355\u8bcd\u7684\u4e2a\u6570\u7b97\u6cd5\uff08\u9644\u5e26\u6e90\u7801\uff09\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"JAVA:\u5b9e\u73b0\u6307\u5b9a\u5b57\u7b26\u4e32\u4e2d\u7684\u5355\u8bcd\u7684\u4e2a\u6570\u7b97\u6cd5\uff08\u9644\u5e26\u6e90\u7801\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/55652.html","og_locale":"zh_CN","og_type":"article","og_title":"JAVA:\u5b9e\u73b0\u6307\u5b9a\u5b57\u7b26\u4e32\u4e2d\u7684\u5355\u8bcd\u7684\u4e2a\u6570\u7b97\u6cd5\uff08\u9644\u5e26\u6e90\u7801\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb715\u6b21\uff0c\u70b9\u8d5e32\u6b21\uff0c\u6536\u85cf27\u6b21\u3002JAVA:\u5b9e\u73b0\u6307\u5b9a\u5b57\u7b26\u4e32\u4e2d\u7684\u5355\u8bcd\u7684\u4e2a\u6570\u7b97\u6cd5\uff08\u9644\u5e26\u6e90\u7801\uff09","og_url":"https:\/\/www.wsisp.com\/helps\/55652.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-08-13T22:44:34+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"7 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/55652.html","url":"https:\/\/www.wsisp.com\/helps\/55652.html","name":"JAVA:\u5b9e\u73b0\u6307\u5b9a\u5b57\u7b26\u4e32\u4e2d\u7684\u5355\u8bcd\u7684\u4e2a\u6570\u7b97\u6cd5\uff08\u9644\u5e26\u6e90\u7801\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-08-13T22:44:34+00:00","dateModified":"2025-08-13T22:44:34+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/55652.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/55652.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/55652.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"JAVA:\u5b9e\u73b0\u6307\u5b9a\u5b57\u7b26\u4e32\u4e2d\u7684\u5355\u8bcd\u7684\u4e2a\u6570\u7b97\u6cd5\uff08\u9644\u5e26\u6e90\u7801\uff09"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/55652","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=55652"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/55652\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=55652"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=55652"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=55652"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=55652"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}