{"id":1507,"date":"2023-02-13T09:54:31","date_gmt":"2023-02-13T01:54:31","guid":{"rendered":"http:\/\/www.algmain.com\/?page_id=1507"},"modified":"2023-02-13T13:52:15","modified_gmt":"2023-02-13T05:52:15","slug":"mad-max","status":"publish","type":"page","link":"http:\/\/www.algmain.com\/index.php\/nlp-history\/basic-work\/mad-max\/","title":{"rendered":"\u75af\u72c2\u7684\u9ea6\u514b\u65af"},"content":{"rendered":"\n<p>\u672c\u7ae0\u5c06\u4ecb\u7ecdC#\u591a\u4efb\u52a1\u5728\u6570\u636e\u7edf\u8ba1\u5206\u6790\u4e0a\u7684\u5e94\u7528\u3002\u53e6\u5916\uff0c\u4f5c\u8005\u4ece\u4e00\u4e2a\u4fa7\u9762\u8868\u8fbe\u4e00\u4e0b\uff1aNLP\u4e2d\u7684\u8ba1\u7b97\u91cf\u662f\u76f8\u5f53\u201c\u6050\u6016\u201d\u7684\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e00\u3001\u57fa\u672c\u60c5\u51b5<\/h2>\n\n\n\n<p>\u539f\u59cb\u8bed\u6599\u5206\u4e3a\u4e24\u4e2a\u90e8\u5206\uff1a\uff081\uff09\u8bed\u6599\u5e93\uff1b\uff082\uff09\u5b57\u5178\u5e93\u3002<br>\u5176\u4e2d\u8bed\u6599\u6570\u636e\u603b\u8ba110,101,283\u6761\uff0c\u603b\u8ba1977,485,287\u4e2a\u5b57\u7b26\u3002\u5b57\u5178\u4e0d\u91cd\u590d\u8bb0\u5f5512,926,204\u6761\u3002<\/p>\n\n\n\n<p>\u901a\u8fc7\u5bf9\u8bed\u6599\u5e93\u7684\u7edf\u8ba1\u5206\u6790\uff0c\u83b7\u5f97\u5b57\u7b26\u5171\u8ba112692\u4e2aUnicode\uff08\u5305\u62ec\u7279\u6b8a\u5b57\u7b26\uff09\u3002<br>\u901a\u8fc7\u5bf9\u8bed\u6599\u5e93\u7684\u7edf\u8ba1\u5206\u6790\uff0c\u5171\u83b7\u5f9748,218,815\u4e0d\u540c\u7684\u201c\u77ed\u53e5\u201d\u3002\u6240\u8c13\u77ed\u53e5\u5c31\u662f\u5b8c\u6574\u53e5\u5b50\u4e2d\u76f8\u5bf9\u5b8c\u6574\u7684\u4e00\u90e8\u5206\u3002<\/p>\n\n\n\n<p>\u4f8b\u5982\uff1a<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n\u201c\u4f60\u6839\u672c\u4e0d\u77e5\u9053\u4f60\u81ea\u5df1\u7684\u4ef7\u503c\uff0c\u201d\u67ef\u6797\u65af\u592a\u592a\u7b11\u7740\u8bf4\uff0e\u201c\u50cf\u4f60\u8fd9\u6837\u76f4\u7387\u7684\u4eba\u62b5\u5f97\u4e0a\u4e00\u767e\u4e2a\u8c08\u5410\u6e29\u6587\u5c14\u96c5\u7684\u98ce\u6d41\u7537\u5b50\u3002\u201d\n<\/pre><\/div>\n\n\n<p>\u90a3\u4e48\u53ef\u4ee5\u4ece\u8fd9\u4e2a\u53e5\u5b50\u4e2d\u83b7\u5f97\u4e09\u4e2a\u77ed\u53e5\uff1a\u201c\u4f60\u6839\u672c\u4e0d\u77e5\u9053\u4f60\u81ea\u5df1\u7684\u4ef7\u503c\u201d\uff0c\u201c\u67ef\u6797\u65af\u592a\u592a\u7b11\u7740\u8bf4\u201d\uff0c\u201c\u50cf\u4f60\u8fd9\u6837\u76f4\u7387\u7684\u4eba\u62b5\u5f97\u4e0a\u4e00\u767e\u4e2a\u8c08\u5410\u6e29\u6587\u5c14\u96c5\u7684\u98ce\u6d41\u7537\u5b50\u201d\u3002<\/p>\n\n\n\n<p>\u8fd9\u4e9b\u77ed\u53e5\u7684\u957f\u5ea6\u5206\u5e03\u60c5\u51b5\u5982\u4e0b\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><th>\u5b57\u7b26\u4e32\u957f\u5ea6\uff08\u6309\u7167Unicode\u8ba1\u7b97\uff09<\/th><th>\u603b\u6570<\/th><\/tr><tr><td>1<\/td><td>5563<\/td><\/tr><tr><td>2<\/td><td>277200<\/td><\/tr><tr><td>3<\/td><td>1082830<\/td><\/tr><tr><td>4<\/td><td>3156576<\/td><\/tr><tr><td>5<\/td><td>3727422<\/td><\/tr><tr><td>6<\/td><td>5092530<\/td><\/tr><tr><td>7<\/td><td>5006767<\/td><\/tr><tr><td>8<\/td><td>4829769<\/td><\/tr><tr><td>9<\/td><td>4301055<\/td><\/tr><tr><td>10<\/td><td>3766264<\/td><\/tr><tr><td>11<\/td><td>3196160<\/td><\/tr><tr><td>\u2026\u2026<\/td><td>\u2026\u2026<\/td><\/tr><tr><td>674<\/td><td>1<\/td><\/tr><tr><td>904<\/td><td>1<\/td><\/tr><tr><td>1419<\/td><td>1<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>\u4ece\u8868\u4e2d\u53ef\u4ee5\u770b\u51fa\uff0c\u521a\u5f00\u59cb\u968f\u5b57\u7b26\u4e32\u957f\u5ea6\u589e\u52a0\uff0c\u603b\u6570\u9010\u6e10\u589e\u52a0\u5230\u6700\u5927\u503c\u3002\u968f\u540e\u968f\u957f\u5ea6\u589e\u52a0\u800c\u9010\u6b65\u9012\u51cf\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e8c\u3001\u7edf\u8ba1\u5904\u7406<\/h2>\n\n\n\n<p>\u8fd9\u91cc\u6240\u9700\u8981\u8fdb\u884c\u7684\u7edf\u8ba1\u5206\u6210\u597d\u51e0\u4e2a\u90e8\u5206\u3002\u5148\u6765\u4ecb\u7ecd\u4e0b\u4e00\u4e9b\u6700\u57fa\u672c\u7684\u5206\u6790\u3002<\/p>\n\n\n\n<p>\uff081\uff09\u5b57\u7b26\u7edf\u8ba1<\/p>\n\n\n\n<p>\u8fd9\u4e2a\u90e8\u5206\u7684\u7edf\u8ba1\u6700\u4e3a\u7b80\u5355\uff1a\u4ece\u539f\u59cb\u8bed\u6599\u5e93\u4e2d\u63d0\u53d6\u4e00\u884c\u6570\u636e\uff0c\u9010\u4e2a\u5b57\u7b26\u8fdb\u884c\u5206\u6790\u3002<br>\u5982\u679c\u5b57\u7b26\u5728Dictionary&lt;string,int&gt;\u5bf9\u8c61\u4e2d\uff0c\u53ef\u4ee5\u67e5\u5230\uff0c\u5219\u8ba1\u6570\u5668\u52a01\uff1b\u5426\u5219\uff0c\u5219\u589e\u52a0\u4e00\u6761\u65b0\u7684\u8bb0\u5f55\u3002<\/p>\n\n\n\n<p>\u8fd9\u4e2a\u90e8\u5206\u7684\u7edf\u8ba1\u5bf9\u5185\u5b58\u548cCPU\u7684\u6d88\u8017\u5e76\u4e0d\u9ad8\uff0c\u5f88\u5feb\u5c31\u53ef\u4ee5\u5b8c\u6210\u3002<\/p>\n\n\n\n<p>\uff082\uff09\u62c6\u5206\u77ed\u53e5<\/p>\n\n\n\n<p>\u8fd9\u4e2a\u90e8\u5206\u7684\u5904\u7406\u5176\u5b9e\u4e5f\u4e0d\u590d\u6742\uff1a\u4ece\u539f\u59cb\u8bed\u6599\u5e93\u4e2d\u63d0\u53d6\u4e00\u884c\u6570\u636e\uff0c\u6309\u7167\u6807\u70b9\u7b26\u53f7\u8fdb\u884c\u5206\u6bb5\u3002\u5404\u4e2a\u5206\u6bb5\u90e8\u5206\u7684\u6570\u636e\uff0c\u53ef\u89c6\u4e3a\u201c\u77ed\u53e5\u201d\u3002\u6216\u8005\u53ea\u63d0\u53d6\u4e2d\u6587\u90e8\u5206\u5373\u53ef\uff0c\u5982\u4e0b\u9762\u4ee3\u7801\u6240\u793a\uff1a<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nMatch match = Regex.Match(item, @&quot;&#x5B;\\u4E00-\\u9FA5]+&quot;);\n<\/pre><\/div>\n\n\n<p>\u4e3a\u4e86\u66f4\u52a0\u7cbe\u786e\u5730\u5206\u6790\uff0c\u4f5c\u8005\u5728\u6574\u4e2a\u8fc7\u7a0b\u4e2d\uff0c\u589e\u52a0\u4e86\u6570\u91cf\u8bcd\u63d0\u53d6\u8fc7\u7a0b\u3002\u6bd5\u7adf\u6709\u4e0d\u5c11\u8bed\u6599\u4e2d\u5b58\u5728\u6570\u91cf\u8bcd\uff08\u5305\u62ec\u65e5\u671f\uff09\uff0c\u8fd9\u4e9b\u8bcd\u4f1a\u5e72\u6270\u5230\u77ed\u53e5\u7684\u5207\u5206\u8fc7\u7a0b\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n2008\u5e749\u670820\u65e5\u672c\u62a5\u8baf\u2026\u2026\n<\/pre><\/div>\n\n\n<p>\u5728\u4e0a\u9762\u7684\u4f8b\u5b50\u4e2d\uff0c\u5982\u679c\u53ea\u63d0\u53d6\u4e2d\u6587\uff0c\u5c31\u4f1a\u8df3\u8fc7\u6570\u5b57\u628a\u201c\u65e5\u201d\u5b57\u548c\u201c\u672c\u201d\u5b57\u7ed1\u5230\u4e00\u8d77\uff0c\u4e0e\u539f\u672c\u7684\u610f\u601d\u76f8\u8fdd\u80cc\u3002\u8fd9\u79cd\u60c5\u51b5\u8fd8\u771f\u6709\u4e0d\u5c11\u3002<\/p>\n\n\n\n<p>\u4e3a\u4e86\u80fd\u51c6\u786e\u63d0\u53d6\u6570\u91cf\u8bcd\uff0c\u9700\u8981\u5efa\u7acb\u5927\u91cf\u7684\u6b63\u5219\u89c4\u5219\u6a21\u677f\u3002\u901a\u8fc7\u591a\u6b21\u5339\u914d\u548c\u878d\u5408\uff0c\u624d\u80fd\u8f83\u4e3a\u51c6\u786e\u5730\u63d0\u53d6\u6570\u91cf\u8bcd\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\n        private static readonly string&#x5B;] QUANTITY_RULES =\n        {\n            \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n            \/\/\n            \/\/ \u52a0\u8f7d\u6b63\u5219\u89c4\u5219\u3002\n            \/\/\n            \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n\n            \/\/ \u6b63\u5219\u8868\u8fbe\u5f0f\n            \/\/ \u7f16\u53f7\n            &quot;0\\\\d*&quot;, \/\/\u7f16\u53f7\n            &quot;No.\\\\d*&quot;, \/\/\u7f16\u53f7\n            \/\/ \u6574\u6570\n            &quot;-?&#x5B;1-9]\\\\d*&quot;, \/\/\u6574\u6570\n            &quot;&#x5B;1-9]\\\\d*&#x5B;\\\\s]?-&#x5B;\\\\s]?&#x5B;1-9]\\\\d*&quot;, \/\/\u6574\u6570\n            &quot;&#x5B;1-9]\\\\d{0,2}(,\\\\d{3})+&quot;, \/\/\u6574\u6570\n            &quot;&#x5B;1-9]\\\\d*&#x5B;\\\\s]?&#x5B;\u5341|\u767e|\u5343|\u4e07|\u4ebf]&quot;, \/\/\u6574\u6570\n            &quot;&#x5B;1-9]\\\\d*&#x5B;\\\\s]?&#x5B;\u5341|\u767e|\u5343|\u4e07|\u4ebf|\u5146]\u4ebf&quot;, \/\/\u6574\u6570\n            \/\/ \u767e\u5206\u6570\n            &quot;\\\\d+(\\\\.\\\\d+)?%&quot;, \/\/\u767e\u5206\u6570\n            &quot;\\\\d+(\\\\.\\\\d+)?%-\\\\d+(\\\\.\\\\d+)?%&quot;, \/\/\u767e\u5206\u6570\n            \/\/ \u5206\u6570\n            &quot;&#x5B;1-9]\\\\d*&#x5B;\\\\s]?\/&#x5B;\\\\s]?&#x5B;1-9]\\\\d*&quot;, \/\/\u5206\u6570\n            &quot;&#x5B;1-9]\\\\d*&#x5B;\\\\s]?\/&#x5B;\\\\s]?&#x5B;1-9]\\\\d*-&#x5B;1-9]\\\\d*\/&#x5B;1-9]\\\\d*&quot;, \/\/\u5206\u6570\n            \/\/ \u82f1\u6587\u5355\u8bcd\n            &quot;&#x5B;A-Za-z]&#x5B;\\&#039;A-Za-z]*&quot;, \/\/\u82f1\u6587\n            \/\/ \u6d6e\u70b9\u6570\n            &quot;-?(&#x5B;1-9]\\\\d*\\\\.\\\\d+|0\\\\.\\\\d*&#x5B;1-9]\\\\d*|0?\\\\.0+)&quot;, \/\/\u6d6e\u70b9\u6570\n            &quot;(&#x5B;1-9]\\\\d*\\\\.\\\\d+|0\\\\.\\\\d*&#x5B;1-9]\\\\d*|0?\\\\.0+)&#x5B;\\\\s]?&#x5B;\u5341|\u767e|\u5343|\u4e07|\u4ebf]&quot;, \/\/\u6d6e\u70b9\u6570\n            &quot;(&#x5B;1-9]\\\\d*\\\\.\\\\d+|0\\\\.\\\\d*&#x5B;1-9]\\\\d*|0?\\\\.0+)&#x5B;\\\\s]?&#x5B;\u5341|\u767e|\u5343|\u4e07|\u4ebf|\u5146]\u4ebf&quot;, \/\/\u6d6e\u70b9\u6570\n\n            \/\/ \u65e5\u671f\n            &quot;(\\\\d{4}|\\\\d{2})&#x5B;\\\\s]?\u5e74&quot;, \/\/\u65e5\u671f\n            &quot;(0?&#x5B;1-9]|1&#x5B;0-2])&#x5B;\\\\s]?\u6708&quot;, \/\/\u65e5\u671f\n            &quot;((0?&#x5B;1-9])|((1|2)&#x5B;0-9])|30|31)&#x5B;\\\\s]?\u53f7&quot;, \/\/\u65e5\u671f\n            &quot;((0?&#x5B;1-9])|((1|2)&#x5B;0-9])|30|31)&#x5B;\\\\s]?\u65e5&quot;, \/\/\u65e5\u671f\n            &quot;(\\\\d{4}|\\\\d{2})&#x5B;\\\\s]?\u5e74&#x5B;\\\\s]?((1&#x5B;0-2])|(0?&#x5B;1-9]))&#x5B;\\\\s]?\u6708&quot;, \/\/\u65e5\u671f\n            &quot;(0?&#x5B;1-9]|1&#x5B;0-2])&#x5B;\\\\s]?\u6708((0?&#x5B;1-9])|((1|2)&#x5B;0-9])|30|31)&#x5B;\\\\s]?\u65e5&quot;, \/\/\u65e5\u671f\n            &quot;(\\\\d{4}|\\\\d{2})-((1&#x5B;0-2])|(0?&#x5B;1-9]))&#x5B;\\\\s]?-&#x5B;\\\\s]?((&#x5B;12]&#x5B;0-9])|(3&#x5B;01])|(0?&#x5B;1-9]))&quot;, \/\/\u65e5\u671f\n            &quot;(\\\\d{4}|\\\\d{2})&#x5B;\\\\s]?\u5e74((1&#x5B;0-2])|(0?&#x5B;1-9]))&#x5B;\\\\s]?\u6708((&#x5B;12]&#x5B;0-9])|(3&#x5B;01])|(0?&#x5B;1-9]))&#x5B;\\\\s]?\u65e5&quot;, \/\/\u65e5\u671f\n            \/\/ \u65f6\u95f4\n            &quot;((1|0?)&#x5B;0-9]|2&#x5B;0-3])&#x5B;\\\\s]?\u65f6&quot;, \/\/\u65f6\u95f4\n            &quot;((1|0?)&#x5B;0-9]|2&#x5B;0-3])&#x5B;\\\\s]?:&#x5B;\\\\s]?(&#x5B;0-5]&#x5B;0-9])&quot;, \/\/\u65f6\u95f4\n            &quot;((1|0?)&#x5B;0-9]|2&#x5B;0-3])&#x5B;\\\\s]?\u65f6(&#x5B;0-5]&#x5B;0-9])&#x5B;\\\\s]?\u5206&quot;, \/\/\u65f6\u95f4\n            &quot;((1|0?)&#x5B;0-9]|2&#x5B;0-3])&#x5B;\\\\s]?\u70b9(&#x5B;0-5]&#x5B;0-9])&#x5B;\\\\s]?\u5206&quot;, \/\/\u65f6\u95f4\n            &quot;((1|0?)&#x5B;0-9]|2&#x5B;0-3])&#x5B;\\\\s]?:&#x5B;\\\\s]?(&#x5B;0-5]&#x5B;0-9])&#x5B;\\\\s]?:&#x5B;\\\\s]?(&#x5B;0-5]&#x5B;0-9])&quot;, \/\/\u65f6\u95f4\n            &quot;((1|0?)&#x5B;0-9]|2&#x5B;0-3])&#x5B;\\\\s]?\u65f6&#x5B;\\\\s]?(&#x5B;0-5]&#x5B;0-9])\u5206(&#x5B;0-5]&#x5B;0-9])&#x5B;\\\\s]?\u79d2&quot;, \/\/\u65f6\u95f4\n            &quot;((0?&#x5B;1-9])|((1|2)&#x5B;0-9])|30|31)&#x5B;\\\\s]?\u65e5&#x5B;\\\\s]?((1|0?)&#x5B;0-9]|2&#x5B;0-3])&#x5B;\\\\s]?\u65f6&#x5B;\\\\s]?(&#x5B;0-5]&#x5B;0-9])&#x5B;\\\\s]?\u5206&quot;, \/\/\u65f6\u95f4\n            \/\/ \u65f6\u95f4\u6bb5\n            &quot;(\\\\d{4}|\\\\d{2})&#x5B;\\\\s]?\u5e74&#x5B;\\\\s]?-&#x5B;\\\\s]?(\\\\d{4}|\\\\d{2})&#x5B;\\\\s]?\u5e74&quot;, \/\/\u65f6\u95f4\u6bb5\n            &quot;(\\\\d{4}|\\\\d{2})&#x5B;\\\\s]?\/&#x5B;\\\\s]?(\\\\d{4}|\\\\d{2})&#x5B;\\\\s]?\u8d22\u5e74&quot;, \/\/\u65f6\u95f4\u6bb5\n            &quot;((1|0?)&#x5B;0-9]|2&#x5B;0-3])&#x5B;\\\\s]?&#x5B;\u70b9|\u65f6]&#x5B;\\\\s]?-&#x5B;\\\\s]?((1|0?)&#x5B;0-9]|2&#x5B;0-3])&#x5B;\\\\s]?&#x5B;\u70b9|\u65f6]&quot;, \/\/\u65f6\u95f4\u6bb5\n            &quot;((0?&#x5B;1-9])|((1|2)&#x5B;0-9])|30|31)&#x5B;\\\\s]?&#x5B;\u65e5|\u53f7]&#x5B;\\\\s]?-&#x5B;\\\\s]?((0?&#x5B;1-9])|((1|2)&#x5B;0-9])|30|31)&#x5B;\\\\s]?&#x5B;\u65e5|\u53f7]&quot;, \/\/\u65f6\u95f4\u6bb5\n            &quot;(\\\\d{4}|\\\\d{2})\u5e74((1&#x5B;0-2])|(0?&#x5B;1-9]))&#x5B;\\\\s]?\u6708&#x5B;\\\\s]?-&#x5B;\\\\s]?(\\\\d{4}|\\\\d{2})\u5e74((1&#x5B;0-2])|(0?&#x5B;1-9]))&#x5B;\\\\s]?\u6708&quot;, \/\/\u65f6\u95f4\u6bb5\n            &quot;((1&#x5B;0-2])|(0?&#x5B;1-9]))&#x5B;\\\\s]?\u6708&#x5B;\\\\s]?((&#x5B;12]&#x5B;0-9])|(3&#x5B;01])|(0?&#x5B;1-9]))&#x5B;\\\\s]?\u65e5&#x5B;\\\\s]?-&#x5B;\\\\s]?((1&#x5B;0-2])|(0?&#x5B;1-9]))&#x5B;\\\\s]?\u6708&#x5B;\\\\s]?((&#x5B;12]&#x5B;0-9])|(3&#x5B;01])|(0?&#x5B;1-9]))&#x5B;\\\\s]?\u65e5&quot;, \/\/\u65f6\u95f4\u6bb5\n            &quot;(\\\\d{4}|\\\\d{2})&#x5B;\\\\s]?\u5e74&#x5B;\\\\s]?((1&#x5B;0-2])|(0?&#x5B;1-9]))&#x5B;\\\\s]?\u6708&#x5B;\\\\s]?((&#x5B;12]&#x5B;0-9])|(3&#x5B;01])|(0?&#x5B;1-9]))&#x5B;\\\\s]?\u65e5&#x5B;\\\\s]?-&#x5B;\\\\s]?(\\\\d{4}|\\\\d{2})&#x5B;\\\\s]?\u5e74&#x5B;\\\\s]?((1&#x5B;0-2])|(0?&#x5B;1-9]))&#x5B;\\\\s]?\u6708&#x5B;\\\\s]?((&#x5B;12]&#x5B;0-9])|(3&#x5B;01])|(0?&#x5B;1-9]))&#x5B;\\\\s]?\u65e5&quot;, \/\/\u65f6\u95f4\u6bb5\n\n            \/\/ \u7279\u6b8a\u6807\u8bc6\n            \/\/ \u8eab\u4efd\u8bc1\u53f7\u7801\n            &quot;\\\\d{15}(\\\\d\\\\d&#x5B;0-9xX])?&quot;, \/\/\u8eab\u4efd\u8bc1\n            \/\/ \u56fd\u5185\u7535\u8bdd\u53f7\u7801\uff08\u6613\u6df7\u6dc6\uff09\n            &quot;(\\\\d{4}|\\\\d{3})?&#x5B;\\\\s]?-&#x5B;\\\\s]?(\\\\d{8}|\\\\d{7})&quot;, \/\/\u7535\u8bdd\n            &quot;(\\\\d{4}|\\\\d{3})?&#x5B;\\\\s]?-&#x5B;\\\\s]?(\\\\d{4}|\\\\d{3})?-&#x5B;\\\\s]?(\\\\d{4}|\\\\d{3})&quot;, \/\/\u7535\u8bdd\n            \/\/ HTML\u6807\u8bb0\uff08\u6613\u6df7\u6dc6\u3001\u6709\u6b7b\u5faa\u73af\u53ef\u80fd\uff09\n            \/\/ &quot;&lt;(.*)(.*)&gt;.*&lt;\\\\\/\\\\1&gt;|&lt;(.*) \\\\\/&gt;&quot;, \/\/HTML\u6807\u8bb0\n            \/\/ EMail\u5730\u5740\n            &quot;\\\\w+(&#x5B;-+.]\\\\w+)*@\\\\w+(&#x5B;-.]\\\\w+)*\\\\.\\\\w+(&#x5B;-.]\\\\w+)*&quot;, \/\/\u7535\u5b50\u90ae\u7bb1\n            \/\/ IP\u5730\u5740\n            &quot;((2&#x5B;0-4]\\\\d|25&#x5B;0-5]|&#x5B;01]?\\\\d\\\\d?)\\\\.){3}(2&#x5B;0-4]\\\\d|25&#x5B;0-5]|&#x5B;01]?\\\\d\\\\d?)&quot;, \/\/IP\u5730\u5740\n            \/\/ URL\u5730\u5740\uff08\u6613\u6df7\u6dc6\uff09\n            &quot;\\\\b((&#x5B;\\\\w-]+:\/\/?|www&#x5B;.])&#x5B;^\\\\s()&lt;&gt;]+(?:\\\\(&#x5B;\\\\w\\\\d]+\\\\)|(&#x5B;^&#x5B;:punct:]\\\\s]|\/)))&quot;, \/\/URL\u5730\u5740\n\n            \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n            \/\/\n            \/\/ \u52a0\u8f7d\u6570\u8bcd\u89c4\u5219\u3002\n            \/\/\n            \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n\n            \/\/ \u6570\u8bcd\n            &quot;$n&#x5B;\\\\.|\\\\)]&quot;, \/\/\u7f16\u53f7\n            &quot;\u201c&#x5B;\\\\s]?$n&#x5B;\\\\s]?\u201d&quot;, \/\/\u7f16\u53f7\n            &quot;&#x5B;0-9]&#x5B;\\\\dA-Za-z]*&quot;, \/\/\u7f16\u53f7\n            &quot;$e+$n&quot;, \/\/\u7f16\u53f7\n            &quot;$e+$n$e*&quot;, \/\/\u7f16\u53f7\n            &quot;\u201c&#x5B;\\\\s]?$n&#x5B;\\\\s]?\u00b7$n&#x5B;\\\\s]?\u201d&quot;, \/\/\u7f16\u53f7\n            &quot;\\\\(&#x5B;\\\\s]?$n&#x5B;\\\\s]?\\\\)|\\\\&lt;&#x5B;\\\\s]?$n&#x5B;\\\\s]?\\\\&gt;|\\\\{&#x5B;\\\\s]?$n&#x5B;\\\\s]?\\\\}&quot;, \/\/\u7f16\u53f7\n\n            &quot;$d&#x5B;\u591a|\u4f59](\u4e07|\u4ebf)&quot;, \/\/\u6570\u91cf\n            &quot;$d&#x5B;\\\\s]?:&#x5B;\\\\s]?$d&quot;, \/\/\u6bd4\u4f8b\n            &quot;$d&#x5B;\\\\s]?(~|\u81f3)&#x5B;\\\\s]?$d&quot;, \/\/\u533a\u95f4\n\n            &quot;(\u96f6|$c){2,}&quot;, \/\/\u5e8f\u53f7\n            &quot;\u5341$c&quot;, \/\/\u5341\u4f4d\u6570\n            &quot;$c\u5341$c?&quot;, \/\/\u5341\u4f4d\u6570\n            &quot;$c\u767e(\u96f6|$c\u5341)?$c?&quot;, \/\/\u767e\u4f4d\u6570\n            &quot;$c\u5343((\u96f6|$c\u767e)?(\u96f6|$c\u5341)?$c?)&quot;, \/\/\u5343\u4f4d\u6570\n            &quot;$c\u5343((\u96f6|$c\u767e)?(\u96f6|$c\u5341)?$c?)\u4e07&quot;, \/\/\u4e07\u4f4d\u6570\n            &quot;$c\u4e07((\u96f6|$c\u5343)?((\u96f6|$c\u767e)?(\u96f6|$c\u5341)?$c?))&quot;, \/\/\u4e07\u4f4d\u6570\n\n            &quot;$f\u4e2a\u767e\u5206\u70b9&quot;, \/\/\u767e\u5206\u70b9\n            &quot;\u767e\u5206\u4e4b\u96f6\u70b9(\u51e0|(\u96f6|$c)+)&quot;, \/\/\u767e\u5206\u6570\n            &quot;\u767e\u5206\u4e4b(($c?\u767e)|((($c\u5341)|\u5341)?$c?))&quot;, \/\/\u767e\u5206\u6570\n            &quot;\u767e\u5206\u4e4b(($c?\u767e)|((($c\u5341)|\u5341)?$c?))($c|\u51e0|\u5de6\u53f3)?&quot;, \/\/\u767e\u5206\u6570\n\n            \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n            \/\/\n            \/\/ \u52a0\u8f7d\u5e8f\u53f7\u89c4\u5219\u3002\n            \/\/\n            \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n\n            &quot;\u7b2c$d&quot;, \/\/\u5e8f\u6570\n            &quot;\u7b2c&#x5B;\\\\s]?$d&#x5B;\\\\s]?$q&quot;, \/\/\u5e8f\u6570\n\n            &quot;\u7b2c$c&quot;, \/\/\u5e8f\u6570\n            &quot;\u7b2c&#x5B;\\\\s]?$c&#x5B;\\\\s]?$q&quot;, \/\/\u5e8f\u6570\n\n            &quot;\u7b2c\u5341$c?&quot;, \/\/\u5e8f\u6570\n            &quot;\u7b2c&#x5B;\\\\s]?\u5341$c?&#x5B;\\\\s]?$q&quot;, \/\/\u5e8f\u6570\n\n            &quot;\u7b2c$c\u5341$c?&quot;, \/\/\u5e8f\u6570\n            &quot;\u7b2c&#x5B;\\\\s]?$c\u5341$c?&#x5B;\\\\s]?$q&quot;, \/\/\u5e8f\u6570\n\n            &quot;\u7b2c$c\u767e(\u96f6|$c\u5341)?$c?&quot;, \/\/\u5e8f\u6570\n            &quot;\u7b2c&#x5B;\\\\s]?$c\u767e(\u96f6|$c\u5341)?$c?&#x5B;\\\\s]?$q&quot;, \/\/\u5e8f\u6570\n\n            \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n            \/\/\n            \/\/ \u52a0\u8f7d\u6570\u91cf\u8bcd\u89c4\u5219\u3002\n            \/\/\n            \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n\n            &quot;$d($q|$u)&quot;, \/\/\u6570\u91cf\n\n            &quot;$d&#x5B;\\\\s]?&#x5B;\u591a|\u4f59]($q|$u)&quot;, \/\/\u7ea6\u6570\n\n            &quot;\u51e0(\u4ebf|\u4e07|\u5343|\u767e|\u5341)&#x5B;\\\\s]?($q|$u)&quot;, \/\/\u7ea6\u6570\n\n            &quot;$c&#x5B;\\\\s]?($q|$u)&quot;, \/\/\u6570\u91cf\n\n            &quot;\u5341$c?&#x5B;\\\\s]?($q|$u)&quot;, \/\/\u6570\u91cf\n\n            &quot;$c\u5341$c?&#x5B;\\\\s]?($q|$u)&quot;, \/\/\u6570\u91cf\n\n            &quot;$c\u767e(\u96f6|$c\u5341)?$c?&#x5B;\\\\s]?($q|$u)&quot;, \/\/\u6570\u91cf\n\n            &quot;$c\u5343(\u96f6|$c\u767e)?(\u96f6|$c\u5341)?$c?&#x5B;\\\\s]?($q|$u)&quot;, \/\/\u6570\u91cf\n\n            &quot;(\u5341|$c)\u4e07(\u96f6|$c\u5343)?(\u96f6|$c\u767e)?(\u96f6|$c\u5341)?$c?&#x5B;\\\\s]?($q|$u)&quot;, \/\/\u6570\u91cf\n\n            &quot;$f&#x5B;\\\\s]?($v)&quot;, \/\/\u6570\u91cf\n\n            \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n            \/\/\n            \/\/ \u52a0\u8f7d\u7ea6\u6570\u89c4\u5219\u3002\n            \/\/\n            \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n\n            &quot;$f&#x5B;\\\\s]?(\u4ebf|\u4e07|\u5343|\u767e)?(\u4f59|\u591a)?($q|$u)&quot;, \/\/\u7ea6\u6570\n\n            &quot;(\u5341|$c)&#x5B;\\\\s]?(\u4ebf|\u4e07|\u5343|\u767e|\u5341)(\u4f59|\u591a)?($q|$u)&quot;, \/\/\u7ea6\u6570\n\n            \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n            \/\/\n            \/\/ \u52a0\u8f7d\u8d27\u5e01\u89c4\u5219\u3002\n            \/\/\n            \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n\n            &quot;$f&#x5B;\\\\s]?(\u767e|\u5343|\u4e07)?(\u4ebf|\u4e07)?(\u4f59|\u591a)?$y&quot;, \/\/\u8d27\u5e01\n\n            &quot;$f&#x5B;\\\\s]?&#x5B;\u591a|\u4f59]?(\u767e|\u5343|\u4e07)?(\u4ebf|\u4e07)?(\u4f59|\u591a)?$y&quot;, \/\/\u8d27\u5e01\n\n            &quot;&#x5B;1-9]\\\\d{0,2}(,\\\\d{3})+(\u767e|\u5343|\u4e07)?(\u4ebf|\u4e07)?(\u4f59|\u591a)?$y&quot;, \/\/\u8d27\u5e01\n\n            \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n            \/\/\n            \/\/ \u52a0\u8f7d\u65f6\u95f4\u89c4\u5219\u3002\n            \/\/\n            \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n\n            \/\/ \u65f6\u95f4\n            &quot;&#x5B;1-9]\\\\d*&#x5B;\\\\s]?\u4e2a\u6708&quot;, \/\/\u6708\n            &quot;&#x5B;\u8fc7]?\u5e74&#x5B;\u524d|\u4e2d|\u5e95|\u540e]&quot;, \/\/\u5e74\n            &quot;(\u7b2c)?(\u4e00|\u4e8c|\u4e09|\u56db)\u5b63&#x5B;\u5ea6]?&quot;, \/\/\u5b63\u5ea6\n            &quot;\u5468&#x5B;\u4e00|\u4e8c|\u4e09|\u56db|\u4e94|\u516d|\u65e5]&quot;, \/\/\u5468\n            &quot;\u661f\u671f&#x5B;\u4e00|\u4e8c|\u4e09|\u56db|\u4e94|\u516d|\u65e5]&quot;, \/\/\u661f\u671f\n            &quot;((1&#x5B;0-2])|(0?&#x5B;1-9]))&#x5B;\\\\s]?\u6708\u4efd&quot;, \/\/\u6708\u4efd\n            &quot;(&#x5B;1-9]\\\\d*&#x5B;\\\\s]?\u3001)+(&#x5B;1-9]\\\\d*&#x5B;\\\\s]?)(\u4e00|\u4e8c|\u4e09|\u56db|\u4e94|\u516d|\u4e03|\u516b|\u4e5d|\u5341|\u5341\u4e00|\u5341\u4e8c)\u4e2a\u6708&quot;, \/\/\u6708\n            &quot;(((0?&#x5B;1-9])|((1|2)&#x5B;0-9])|30|31)&#x5B;\\\\s]?\u3001)*((0?&#x5B;1-9])|((1|2)&#x5B;0-9])|30|31)&#x5B;\\\\s]?\u65e5&quot;, \/\/\u65e5\u671f\n            &quot;((0?&#x5B;1-9])|((1|2)&#x5B;0-9])|30|31)&#x5B;\\\\s]?\u81f3&#x5B;\\\\s]?((0?&#x5B;1-9])|((1|2)&#x5B;0-9])|30|31)&#x5B;\\\\s]?\u65e5&quot;, \/\/\u65e5\u671f\n            &quot;((1&#x5B;0-2])|(0?&#x5B;1-9]))&#x5B;\\\\s]?\u6708&#x5B;\\\\s]?(((0?&#x5B;1-9])|((1|2)&#x5B;0-9])|30|31)&#x5B;\\\\s]?\u65e5)(\u3001((0?&#x5B;1-9])|((1|2)&#x5B;0-9])|30|31)&#x5B;\\\\s]?\u65e5)*&quot;, \/\/\u65e5\u671f\n\n            \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n            \/\/\n            \/\/ \u52a0\u8f7d\u5176\u4ed6\u89c4\u5219\u3002\n            \/\/\n            \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n\n            \/\/ \u7279\u6b8a\u8bcd\u6c47\n            &quot;&#x5B;\u53cc|\u4e24|\u53c1|\u591a]&#x5B;\\\\s]?(\u65b9|\u70b9|\u4e2a|\u9879|\u6b21|\u6839|\u9897|\u6761|\u540d|\u5957|\u4efd)&quot;, \/\/\u6570\u91cf\n\n            \/\/ \u822a\u73ed\n            &quot;$e+$n\u6b21&#x5B;\\\\s]?\u822a\u73ed&quot;, \/\/\u822a\u73ed\n            \/\/ \u80a1\u7968\n            &quot;(A|B|H)\u80a1&quot;, \/\/\u80a1\u7968\n            \/\/ \u6cb9\u6599\n            &quot;$n#&quot;, \/\/\u6cb9\u6599\n            &quot;$f\u4e2a\u6cb9&quot;, \/\/\u6cb9\u8017\n            \/\/ \u7ef4\u751f\u7d20\n            &quot;\u7ef4\u751f\u7d20(A|B|C|D|E|K|H|P|M|T|U)\\\\d{0,2}&quot;, \/\/\u7ef4\u751f\u7d20\n        };\n<\/pre><\/div>\n\n\n<p>\u5728\u968f\u540e\u7684\u5b9e\u9645\u8fd0\u884c\u4e2d\uff0c\u5c31\u53d1\u73b0\u5904\u7406\u901f\u5ea6\u5341\u5206\u7f13\u6162\u3002\u521d\u6b65\u4f30\u7b97\u4e86\u4e00\u4e0b\uff0c\u8981\u5c06\u8bed\u6599\uff0810,101,283\u6761\uff09\u5168\u90e8\u5904\u7406\u5b8c\u6210\uff0c\u81f3\u5c11\u9700\u8981\u4e09\u5929\u7684\u65f6\u95f4\u3002<\/p>\n\n\n\n<p>\u901a\u8fc7Visual Studio Profiler\u63a2\u6d4b\u5de5\u5177\u5bf9CPU\u7684\u8fd0\u884c\u60c5\u51b5\u505a\u4e86\u68c0\u6d4b\uff0c\u6700\u540e\u53d1\u73b085%\u7684\u8fd0\u884c\u65f6\u95f4\u90fd\u88ab\u5206\u914d\u5230\u4e86\u8be5\u51fd\u6570\uff1a<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\n        private static Quantity&#x5B;] GetMatches(string content)\n        {\n            \/\/ \u521b\u5efa\u5bf9\u8c61\n            List&lt;Quantity&gt; quantities = new List&lt;Quantity&gt;();\n            \/\/ \u5faa\u73af\u5904\u7406\n            foreach(string rule in QUANTITY_RULES)\n            {\n                \/\/ \u6062\u590d\u89c4\u5219\n                string newRule = Quantity.RecoverRule(rule);\n                \/\/ \u68c0\u67e5\u5339\u914d\n                \/\/ \u6b64\u51fd\u6570\u975e\u5e38\u6d88\u8017\u65f6\u95f4\uff01\uff01\uff01\n                Match match = Regex.Match(content, newRule);\n                \/\/ \u68c0\u67e5\u7ed3\u679c\n                while(match.Success)\n                {\n                    \/\/ \u521b\u5efa\u5bf9\u8c61\n                    Quantity quantity =\n                        new Quantity();\n                    \/\/ \u8bbe\u7f6e\u6570\u503c\n                    quantity.Index = match.Index;\n                    quantity.Value = match.Value;\n                    quantity.Length = match.Length;\n                    \/\/ \u52a0\u5165\u5217\u8868\n                    quantities.Add(quantity);\n                    \/\/ \u4e0b\u4e00\u4e2a\n                    match = match.NextMatch();\n                }\n            }\n            \/\/ \u6309\u7167\u7d22\u5f15\u6570\u503c\u6392\u5e8f\n            quantities = quantities.OrderBy(q =&gt; q.Index).ToList();\n            \/\/ \u8fd4\u56de\u7ed3\u679c\n            return quantities.ToArray();\n        }\n<\/pre><\/div>\n\n\n<p>\u5176\u4e2d\u4ee5Regex.Match\u5360\u7528\u65f6\u95f4\u6700\u591a\u3002\u8fd9\u4e2a\u53ef\u662f\u5185\u7f6e\u7cfb\u7edf\u51fd\u6570\uff0c\u4f5c\u8005\u8868\u793a\u65e0\u80fd\u4e3a\u529b\u3002<\/p>\n\n\n\n<p>\u4e0d\u8fc7\u968f\u540e\u53d1\u73b0\uff1a\u7a0b\u5e8f\u8fd0\u884c\u7684CPU\u5360\u6bd4\u5e76\u4e0d\u9ad8\uff0c\u5927\u7ea6\u53ea\u670912%\u5de6\u53f3\u3002\u4e8e\u662f\u5c31\u60f3\u5c1d\u8bd5\u4e0b\u591a\u7ebf\u7a0b\u5e76\u884c\u5904\u7406\u3002\u6700\u540e\u7ec8\u4e8e\u5728\u7f51\u7edc\u4e0a\u627e\u5230\u4e86\u5408\u9002\u7684\u89e3\u51b3\u65b9\u6848\u3002\u8fd9\u91cc\u9700\u8981\u7528\u5230\u4e00\u4e2a\u7c7bLimitedConcurrencyLevelTaskScheduler\uff1a<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nusing System;\nusing System.Text;\nusing System.Data;\nusing System.Threading;\nusing System.Data.SqlClient;\nusing System.Threading.Tasks;\nusing System.Collections.Generic;\nusing System.Text.RegularExpressions;\n\nnamespace Misc\n{\n    \/\/ Provides a task scheduler that ensures a maximum concurrency level while\n    \/\/ running on top of the thread pool.\n    public class LimitedConcurrencyLevelTaskScheduler : TaskScheduler\n    {\n        \/\/ Indicates whether the current thread is processing work items.\n        &#x5B;ThreadStatic]\n        private static bool _currentThreadIsProcessingItems;\n\n        \/\/ The list of tasks to be executed\n        private readonly LinkedList&lt;Task&gt; _tasks = new LinkedList&lt;Task&gt;(); \/\/ protected by lock(_tasks)\n\n        \/\/ The maximum concurrency level allowed by this scheduler.\n        private readonly int _maxDegreeOfParallelism;\n\n        \/\/ Indicates whether the scheduler is currently processing work items.\n        private int _delegatesQueuedOrRunning = 0;\n\n        \/\/ Creates a new instance with the specified degree of parallelism.\n        public LimitedConcurrencyLevelTaskScheduler(int maxDegreeOfParallelism)\n        {\n            if (maxDegreeOfParallelism &lt; 1) throw new ArgumentOutOfRangeException(&quot;maxDegreeOfParallelism&quot;);\n            _maxDegreeOfParallelism = maxDegreeOfParallelism;\n        }\n\n        \/\/ Queues a task to the scheduler.\n        protected sealed override void QueueTask(Task task)\n        {\n            \/\/ Add the task to the list of tasks to be processed.  If there aren&#039;t enough\n            \/\/ delegates currently queued or running to process tasks, schedule another.\n            lock (_tasks)\n            {\n                _tasks.AddLast(task);\n                if (_delegatesQueuedOrRunning &lt; _maxDegreeOfParallelism)\n                {\n                    ++_delegatesQueuedOrRunning;\n                    NotifyThreadPoolOfPendingWork();\n                }\n            }\n        }\n\n        \/\/ Inform the ThreadPool that there&#039;s work to be executed for this scheduler.\n        private void NotifyThreadPoolOfPendingWork()\n        {\n            ThreadPool.UnsafeQueueUserWorkItem(_ =&gt;\n            {\n                \/\/ Note that the current thread is now processing work items.\n                \/\/ This is necessary to enable inlining of tasks into this thread.\n                _currentThreadIsProcessingItems = true;\n                try\n                {\n                    \/\/ Process all available items in the queue.\n                    while (true)\n                    {\n                        Task item;\n                        lock (_tasks)\n                        {\n                            \/\/ When there are no more items to be processed,\n                            \/\/ note that we&#039;re done processing, and get out.\n                            if (_tasks.Count == 0)\n                            {\n                                --_delegatesQueuedOrRunning;\n                                break;\n                            }\n\n                            \/\/ Get the next item from the queue\n                            item = _tasks.First.Value;\n                            _tasks.RemoveFirst();\n                        }\n\n                        \/\/ Execute the task we pulled out of the queue\n                        base.TryExecuteTask(item);\n                    }\n                }\n                \/\/ We&#039;re done processing items on the current thread\n                finally { _currentThreadIsProcessingItems = false; }\n            }, null);\n        }\n\n        \/\/ Attempts to execute the specified task on the current thread.\n        protected sealed override bool TryExecuteTaskInline(Task task, bool taskWasPreviouslyQueued)\n        {\n            \/\/ If this thread isn&#039;t already processing a task, we don&#039;t support inlining\n            if (!_currentThreadIsProcessingItems) return false;\n\n            \/\/ If the task was previously queued, remove it from the queue\n            if (taskWasPreviouslyQueued)\n                \/\/ Try to run the task.\n                if (TryDequeue(task))\n                    return base.TryExecuteTask(task);\n                else\n                    return false;\n            else\n                return base.TryExecuteTask(task);\n        }\n\n        \/\/ Attempt to remove a previously scheduled task from the scheduler.\n        protected sealed override bool TryDequeue(Task task)\n        {\n            lock (_tasks) return _tasks.Remove(task);\n        }\n\n        \/\/ Gets the maximum concurrency level supported by this scheduler.\n        public sealed override int MaximumConcurrencyLevel { get { return _maxDegreeOfParallelism; } }\n\n        \/\/ Gets an enumerable of the tasks currently scheduled on this scheduler.\n        protected sealed override IEnumerable&lt;Task&gt; GetScheduledTasks()\n        {\n            bool lockTaken = false;\n            try\n            {\n                Monitor.TryEnter(_tasks, ref lockTaken);\n                if (lockTaken) return _tasks;\n                else throw new NotSupportedException();\n            }\n            finally\n            {\n                if (lockTaken) Monitor.Exit(_tasks);\n            }\n        }\n    }\n}\n<\/pre><\/div>\n\n\n<p>\u901a\u8fc7\u8fd9\u4e2a\u7c7b\u53ef\u4ee5\u5b9e\u73b0\u63a7\u5236\u7ebf\u7a0b\u6c60\u7684\u5927\u5c0f\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\n\t\tpublic static void ExtractSentences(bool flag)\n        {\n            \/\/ \u8bb0\u5f55\u65e5\u5fd7\n            Log.LogMessage(&quot;SentenceExtractor&quot;, &quot;ExtractSentences&quot;, &quot;\u63d0\u53d6\u53e5\u5b50\u6570\u636e\uff01&quot;);\n\n            \/\/\u6307\u4ee4\u5b57\u7b26\u4e32\n            string cmdString =\n                  &quot;SELECT &#x5B;rid], &#x5B;content] FROM &#x5B;dbo].&#x5B;RawContent];&quot;;\n\n            \/\/ \u521b\u5efa\u6570\u636e\u5e93\u8fde\u63a5\n            SqlConnection sqlConnection = new SqlConnection(Common.CONNECT_STRING);\n\n            try\n            {\n\t\t\t\t\/\/ \u8ba1\u6570\u5668\n\t\t\t\tint taskCount = 0;\n\t\t\t\t\/\/ \u540c\u6b65\u9501\u5bf9\u8c61\n\t\t\t\tobject lockObject = new object();\n\t\t\t\t\/\/ \u4efb\u52a1\u6570\u7ec4\n\t\t\t\tList&lt;Task&gt; tasks = new List&lt;Task&gt;();\n\t\t\t\t\/\/ \u751f\u6210\u4efb\u52a1\u63a7\u5236\u5668\n\t\t\t\tTaskFactory factory = new TaskFactory(\n\t\t\t\t\tnew LimitedConcurrencyLevelTaskScheduler(Common.MAX_THREADS));\n\t\t\t\t\n\t\t\t\t\/\/ \u8ba1\u6570\u5668\n\t\t\t\tint total = 0;\n                \/\/ \u5f00\u542f\u6570\u636e\u5e93\u8fde\u63a5\n                sqlConnection.Open();\n                \/\/ \u521b\u5efa\u6307\u4ee4\n                SqlCommand sqlCommand =\n                    new SqlCommand(cmdString, sqlConnection);\n                \/\/ \u521b\u5efa\u6570\u636e\u9605\u8bfb\u5668\n                SqlDataReader reader = sqlCommand.ExecuteReader();\n                \/\/ \u5faa\u73af\u5904\u7406\n                while (reader.Read())\n                {\n                    \/\/ \u589e\u52a0\u8ba1\u6570\n                    total++;\n                    \/\/ \u68c0\u67e5\u8ba1\u6570\n                    if (total % 10000 == 0)\n                    {\n                        \/\/ \u6253\u5370\u8bb0\u5f55\n                        Log.LogMessage(string.Format(&quot;{0} items processed !&quot;, total));\n                    }\n\n                    \/\/ \u83b7\u5f97\u7f16\u53f7\n                    int rid = reader.GetInt32(0);\n                    \/\/ \u83b7\u5f97\u5185\u5bb9\n                    string content = reader.GetString(1);\n                    \/\/ \u68c0\u67e5\u5185\u5bb9\n                    if (content == null || content.Length &lt;= 0) continue;\n\n\t\t\t\t\t\/\/ \u542f\u52a8\u8fdb\u7a0b\n\t\t\t\t\ttasks.Add(factory.StartNew\n\t\t\t\t\t(() =&gt;\n\t\t\t\t\t{\n\t\t\t\t\t\tlock (lockObject)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\/\/ \u589e\u52a0\u8ba1\u6570\n\t\t\t\t\t\t\ttaskCount++;\n\t\t\t\t\t\t\t\/\/ \u68c0\u67e5\u8ba1\u6570\n\t\t\t\t\t\t\tif (taskCount % 10000 == 0)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\/\/ \u6253\u5370\u8bb0\u5f55\n\t\t\t\t\t\t\t\tLog.LogMessage(string.Format(&quot;{0} tasks finised !&quot;, taskCount));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\/\/ \u6e05\u7406\u5185\u5bb9\n\t\t\t\t\t\tcontent = MiscTool.ClearContent(content);\n\t\t\t\t\t\t\/\/ \u68c0\u67e5\u5185\u5bb9\n\t\t\t\t\t\tif (content == null || content.Length &lt;= 0) return;\n\n\t\t\t\t\t\t\/\/ \u5207\u5206\u5b57\u7b26\u4e32\n\t\t\t\t\t\tstring&#x5B;] output = SplitContent(content);\n\t\t\t\t\t\t\/\/ \u68c0\u67e5\u7ed3\u679c\n\t\t\t\t\t\tif (output == null || output.Length &lt;= 0) return;\n\n\t\t\t\t\t\t\/\/ \u5408\u5e76\u5b57\u7b26\u4e32\n\t\t\t\t\t\toutput = MergeContent(output);\n\t\t\t\t\t\t\/\/ \u68c0\u67e5\u7ed3\u679c\n\t\t\t\t\t\tif (output == null || output.Length &lt;= 0) return;\n\n\t\t\t\t\t\t\/\/ \u83b7\u5f97\u62c6\u5206\u7ed3\u679c\n\t\t\t\t\t\tstring&#x5B;]&#x5B;] sentences = GetSentences(output);\n\t\t\t\t\t\t\/\/ \u68c0\u67e5\u7ed3\u679c\n\t\t\t\t\t\tif (sentences == null || sentences.Length &lt;= 0) return;\n\n\t\t\t\t\t\t\/\/ \u68c0\u67e5\u6807\u8bb0\u4f4d\n\t\t\t\t\t\tif (flag)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\/\/ \u5faa\u73af\u5904\u7406\n\t\t\t\t\t\t\tforeach (string&#x5B;] sentence in sentences)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\/\/ \u52a0\u5165\u8bb0\u5f55\n\t\t\t\t\t\t\t\tSentenceContent.AddSentence(Concatenate(sentence), rid);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}));\n                }\n                \/\/ \u5173\u95ed\u6570\u636e\u9605\u8bfb\u5668\n                reader.Close();\n                \/\/ \u8bb0\u5f55\u65e5\u5fd7\n                Log.LogMessage(string.Format(&quot;\\tcontent.count = {0}&quot;, total));\n\n\t\t\t\t\/\/ \u8bb0\u5f55\u65e5\u5fd7\n\t\t\t\tLog.LogMessage(&quot;SentenceExtractor&quot;, &quot;ExtractSentences&quot;, &quot;\u7b49\u5f85\u6240\u6709\u4efb\u52a1\u5b8c\u6210 \uff01&quot;);\n\t\t\t\t\/\/ \u7b49\u5f85\u6240\u6709\u4efb\u52a1\u5b8c\u6210\n\t\t\t\tTask.WaitAll(tasks.ToArray());\n\t\t\t}\n\t\t\tcatch (System.Exception ex)\n            {\n                \/\/ \u8bb0\u5f55\u65e5\u5fd7\n                Log.LogMessage(&quot;SentenceExtractor&quot;, &quot;ExtractSentences&quot;, &quot;unexpected exit \uff01&quot;);\n                Log.LogMessage(string.Format(&quot;\\texception.message = {0}&quot;, ex.Message));\n            }\n            finally\n            {\n                \/\/ \u68c0\u67e5\u72b6\u6001\u5e76\u5173\u95ed\u8fde\u63a5\n                if (sqlConnection.State == ConnectionState.Open) sqlConnection.Close();\n            }\n\n            \/\/ \u8bb0\u5f55\u65e5\u5fd7\n            Log.LogMessage(&quot;SentenceExtractor&quot;, &quot;ExtractSentences&quot;, &quot;\u53e5\u5b50\u63d0\u53d6\u5b8c\u6bd5\uff01&quot;);\n        }\n<\/pre><\/div>\n\n\n<p>\u7edf\u8ba1\u7a0b\u5e8f\u6700\u7ec8\u4e00\u53e3\u6c14\u542f\u52a8\u4e861000\u591a\u4e07\u4e2a\u4efb\u52a1\uff0c\u7136\u540eWaitAll\u53bb\u5b8c\u6210\u3002\u8fd9\u6b63\u662f\u4e3a\u641c\u522e\u8ba1\u7b97\u673a\u7684\u8d44\u6e90\u7ede\u5c3d\u8111\u6c41\u3002<\/p>\n\n\n\n<p>\u6700\u540e\u5b9e\u9645\u8fd0\u884c\u7684\u65f6\u5019\uff0cCPU\u6574\u4f53\u6d88\u8017\u7ec8\u4e8e\u722c\u523080%\u4ee5\u4e0a\uff08\u7559\u70b9\u4f59\u5730\u505a\u5176\u4ed6\u4e8b\u60c5\uff09\u3002\u5927\u7ea616\u4e2a\u5c0f\u65f6\u5de6\u53f3\u5c31\u5b8c\u6210\u4e86\u7edf\u8ba1\u4efb\u52a1\uff0c\u6bd4\u4e4b\u524d\u7684\u65b9\u5f0f\u8981\u5feb6\u500d\u3002<\/p>\n\n\n\n<p>\u4e00\u53e3\u6c14\u542f\u52a81000\u591a\u4e07\u4e2a\u4efb\u52a1\uff0c\u8fd8\u4e0d\u662f\u6700\u5938\u5f20\u7684\u4e8b\u60c5\uff01<\/p>\n\n\n\n<p>\uff083\uff09\u7edf\u8ba1\u77ed\u53e5\u9891\u6b21<\/p>\n\n\n\n<p>\u5230\u4e86\u8fd9\u91cc\uff0c\u624d\u662f\u771f\u6b63\u9047\u5230\u4e86\u201c\u74f6\u9888\u201d\u3002\u8981\u5206\u679048,218,815\u6761\u4e0d\u540c\u7684\u77ed\u53e5\u5728\u8bed\u6599\uff0810,101,283\u6761\uff09\u4e2d\u7684\u9891\u6b21\uff0c\u8fd9\u4e2a\u5339\u914d\u8fd0\u7b97\u6570\u91cf\u7ea7\u51e0\u4e4e\u8981\u4e0a\u5929\uff01<\/p>\n\n\n\n<p>\u4e3a\u4e86\u63d0\u9ad8\u8fd0\u884c\u6548\u7387\uff0c\u7167\u4e0a\u9762\u7684\u65b9\u6cd5\u4f7f\u7528\u591a\u4efb\u52a1\u3002\u4f46\u662f\u6b64\u6b21\u6ca1\u6709\u540c\u65f6\u5f00\u542f4800\u591a\u4e07\u4e2a\u4efb\u52a1\u3002\u800c\u662f\u8981\u63a7\u5236\u4efb\u52a1\u961f\u5217\u7684\u6570\u91cf\u3002\u4e3a\u6b64\u589e\u52a0\u4e86\u5982\u4e0b\u4e00\u6bb5\u4ee3\u7801\uff1a<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\n                            \/\/ \u68c0\u67e5\u4efb\u52a1\u961f\u5217\u957f\u5ea6\n                            while(tasks.Count &gt; 10000000)\n                            {\n                                \/\/ \u8bb0\u5f55\u65e5\u5fd7\n                                Log.LogMessage(&quot;SentenceStatistic&quot;, &quot;MakeStatistic&quot;, &quot;\u4efb\u52a1\u5df2\u6ee1\uff0c\u9700\u8981\u7b49\u5f85\u5168\u90e8\u7ed3\u675f\uff01&quot;);\n                                \/\/ \u7b49\u5f85\u5168\u90e8\u4efb\u52a1\u7ed3\u675f\n                                Task.WaitAll(tasks.ToArray()); tasks.Clear();\n                                \/\/ \u8bb0\u5f55\u65e5\u5fd7\n                                Log.LogMessage(&quot;SentenceStatistic&quot;, &quot;MakeStatistic&quot;, &quot;\u4efb\u52a1\u5168\u90e8\u7ed3\u675f\uff0c\u7ee7\u7eed\u5206\u914d\u65b0\u4efb\u52a1\uff01&quot;);\n                            }\n\n<\/pre><\/div>\n\n\n<p>\u8fd8\u662f\u540c\u65f6\u5f00\u542f1000\u591a\u4e07\u4e2a\u4efb\u52a1\uff0c\u7136\u540e\u7b49\u5f85\u5b8c\u6210\u3002\u8fd9\u6b21\u7531\u4e8e\u5339\u914d\u6bd4\u8f83\u7b80\u5355\uff0c\u6ca1\u6709\u91c7\u7528Regex.Match\u51fd\u6570\uff0c\u5426\u5219\u6548\u7387\u53ef\u80fd\u8fd8\u8981\u66f4\u4f4e\u3002<\/p>\n\n\n\n<p>\u6839\u636e\u5b9e\u9645\u8fd0\u884c\u7684\u6548\u679c\uff0c\u4f5c\u8005\u4f30\u7b97\uff1a\u5b8c\u6210\u5168\u90e8\u7684\u7edf\u8ba1\u5206\u6790\u9700\u89813\u5e74\u7684\u65f6\u95f4\uff01\u8fd9\u6837\u6765\u770b\uff0c\u4e0d\u8981\u5f00\u542f\u8fc7\u591a\u7684\u9891\u6b21\u7edf\u8ba1\uff0c\u5426\u5219\u8ba1\u7b97\u91cf\u4e0d\u662f\u4e00\u822c\u7684\u5927\u3002\u73b0\u5728\u9700\u8981\u51b3\u5b9a\uff1a\u53ea\u7edf\u8ba1\u591a\u957f\u7684\u5b57\u7b26\u4e32\u5c31\u8db3\u591f\u4e86\u3002\u5426\u5219\uff0c\u8fd9\u53f0\u8bbe\u5907\u662f\u65e0\u6cd5\u5b8c\u6210\u4efb\u52a1\u7684\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e09\u3001\u75af\u72c2\u7684\u603b\u7ed3<\/h2>\n\n\n\n<p>\u5728\u4e0a\u8ff0\u7684\u5185\u5bb9\u4e2d\uff0c\u505a\u4e86\u4e00\u4e9b\u6bd4\u8f83\u75af\u72c2\u7684\u4e8b\u60c5\uff0c\u4f46\u662fWindows 11\u4e00\u5207\u8fd0\u884c\u6b63\u5e38\uff0c\u5e76\u672a\u51fa\u73b0\u4efb\u4f55\u95ee\u9898\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u4e00\u6b21\u6027\u5c0648,218,815\u6761\u77ed\u53e5\u88c5\u5165\u5230Dictionary&lt;string, int&gt;\u4e4b\u4e2d\u3002<\/li>\n\n\n\n<li>\u4e00\u6b21\u6027\u5f00\u542f1000\u4e07\u4e2a\u4efb\u52a1\uff0c\u5e76\u4e14\u7b49\u5f85\u8fd9\u4e9b\u4efb\u52a1\u5b8c\u6210\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u7ed3\u679c\uff0c\u8fd9\u4e9b\u65b9\u6cd5\u6280\u5de7\u5728\u8ba1\u7b97\u91cf\u9762\u524d\uff0c\u5c31\u662f\u4e2a\u6e23\u3002\u8fd8\u662f\u8981\u60f3\u529e\u6cd5\u4ece\u7b97\u6cd5\u4e0a\u6765\u89e3\u51b3\uff0c\u5149\u9760\u201c\u66b4\u529b\u201d\u662f\u4e0d\u884c\u7684\u3002<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p><strong>\u77e5\u4e4e\uff1a<\/strong><a rel=\"noreferrer noopener\" href=\"https:\/\/zhuanlan.zhihu.com\/p\/542073251\" target=\"_blank\">\u6211\u7684NLP\uff08\u81ea\u7136\u8bed\u8a00\u5904\u7406\uff09\u5386\u7a0b\uff0811\uff09\u2014\u2014\u75af\u72c2\u7684\u9ea6\u514b\u65af<\/a><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u7ae0\u5c06\u4ecb\u7ecdC#\u591a\u4efb\u52a1\u5728\u6570\u636e\u7edf\u8ba1\u5206\u6790\u4e0a\u7684\u5e94\u7528\u3002\u53e6\u5916\uff0c\u4f5c\u8005\u4ece\u4e00\u4e2a\u4fa7\u9762\u8868\u8fbe\u4e00\u4e0b\uff1aNLP\u4e2d\u7684\u8ba1\u7b97\u91cf\u662f\u76f8\u5f53\u201c\u6050\u6016\u201d\u7684\u3002  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":1469,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1507","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"http:\/\/www.algmain.com\/index.php\/wp-json\/wp\/v2\/pages\/1507"}],"collection":[{"href":"http:\/\/www.algmain.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/www.algmain.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/www.algmain.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.algmain.com\/index.php\/wp-json\/wp\/v2\/comments?post=1507"}],"version-history":[{"count":3,"href":"http:\/\/www.algmain.com\/index.php\/wp-json\/wp\/v2\/pages\/1507\/revisions"}],"predecessor-version":[{"id":1547,"href":"http:\/\/www.algmain.com\/index.php\/wp-json\/wp\/v2\/pages\/1507\/revisions\/1547"}],"up":[{"embeddable":true,"href":"http:\/\/www.algmain.com\/index.php\/wp-json\/wp\/v2\/pages\/1469"}],"wp:attachment":[{"href":"http:\/\/www.algmain.com\/index.php\/wp-json\/wp\/v2\/media?parent=1507"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}