{"id":99769,"date":"2022-03-30T21:43:51","date_gmt":"2022-03-30T13:43:51","guid":{"rendered":"http:\/\/www.zhushiyao.com\/?p=99769"},"modified":"2022-03-30T21:44:22","modified_gmt":"2022-03-30T13:44:22","slug":"04c4d82e98","status":"publish","type":"post","link":"http:\/\/www.zhushiyao.com\/?p=99769","title":{"rendered":"\u6bd4\u6b63\u5219\u5feb M \u500d\u4ee5\u4e0a\uff01Python \u66ff\u6362\u5b57\u7b26\u4e32\u7684\u65b0\u59ff\u52bf"},"content":{"rendered":"<div class=\"bpp-post-content\">\n<section style=\"text-align: center; margin-bottom: 20px;\"><img decoding=\"async\" class=\"rich_pages wxw-img\" style=\"text-align: justify;\" title=\"\u6bd4\u6b63\u5219\u5feb M \u500d\u4ee5\u4e0a\uff01Python \u66ff\u6362\u5b57\u7b26\u4e32\u7684\u65b0\u59ff\u52bf\" src=\"http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2022\/03\/7-1648647833.png\" alt=\"\u6bd4\u6b63\u5219\u5feb M \u500d\u4ee5\u4e0a\uff01Python \u66ff\u6362\u5b57\u7b26\u4e32\u7684\u65b0\u59ff\u52bf\" \/><\/section>\n<p><span style=\"background-color: #ffffff; color: #666666; font-family: 'PingFang SC', 'Microsoft Yahei', 'Helvetica Neue', Helvetica, STHeiTi, sans-serif; font-size: 15px; text-align: start;\">FlashText \u7b97\u6cd5\u662f\u7531 Vikash Singh \u4e8e2017\u5e74\u53d1\u8868\u7684\u5927\u89c4\u6a21\u5173\u952e\u8bcd\u66ff\u6362\u7b97\u6cd5\uff0c\u8fd9\u4e2a\u7b97\u6cd5\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4ec5\u7531\u6587\u672c\u957f\u5ea6\uff08N\uff09\u51b3\u5b9a\uff0c\u7b97\u6cd5\u65f6\u95f4\u590d\u6742\u5ea6\u4e3aO\uff08N\uff09\u3002<\/span><\/p>\n<p><span style=\"background-color: #ffffff; color: #666666; font-family: 'PingFang SC', 'Microsoft Yahei', 'Helvetica Neue', Helvetica, STHeiTi, sans-serif; font-size: 15px; text-align: start;\">\u00a0<\/span><\/p>\n<p style=\"margin-top: 4px; margin-bottom: 26px; background: #ffffff; overflow-x: auto; color: #666666; font-family: 'PingFang SC', 'Microsoft Yahei', 'Helvetica Neue', Helvetica, STHeiTi, sans-serif; font-size: 15px; text-align: start; border: 0px initial initial;\">\u800c\u5bf9\u4e8e\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u66ff\u6362\uff0c\u7b97\u6cd5\u65f6\u95f4\u590d\u6742\u5ea6\u8fd8\u9700\u8981\u8003\u8651\u88ab\u66ff\u6362\u7684\u5173\u952e\u8bcd\u6570\u91cf\uff08M\uff09\uff0c\u56e0\u6b64\u65f6\u95f4\u590d\u6742\u5ea6\u4e3aO\uff08MxN\uff09\u3002<\/p>\n<p style=\"margin-top: 4px; margin-bottom: 26px; background: #ffffff; overflow-x: auto; color: #666666; font-family: 'PingFang SC', 'Microsoft Yahei', 'Helvetica Neue', Helvetica, STHeiTi, sans-serif; font-size: 15px; text-align: start; border: 0px initial initial;\">\u7b80\u800c\u8a00\u4e4b\uff0c<strong>\u57fa\u4e8eFlashText\u7b97\u6cd5\u7684\u5b57\u7b26\u4e32\u66ff\u6362\u6bd4\u6b63\u5219\u8868\u8fbe\u5f0f\u66ff\u6362\u5febM\u500d\u4ee5\u4e0a\uff0c\u8fd9\u4e2aM\u662f\u9700\u8981\u66ff\u6362\u7684\u5173\u952e\u8bcd\u6570\u91cf\uff0c\u5173\u952e\u8bcd\u8d8a\u591a\uff0cFlashText\u7b97\u6cd5\u7684\u4f18\u52bf\u5c31\u8d8a\u660e\u663e<\/strong>\u3002<\/p>\n<p style=\"margin-top: 4px; margin-bottom: 26px; background: #ffffff; overflow-x: auto; color: #666666; font-family: 'PingFang SC', 'Microsoft Yahei', 'Helvetica Neue', Helvetica, STHeiTi, sans-serif; font-size: 15px; text-align: start; border: 0px initial initial;\">\u4e0b\u9762\u5c31\u7ed9\u5927\u5bb6\u4ecb\u7ecd\u5982\u4f55\u5728 Python \u4e2d\u57fa\u4e8e\u00a0<strong>flashtext<\/strong>\u00a0\u6a21\u5757\u4f7f\u7528\u00a0<strong>FlashText<\/strong>\u00a0\u7b97\u6cd5\u8fdb\u884c\u5b57\u7b26\u4e32\u67e5\u627e\u548c\u66ff\u6362\uff0c\u5982\u679c\u89c9\u5f97\u5bf9\u4f60\u7684\u9879\u76ee\u56e2\u961f\u5f88\u6709\u5e2e\u52a9\uff0c\u8bf7\u8bb0\u5f97\u8f6c\u53d1\u4e00\u4e0b\u54e6\u3002<\/p>\n<section>\n<section>\n<section style=\"font-size: 16px;\">\n<section style=\"text-align: left; margin: 10px 0%;\">\n<section style=\"display: inline-block; width: auto; vertical-align: top; min-width: 10%; height: auto;\">\n<section>\n<section style=\"display: flex; flex-flow: row nowrap;\">\n<section style=\"display: inline-block; vertical-align: bottom; width: auto; align-self: flex-end; flex: 0 0 auto; min-width: 10%; height: auto;\">\n<section style=\"text-align: right;\">\n<section style=\"display: inline-block; width: auto; vertical-align: top; min-width: 10%; height: auto; border-bottom: 4px solid #0f4c81; border-bottom-right-radius: 0px; padding-right: 10px;\">\n<section style=\"text-align: center; font-size: 24px; color: #0f4c81;\"><span style=\"font-size: 18px;\"><em><strong>1.\u51c6\u5907<\/strong><\/em><\/span><\/p>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<section style=\"display: inline-block; vertical-align: bottom; width: auto; align-self: flex-end; flex: 100 100 0%; height: auto; border-width: 2px 3px 4px 4px; border-radius: 0px; border-style: solid solid solid none; border-color: #0f4c81; padding-top: 5px; padding-right: 10px; padding-bottom: 5px;\">\n<section style=\"text-align: justify; color: #0f4c81;\">\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<section>\n<pre style=\"background-image: none; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;\"><code style=\"border-radius: 4px; font-size: 0.85em; margin-right: 0.15em; margin-left: 0.15em; background: #282c34; color: #abb2bf; display: block; padding: 5.20625px; overflow-x: auto; white-space: nowrap;\"><span style=\"font-size: 12px;\">pip install flashtext<\/span><\/code><\/pre>\n<\/section>\n<section>\n<section>\n<section style=\"font-size: 16px;\">\n<section style=\"text-align: left; margin: 10px 0%;\">\n<section style=\"display: inline-block; width: auto; vertical-align: top; min-width: 10%; height: auto;\">\n<section>\n<section style=\"display: flex; flex-flow: row nowrap;\">\n<section style=\"display: inline-block; vertical-align: bottom; width: auto; align-self: flex-end; flex: 0 0 auto; min-width: 10%; height: auto;\">\n<section style=\"text-align: right;\">\n<section style=\"display: inline-block; width: auto; vertical-align: top; min-width: 10%; height: auto; border-bottom: 4px solid #0f4c81; border-bottom-right-radius: 0px; padding-right: 10px;\">\n<section style=\"text-align: center; font-size: 24px; color: #0f4c81;\"><span style=\"font-size: 18px;\"><em><strong>2.\u57fa\u672c\u4f7f\u7528<\/strong><\/em><\/span><\/p>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<section style=\"display: inline-block; vertical-align: bottom; width: auto; align-self: flex-end; flex: 100 100 0%; height: auto; border-width: 2px 3px 4px 4px; border-radius: 0px; border-style: solid solid solid none; border-color: #0f4c81; padding-top: 5px; padding-right: 10px; padding-bottom: 5px;\">\n<section style=\"text-align: justify; color: #0f4c81;\">\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<p style=\"margin-top: 4px; margin-bottom: 26px; background: #ffffff; overflow-x: auto; color: #666666; font-family: 'PingFang SC', 'Microsoft Yahei', 'Helvetica Neue', Helvetica, STHeiTi, sans-serif; font-size: 15px; text-align: start; border: 0px initial initial;\"><strong>\u63d0\u53d6\u5173\u952e\u8bcd<\/strong><\/p>\n<p style=\"margin-top: 4px; margin-bottom: 26px; background: #ffffff; overflow-x: auto; color: #666666; font-family: 'PingFang SC', 'Microsoft Yahei', 'Helvetica Neue', Helvetica, STHeiTi, sans-serif; font-size: 15px; text-align: start; border: 0px initial initial;\">\u4e00\u4e2a\u6700\u57fa\u672c\u7684\u63d0\u53d6\u5173\u952e\u8bcd\u7684\u4f8b\u5b50\u5982\u4e0b\uff1a<\/p>\n<section>\n<pre style=\"background-image: none; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;\"><code style=\"border-radius: 4px; font-size: 0.85em; margin-right: 0.15em; margin-left: 0.15em; background: #282c34; color: #abb2bf; display: block; padding: 5.20625px; overflow-x: auto; white-space: nowrap;\"><span style=\"font-size: 10px;\"><span style=\"color: #c678dd; background: rgba(0, 0, 0, 0); width: 26px; text-decoration-style: solid; text-decoration-color: #c678dd;\">from<\/span>\u00a0flashtext <span style=\"color: #c678dd; background: rgba(0, 0, 0, 0); width: 39px; text-decoration-style: solid; text-decoration-color: #c678dd;\">import<\/span>\u00a0KeywordProcessor\n<span style=\"color: #5c6370; background: rgba(0, 0, 0, 0); width: 141px; text-decoration-style: solid; text-decoration-color: #5c6370; font-style: italic;\"># 1. \u521d\u59cb\u5316\u5173\u952e\u5b57\u5904\u7406\u5668<\/span>\nkeyword_processor = KeywordProcessor()\n<span style=\"color: #5c6370; background: rgba(0, 0, 0, 0); width: 93px; text-decoration-style: solid; text-decoration-color: #5c6370; font-style: italic;\"># 2. \u6dfb\u52a0\u5173\u952e\u8bcd<\/span>\nkeyword_processor.add_keyword(<span style=\"color: #98c379; background: rgba(0, 0, 0, 0); width: 72px; text-decoration-style: solid; text-decoration-color: #98c379;\">'Big Apple'<\/span>, <span style=\"color: #98c379; background: rgba(0, 0, 0, 0); width: 66px; text-decoration-style: solid; text-decoration-color: #98c379;\">'New York'<\/span>)\nkeyword_processor.add_keyword(<span style=\"color: #98c379; background: rgba(0, 0, 0, 0); width: 66px; text-decoration-style: solid; text-decoration-color: #98c379;\">'Bay Area'<\/span>)\n<span style=\"color: #5c6370; background: rgba(0, 0, 0, 0); width: 201px; text-decoration-style: solid; text-decoration-color: #5c6370; font-style: italic;\"># 3. \u5904\u7406\u76ee\u6807\u53e5\u5b50\u5e76\u63d0\u53d6\u76f8\u5e94\u5173\u952e\u8bcd<\/span>\nkeywords_found = keyword_processor.extract_keywords(<span style=\"color: #98c379; background: rgba(0, 0, 0, 0); width: 211px; text-decoration-style: solid; text-decoration-color: #98c379;\">'I love Big Apple and Bay Area.'<\/span>)\n<span style=\"color: #5c6370; background: rgba(0, 0, 0, 0); width: 57px; text-decoration-style: solid; text-decoration-color: #5c6370; font-style: italic;\"># 4. \u7ed3\u679c<\/span>\nprint(keywords_found)\n<span style=\"color: #5c6370; background: rgba(0, 0, 0, 0); width: 171px; text-decoration-style: solid; text-decoration-color: #5c6370; font-style: italic;\"># ['New York', 'Bay Area']<\/span><\/span><\/code><\/pre>\n<\/section>\n<p style=\"margin-top: 4px; margin-bottom: 26px; background: #ffffff; overflow-x: auto; color: #666666; font-family: 'PingFang SC', 'Microsoft Yahei', 'Helvetica Neue', Helvetica, STHeiTi, sans-serif; font-size: 15px; text-align: start; border: 0px initial initial;\">\u5176\u4e2d<strong style=\"font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; text-align: justify;\"><span style=\"background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; overflow-x: auto;\"><span style=\"color: #404040; font-size: 16px; background-color: #fcfcfc;\">\u00a0<\/span><code style=\"padding: 2px 5px; font-size: 12px; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; color: #e74c3c; overflow-x: auto; border: 1px solid #e1e4e5;\" translate=\"no\">add_keyword<\/code><span style=\"color: #404040; font-size: 16px; background-color: #fcfcfc;\">\u00a0<\/span><\/span><\/strong>\u7684\u7b2c\u4e00\u4e2a\u53c2\u6570\u4ee3\u8868\u9700\u8981\u88ab\u67e5\u627e\u7684\u5173\u952e\u8bcd\uff0c\u7b2c\u4e8c\u4e2a\u53c2\u6570\u662f\u7ed9\u8fd9\u4e2a\u5173\u952e\u8bcd\u4e00\u4e2a\u522b\u540d\uff0c\u5982\u679c\u627e\u5230\u4e86\u5219\u4ee5\u522b\u540d\u663e\u793a\u3002<\/p>\n<p style=\"margin-top: 4px; margin-bottom: 26px; background: #ffffff; overflow-x: auto; color: #666666; font-family: 'PingFang SC', 'Microsoft Yahei', 'Helvetica Neue', Helvetica, STHeiTi, sans-serif; font-size: 15px; text-align: start; border: 0px initial initial;\"><strong>\u66ff\u6362\u5173\u952e\u8bcd<\/strong><\/p>\n<p style=\"margin-top: 4px; margin-bottom: 26px; background: #ffffff; overflow-x: auto; color: #666666; font-family: 'PingFang SC', 'Microsoft Yahei', 'Helvetica Neue', Helvetica, STHeiTi, sans-serif; font-size: 15px; text-align: start; border: 0px initial initial;\">\u5982\u679c\u4f60\u60f3\u8981\u66ff\u6362\u5173\u952e\u8bcd\uff0c\u53ea\u9700\u8981\u8c03\u7528\u5904\u7406\u5668\u7684<strong style=\"font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; text-align: justify;\"><span style=\"background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; overflow-x: auto;\"><span style=\"color: #404040; font-size: 16px; background-color: #fcfcfc;\">\u00a0<\/span><code style=\"padding: 2px 5px; font-size: 12px; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; color: #e74c3c; overflow-x: auto; border: 1px solid #e1e4e5;\" translate=\"no\">replace_keywords<\/code><span style=\"color: #404040; font-size: 16px; background-color: #fcfcfc;\">\u00a0<\/span><\/span><\/strong>\u51fd\u6570\uff1a<\/p>\n<section>\n<pre style=\"background-image: none; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;\"><code style=\"border-radius: 4px; font-size: 0.85em; margin-right: 0.15em; margin-left: 0.15em; background: #282c34; color: #abb2bf; display: block; padding: 5.20625px; overflow-x: auto; white-space: nowrap;\"><span style=\"font-size: 10px;\"><span style=\"color: #c678dd; background: rgba(0, 0, 0, 0); width: 26px; text-decoration-style: solid; text-decoration-color: #c678dd;\">from<\/span>\u00a0flashtext <span style=\"color: #c678dd; background: rgba(0, 0, 0, 0); width: 39px; text-decoration-style: solid; text-decoration-color: #c678dd;\">import<\/span>\u00a0KeywordProcessor\n<span style=\"color: #5c6370; background: rgba(0, 0, 0, 0); width: 141px; text-decoration-style: solid; text-decoration-color: #5c6370; font-style: italic;\"># 1. \u521d\u59cb\u5316\u5173\u952e\u5b57\u5904\u7406\u5668<\/span>\nkeyword_processor = KeywordProcessor()\n<span style=\"color: #5c6370; background: rgba(0, 0, 0, 0); width: 93px; text-decoration-style: solid; text-decoration-color: #5c6370; font-style: italic;\"># 2. \u6dfb\u52a0\u5173\u952e\u8bcd<\/span>\nkeyword_processor.add_keyword(<span style=\"color: #98c379; background: rgba(0, 0, 0, 0); width: 72px; text-decoration-style: solid; text-decoration-color: #98c379;\">'New Delhi'<\/span>, <span style=\"color: #98c379; background: rgba(0, 0, 0, 0); width: 80px; text-decoration-style: solid; text-decoration-color: #98c379;\">'NCR region'<\/span>)\n<span style=\"color: #5c6370; background: rgba(0, 0, 0, 0); width: 93px; text-decoration-style: solid; text-decoration-color: #5c6370; font-style: italic;\"># 3. \u66ff\u6362\u5173\u952e\u8bcd<\/span>\nnew_sentence = keyword_processor.replace_keywords(<span style=\"color: #98c379; background: rgba(0, 0, 0, 0); width: 217px; text-decoration-style: solid; text-decoration-color: #98c379;\">'I love Big Apple and new delhi.'<\/span>)\n<span style=\"color: #5c6370; background: rgba(0, 0, 0, 0); width: 57px; text-decoration-style: solid; text-decoration-color: #5c6370; font-style: italic;\"># 4. \u7ed3\u679c<\/span>\nprint(new_sentence)\n<span style=\"color: #5c6370; background: rgba(0, 0, 0, 0); width: 231px; text-decoration-style: solid; text-decoration-color: #5c6370; font-style: italic;\"># 'I love New York and NCR region.'<\/span><\/span><\/code><\/pre>\n<\/section>\n<p style=\"margin-top: 4px; margin-bottom: 26px; background: #ffffff; overflow-x: auto; color: #666666; font-family: 'PingFang SC', 'Microsoft Yahei', 'Helvetica Neue', Helvetica, STHeiTi, sans-serif; font-size: 15px; text-align: start; border: 0px initial initial;\"><strong>\u5173\u952e\u8bcd\u5927\u5c0f\u5199\u654f\u611f<\/strong><\/p>\n<p style=\"margin-top: 4px; margin-bottom: 26px; background: #ffffff; overflow-x: auto; color: #666666; font-family: 'PingFang SC', 'Microsoft Yahei', 'Helvetica Neue', Helvetica, STHeiTi, sans-serif; font-size: 15px; text-align: start; border: 0px initial initial;\">\u5982\u679c\u4f60\u9700\u8981\u7cbe\u786e\u63d0\u53d6\uff0c\u8bc6\u522b\u5927\u5c0f\u5199\u5b57\u6bcd\uff0c\u90a3\u4e48\u4f60\u53ef\u4ee5\u5728\u5904\u7406\u5668\u521d\u59cb\u5316\u7684\u65f6\u5019\u8bbe\u5b9a<strong style=\"font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; text-align: justify;\"><span style=\"background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; overflow-x: auto;\"><span style=\"color: #404040; font-size: 16px; background-color: #fcfcfc;\">\u00a0<\/span><code style=\"padding: 2px 5px; font-size: 12px; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; color: #e74c3c; overflow-x: auto; border: 1px solid #e1e4e5;\" translate=\"no\">sensitive<\/code><span style=\"color: #404040; font-size: 16px; background-color: #fcfcfc;\">\u00a0<\/span><\/span><\/strong>\u53c2\u6570:<\/p>\n<section>\n<pre style=\"background-image: none; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;\"><code style=\"border-radius: 4px; font-size: 0.85em; margin-right: 0.15em; margin-left: 0.15em; background: #282c34; color: #abb2bf; display: block; padding: 5.20625px; overflow-x: auto; white-space: nowrap;\"><span style=\"font-size: 12px;\"><span style=\"color: #c678dd; background: rgba(0, 0, 0, 0); width: 26px; text-decoration-style: solid; text-decoration-color: #c678dd;\">from<\/span>\u00a0flashtext <span style=\"color: #c678dd; background: rgba(0, 0, 0, 0); width: 39px; text-decoration-style: solid; text-decoration-color: #c678dd;\">import<\/span>\u00a0KeywordProcessor\n<span style=\"color: #5c6370; background: rgba(0, 0, 0, 0); width: 406px; text-decoration-style: solid; text-decoration-color: #5c6370; font-style: italic;\"># 1. \u521d\u59cb\u5316\u5173\u952e\u5b57\u5904\u7406\u5668, \u6ce8\u610f\u8bbe\u7f6e\u5927\u5c0f\u5199\u654f\u611f(case_sensitive)\u4e3aTRUE<\/span>\nkeyword_processor = KeywordProcessor(case_sensitive=<span style=\"color: #c678dd; background: rgba(0, 0, 0, 0); width: 26px; text-decoration-style: solid; text-decoration-color: #c678dd;\">True<\/span>)\n<span style=\"color: #5c6370; background: rgba(0, 0, 0, 0); width: 93px; text-decoration-style: solid; text-decoration-color: #5c6370; font-style: italic;\"># 2. \u6dfb\u52a0\u5173\u952e\u8bcd<\/span>\nkeyword_processor.add_keyword(<span style=\"color: #98c379; background: rgba(0, 0, 0, 0); width: 72px; text-decoration-style: solid; text-decoration-color: #98c379;\">'Big Apple'<\/span>, <span style=\"color: #98c379; background: rgba(0, 0, 0, 0); width: 66px; text-decoration-style: solid; text-decoration-color: #98c379;\">'New York'<\/span>)\nkeyword_processor.add_keyword(<span style=\"color: #98c379; background: rgba(0, 0, 0, 0); width: 66px; text-decoration-style: solid; text-decoration-color: #98c379;\">'Bay Area'<\/span>)\n<span style=\"color: #5c6370; background: rgba(0, 0, 0, 0); width: 201px; text-decoration-style: solid; text-decoration-color: #5c6370; font-style: italic;\"># 3. \u5904\u7406\u76ee\u6807\u53e5\u5b50\u5e76\u63d0\u53d6\u76f8\u5e94\u5173\u952e\u8bcd<\/span>\nkeywords_found = keyword_processor.extract_keywords(<span style=\"color: #98c379; background: rgba(0, 0, 0, 0); width: 211px; text-decoration-style: solid; text-decoration-color: #98c379;\">'I love big Apple and Bay Area.'<\/span>)\n<span style=\"color: #5c6370; background: rgba(0, 0, 0, 0); width: 57px; text-decoration-style: solid; text-decoration-color: #5c6370; font-style: italic;\"># 4. \u7ed3\u679c<\/span>\nprint(keywords_found)\n<span style=\"color: #5c6370; background: rgba(0, 0, 0, 0); width: 92px; text-decoration-style: solid; text-decoration-color: #5c6370; font-style: italic;\"># ['Bay Area']<\/span><\/span><\/code><\/pre>\n<\/section>\n<p style=\"margin-top: 4px; margin-bottom: 26px; background: #ffffff; overflow-x: auto; color: #666666; font-family: 'PingFang SC', 'Microsoft Yahei', 'Helvetica Neue', Helvetica, STHeiTi, sans-serif; font-size: 15px; text-align: start; border: 0px initial initial;\"><strong>\u6807\u8bb0\u5173\u952e\u8bcd\u4f4d\u7f6e<\/strong><\/p>\n<p style=\"margin-top: 4px; margin-bottom: 26px; background: #ffffff; overflow-x: auto; color: #666666; font-family: 'PingFang SC', 'Microsoft Yahei', 'Helvetica Neue', Helvetica, STHeiTi, sans-serif; font-size: 15px; text-align: start; border: 0px initial initial;\">\u5982\u679c\u4f60\u9700\u8981\u83b7\u53d6\u5173\u952e\u8bcd\u5728\u53e5\u5b50\u4e2d\u7684\u4f4d\u7f6e\uff0c\u5728<strong style=\"font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; text-align: justify;\"><span style=\"background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; overflow-x: auto;\"><span style=\"color: #404040; font-size: 16px; background-color: #fcfcfc;\">\u00a0<\/span><code style=\"padding: 2px 5px; font-size: 12px; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; color: #e74c3c; overflow-x: auto; border: 1px solid #e1e4e5;\" translate=\"no\">extract_keywords<\/code><span style=\"color: #404040; font-size: 16px; background-color: #fcfcfc;\">\u00a0<\/span><\/span><\/strong>\u7684\u65f6\u5019\u6dfb\u52a0<strong style=\"font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; text-align: justify;\"><span style=\"background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; overflow-x: auto;\"><span style=\"color: #404040; font-size: 16px; background-color: #fcfcfc;\">\u00a0<\/span><code style=\"padding: 2px 5px; font-size: 12px; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; color: #e74c3c; overflow-x: auto; border: 1px solid #e1e4e5;\" translate=\"no\">span_info=True<\/code><span style=\"color: #404040; font-size: 16px; background-color: #fcfcfc;\">\u00a0<\/span><\/span><\/strong>\u53c2\u6570\u5373\u53ef\uff1a<\/p>\n<section>\n<pre style=\"background-image: none; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;\"><code style=\"border-radius: 4px; font-size: 0.85em; margin-right: 0.15em; margin-left: 0.15em; background: #282c34; color: #abb2bf; display: block; padding: 5.20625px; overflow-x: auto; white-space: nowrap;\"><span style=\"font-size: 12px;\"><span style=\"color: #c678dd; background: rgba(0, 0, 0, 0); width: 26px; text-decoration-style: solid; text-decoration-color: #c678dd;\">from<\/span>\u00a0flashtext <span style=\"color: #c678dd; background: rgba(0, 0, 0, 0); width: 39px; text-decoration-style: solid; text-decoration-color: #c678dd;\">import<\/span>\u00a0KeywordProcessor\n<span style=\"color: #5c6370; background: rgba(0, 0, 0, 0); width: 141px; text-decoration-style: solid; text-decoration-color: #5c6370; font-style: italic;\"># 1. \u521d\u59cb\u5316\u5173\u952e\u5b57\u5904\u7406\u5668<\/span>\nkeyword_processor = KeywordProcessor()\n<span style=\"color: #5c6370; background: rgba(0, 0, 0, 0); width: 93px; text-decoration-style: solid; text-decoration-color: #5c6370; font-style: italic;\"># 2. \u6dfb\u52a0\u5173\u952e\u8bcd<\/span>\nkeyword_processor.add_keyword(<span style=\"color: #98c379; background: rgba(0, 0, 0, 0); width: 72px; text-decoration-style: solid; text-decoration-color: #98c379;\">'Big Apple'<\/span>, <span style=\"color: #98c379; background: rgba(0, 0, 0, 0); width: 66px; text-decoration-style: solid; text-decoration-color: #98c379;\">'New York'<\/span>)\nkeyword_processor.add_keyword(<span style=\"color: #98c379; background: rgba(0, 0, 0, 0); width: 66px; text-decoration-style: solid; text-decoration-color: #98c379;\">'Bay Area'<\/span>)\n<span style=\"color: #5c6370; background: rgba(0, 0, 0, 0); width: 382px; text-decoration-style: solid; text-decoration-color: #5c6370; font-style: italic;\"># 3. \u5904\u7406\u76ee\u6807\u53e5\u5b50\u5e76\u63d0\u53d6\u76f8\u5e94\u5173\u952e\u8bcd, \u5e76\u6807\u8bb0\u5173\u952e\u8bcd\u7684\u8d77\u59cb\u3001\u7ec8\u6b62\u4f4d\u7f6e<\/span>\nkeywords_found = keyword_processor.extract_keywords(<span style=\"color: #98c379; background: rgba(0, 0, 0, 0); width: 211px; text-decoration-style: solid; text-decoration-color: #98c379;\">'I love big Apple and Bay Area.'<\/span>, span_info=<span style=\"color: #c678dd; background: rgba(0, 0, 0, 0); width: 27px; text-decoration-style: solid; text-decoration-color: #c678dd;\">True<\/span>)\n<span style=\"color: #5c6370; background: rgba(0, 0, 0, 0); width: 57px; text-decoration-style: solid; text-decoration-color: #5c6370; font-style: italic;\"># 4. \u7ed3\u679c<\/span>\nprint(keywords_found)\n<span style=\"color: #5c6370; background: rgba(0, 0, 0, 0); width: 297px; text-decoration-style: solid; text-decoration-color: #5c6370; font-style: italic;\"># [('New York', 7, 16), ('Bay Area', 21, 29)]<\/span><\/span><\/code><\/pre>\n<\/section>\n<p style=\"margin-top: 4px; margin-bottom: 26px; background: #ffffff; overflow-x: auto; color: #666666; font-family: 'PingFang SC', 'Microsoft Yahei', 'Helvetica Neue', Helvetica, STHeiTi, sans-serif; font-size: 15px; text-align: start; border: 0px initial initial;\"><strong>\u83b7\u53d6\u76ee\u524d\u6240\u6709\u7684\u5173\u952e\u8bcd<\/strong><\/p>\n<p style=\"margin-top: 4px; margin-bottom: 26px; background: #ffffff; overflow-x: auto; color: #666666; font-family: 'PingFang SC', 'Microsoft Yahei', 'Helvetica Neue', Helvetica, STHeiTi, sans-serif; font-size: 15px; text-align: start; border: 0px initial initial;\">\u5982\u679c\u4f60\u9700\u8981\u83b7\u53d6\u5f53\u524d\u5df2\u7ecf\u6dfb\u52a0\u7684\u6240\u6709\u5173\u952e\u8bcd\uff0c\u53ea\u9700\u8981\u8c03\u7528\u5904\u7406\u5668\u7684<strong style=\"font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; text-align: justify;\"><span style=\"background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; overflow-x: auto;\"><span style=\"color: #404040; font-size: 16px; background-color: #fcfcfc;\">\u00a0<\/span><code style=\"padding: 2px 5px; font-size: 12px; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; color: #e74c3c; overflow-x: auto; border: 1px solid #e1e4e5;\" translate=\"no\">get_all_keywords<\/code><span style=\"color: #404040; font-size: 16px; background-color: #fcfcfc;\">\u00a0<\/span><\/span><\/strong>\u51fd\u6570\uff1a<\/p>\n<section>\n<pre style=\"background-image: none; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;\"><code style=\"border-radius: 4px; font-size: 0.85em; margin-right: 0.15em; margin-left: 0.15em; background: #282c34; color: #abb2bf; display: block; padding: 5.20625px; overflow-x: auto; white-space: nowrap;\"><span style=\"font-size: 12px;\"><span style=\"color: #c678dd; background: rgba(0, 0, 0, 0); width: 26px; text-decoration-style: solid; text-decoration-color: #c678dd;\">from<\/span>\u00a0flashtext <span style=\"color: #c678dd; background: rgba(0, 0, 0, 0); width: 39px; text-decoration-style: solid; text-decoration-color: #c678dd;\">import<\/span>\u00a0KeywordProcessor\n<span style=\"color: #5c6370; background: rgba(0, 0, 0, 0); width: 141px; text-decoration-style: solid; text-decoration-color: #5c6370; font-style: italic;\"># 1. \u521d\u59cb\u5316\u5173\u952e\u5b57\u5904\u7406\u5668<\/span>\nkeyword_processor = KeywordProcessor()\n<span style=\"color: #5c6370; background: rgba(0, 0, 0, 0); width: 93px; text-decoration-style: solid; text-decoration-color: #5c6370; font-style: italic;\"># 2. \u6dfb\u52a0\u5173\u952e\u8bcd<\/span>\nkeyword_processor.add_keyword(<span style=\"color: #98c379; background: rgba(0, 0, 0, 0); width: 39px; text-decoration-style: solid; text-decoration-color: #98c379;\">'j2ee'<\/span>, <span style=\"color: #98c379; background: rgba(0, 0, 0, 0); width: 40px; text-decoration-style: solid; text-decoration-color: #98c379;\">'Java'<\/span>)\nkeyword_processor.add_keyword(<span style=\"color: #98c379; background: rgba(0, 0, 0, 0); width: 52px; text-decoration-style: solid; text-decoration-color: #98c379;\">'colour'<\/span>, <span style=\"color: #98c379; background: rgba(0, 0, 0, 0); width: 46px; text-decoration-style: solid; text-decoration-color: #98c379;\">'color'<\/span>)\n<span style=\"color: #5c6370; background: rgba(0, 0, 0, 0); width: 117px; text-decoration-style: solid; text-decoration-color: #5c6370; font-style: italic;\"># 3. \u83b7\u53d6\u6240\u6709\u5173\u952e\u8bcd<\/span>\nkeyword_processor.get_all_keywords()\n<span style=\"color: #5c6370; background: rgba(0, 0, 0, 0); width: 297px; text-decoration-style: solid; text-decoration-color: #5c6370; font-style: italic;\"># output: {'colour': 'color', 'j2ee': 'Java'}<\/span><\/span><\/code><\/pre>\n<\/section>\n<p style=\"margin-top: 4px; margin-bottom: 26px; background: #ffffff; overflow-x: auto; color: #666666; font-family: 'PingFang SC', 'Microsoft Yahei', 'Helvetica Neue', Helvetica, STHeiTi, sans-serif; font-size: 15px; text-align: start; border: 0px initial initial;\"><strong>\u6279\u91cf\u6dfb\u52a0\u5173\u952e\u8bcd<\/strong><\/p>\n<p style=\"margin-top: 4px; margin-bottom: 26px; background: #ffffff; overflow-x: auto; color: #666666; font-family: 'PingFang SC', 'Microsoft Yahei', 'Helvetica Neue', Helvetica, STHeiTi, sans-serif; font-size: 15px; text-align: start; border: 0px initial initial;\">\u6279\u91cf\u6dfb\u52a0\u5173\u952e\u8bcd\u6709\u4e24\u79cd\u65b9\u6cd5\uff0c\u4e00\u79cd\u662f\u901a\u8fc7\u8bcd\u5178\uff0c\u4e00\u79cd\u662f\u901a\u8fc7\u6570\u7ec4\uff1a<\/p>\n<section>\n<pre style=\"background-image: none; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;\"><code style=\"border-radius: 4px; font-size: 0.85em; margin-right: 0.15em; margin-left: 0.15em; background: #282c34; color: #abb2bf; display: block; padding: 5.20625px; overflow-x: auto; white-space: nowrap;\"><span style=\"font-size: 12px;\"><span style=\"color: #c678dd; background: rgba(0, 0, 0, 0); width: 26px; text-decoration-style: solid; text-decoration-color: #c678dd;\">from<\/span>\u00a0flashtext <span style=\"color: #c678dd; background: rgba(0, 0, 0, 0); width: 39px; text-decoration-style: solid; text-decoration-color: #c678dd;\">import<\/span>\u00a0KeywordProcessor\n<span style=\"color: #5c6370; background: rgba(0, 0, 0, 0); width: 141px; text-decoration-style: solid; text-decoration-color: #5c6370; font-style: italic;\"># 1. \u521d\u59cb\u5316\u5173\u952e\u5b57\u5904\u7406\u5668<\/span>\nkeyword_processor = KeywordProcessor()\n<span style=\"color: #5c6370; background: rgba(0, 0, 0, 0); width: 225px; text-decoration-style: solid; text-decoration-color: #5c6370; font-style: italic;\"># 2. \uff08\u7b2c\u4e00\u79cd\uff09\u901a\u8fc7\u5b57\u5178\u6279\u91cf\u6dfb\u52a0\u5173\u952e\u8bcd<\/span>\nkeyword_dict = {\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #98c379; background: rgba(0, 0, 0, 0); width: 40px; text-decoration-style: solid; text-decoration-color: #98c379;\">\"java\"<\/span>: [<span style=\"color: #98c379; background: rgba(0, 0, 0, 0); width: 59px; text-decoration-style: solid; text-decoration-color: #98c379;\">\"java_2e\"<\/span>, <span style=\"color: #98c379; background: rgba(0, 0, 0, 0); width: 112px; text-decoration-style: solid; text-decoration-color: #98c379;\">\"java programing\"<\/span>],\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #98c379; background: rgba(0, 0, 0, 0); width: 132px; text-decoration-style: solid; text-decoration-color: #98c379;\">\"product management\"<\/span>: [<span style=\"color: #98c379; background: rgba(0, 0, 0, 0); width: 26px; text-decoration-style: solid; text-decoration-color: #98c379;\">\"PM\"<\/span>, <span style=\"color: #98c379; background: rgba(0, 0, 0, 0); width: 113px; text-decoration-style: solid; text-decoration-color: #98c379;\">\"product manager\"<\/span>]\n}\nkeyword_processor.add_keywords_from_dict(keyword_dict)\n<span style=\"color: #5c6370; background: rgba(0, 0, 0, 0); width: 225px; text-decoration-style: solid; text-decoration-color: #5c6370; font-style: italic;\"># 2. \uff08\u7b2c\u4e8c\u79cd\uff09\u901a\u8fc7\u6570\u7ec4\u6279\u91cf\u6dfb\u52a0\u5173\u952e\u8bcd<\/span>\nkeyword_processor.add_keywords_from_list([<span style=\"color: #98c379; background: rgba(0, 0, 0, 0); width: 39px; text-decoration-style: solid; text-decoration-color: #98c379;\">\"java\"<\/span>, <span style=\"color: #98c379; background: rgba(0, 0, 0, 0); width: 52px; text-decoration-style: solid; text-decoration-color: #98c379;\">\"python\"<\/span>])\n<span style=\"color: #5c6370; background: rgba(0, 0, 0, 0); width: 153px; text-decoration-style: solid; text-decoration-color: #5c6370; font-style: italic;\"># 3. \u7b2c\u4e00\u79cd\u7684\u63d0\u53d6\u6548\u679c\u5982\u4e0b<\/span>\nkeyword_processor.extract_keywords(<span style=\"color: #98c379; background: rgba(0, 0, 0, 0); width: 310px; text-decoration-style: solid; text-decoration-color: #98c379;\">'I am a product manager for a java_2e platform'<\/span>)\n<span style=\"color: #5c6370; background: rgba(0, 0, 0, 0); width: 257px; text-decoration-style: solid; text-decoration-color: #5c6370; font-style: italic;\"># output ['product management', 'java']<\/span><\/span><\/code><\/pre>\n<\/section>\n<p style=\"margin-top: 4px; margin-bottom: 26px; background: #ffffff; overflow-x: auto; color: #666666; font-family: 'PingFang SC', 'Microsoft Yahei', 'Helvetica Neue', Helvetica, STHeiTi, sans-serif; font-size: 15px; text-align: start; border: 0px initial initial;\"><strong>\u5355\u4e00\u6216\u6279\u91cf\u5220\u9664\u5173\u952e\u8bcd<\/strong><\/p>\n<p style=\"margin-top: 4px; margin-bottom: 26px; background: #ffffff; overflow-x: auto; color: #666666; font-family: 'PingFang SC', 'Microsoft Yahei', 'Helvetica Neue', Helvetica, STHeiTi, sans-serif; font-size: 15px; text-align: start; border: 0px initial initial;\">\u5220\u9664\u5173\u952e\u8bcd\u4e5f\u975e\u5e38\u7b80\u5355\uff0c\u548c\u6dfb\u52a0\u7c7b\u4f3c\uff1a<\/p>\n<section>\n<pre style=\"background-image: none; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;\"><code style=\"border-radius: 4px; font-size: 0.85em; margin-right: 0.15em; margin-left: 0.15em; background: #282c34; color: #abb2bf; display: block; padding: 5.20625px; overflow-x: auto; white-space: nowrap;\"><span style=\"font-size: 12px;\"><span style=\"color: #c678dd; background: rgba(0, 0, 0, 0); width: 26px; text-decoration-style: solid; text-decoration-color: #c678dd;\">from<\/span>\u00a0flashtext <span style=\"color: #c678dd; background: rgba(0, 0, 0, 0); width: 39px; text-decoration-style: solid; text-decoration-color: #c678dd;\">import<\/span>\u00a0KeywordProcessor\n<span style=\"color: #5c6370; background: rgba(0, 0, 0, 0); width: 141px; text-decoration-style: solid; text-decoration-color: #5c6370; font-style: italic;\"># 1. \u521d\u59cb\u5316\u5173\u952e\u5b57\u5904\u7406\u5668<\/span>\nkeyword_processor = KeywordProcessor()\n<span style=\"color: #5c6370; background: rgba(0, 0, 0, 0); width: 165px; text-decoration-style: solid; text-decoration-color: #5c6370; font-style: italic;\"># 2. \u901a\u8fc7\u5b57\u5178\u6279\u91cf\u6dfb\u52a0\u5173\u952e\u8bcd<\/span>\nkeyword_dict = {\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #98c379; background: rgba(0, 0, 0, 0); width: 40px; text-decoration-style: solid; text-decoration-color: #98c379;\">\"java\"<\/span>: [<span style=\"color: #98c379; background: rgba(0, 0, 0, 0); width: 59px; text-decoration-style: solid; text-decoration-color: #98c379;\">\"java_2e\"<\/span>, <span style=\"color: #98c379; background: rgba(0, 0, 0, 0); width: 112px; text-decoration-style: solid; text-decoration-color: #98c379;\">\"java programing\"<\/span>],\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #98c379; background: rgba(0, 0, 0, 0); width: 132px; text-decoration-style: solid; text-decoration-color: #98c379;\">\"product management\"<\/span>: [<span style=\"color: #98c379; background: rgba(0, 0, 0, 0); width: 26px; text-decoration-style: solid; text-decoration-color: #98c379;\">\"PM\"<\/span>, <span style=\"color: #98c379; background: rgba(0, 0, 0, 0); width: 113px; text-decoration-style: solid; text-decoration-color: #98c379;\">\"product manager\"<\/span>]\n}\nkeyword_processor.add_keywords_from_dict(keyword_dict)\n<span style=\"color: #5c6370; background: rgba(0, 0, 0, 0); width: 105px; text-decoration-style: solid; text-decoration-color: #5c6370; font-style: italic;\"># 3. \u63d0\u53d6\u6548\u679c\u5982\u4e0b<\/span>\nprint(keyword_processor.extract_keywords(<span style=\"color: #98c379; background: rgba(0, 0, 0, 0); width: 310px; text-decoration-style: solid; text-decoration-color: #98c379;\">'I am a product manager for a java_2e platform'<\/span>))\n<span style=\"color: #5c6370; background: rgba(0, 0, 0, 0); width: 211px; text-decoration-style: solid; text-decoration-color: #5c6370; font-style: italic;\"># ['product management', 'java']<\/span>\n<span style=\"color: #5c6370; background: rgba(0, 0, 0, 0); width: 117px; text-decoration-style: solid; text-decoration-color: #5c6370; font-style: italic;\"># 4. \u5355\u4e2a\u5220\u9664\u5173\u952e\u8bcd<\/span>\nkeyword_processor.remove_keyword(<span style=\"color: #98c379; background: rgba(0, 0, 0, 0); width: 60px; text-decoration-style: solid; text-decoration-color: #98c379;\">'java_2e'<\/span>)\n<span style=\"color: #5c6370; background: rgba(0, 0, 0, 0); width: 309px; text-decoration-style: solid; text-decoration-color: #5c6370; font-style: italic;\"># 5. \u6279\u91cf\u5220\u9664\u5173\u952e\u8bcd\uff0c\u4e5f\u662f\u53ef\u4ee5\u901a\u8fc7\u8bcd\u5178\u6216\u8005\u6570\u7ec4\u7684\u5f62\u5f0f<\/span>\nkeyword_processor.remove_keywords_from_dict({<span style=\"color: #98c379; background: rgba(0, 0, 0, 0); width: 132px; text-decoration-style: solid; text-decoration-color: #98c379;\">\"product management\"<\/span>: [<span style=\"color: #98c379; background: rgba(0, 0, 0, 0); width: 27px; text-decoration-style: solid; text-decoration-color: #98c379;\">\"PM\"<\/span>]})\nkeyword_processor.remove_keywords_from_list([<span style=\"color: #98c379; background: rgba(0, 0, 0, 0); width: 112px; text-decoration-style: solid; text-decoration-color: #98c379;\">\"java programing\"<\/span>])\n<span style=\"color: #5c6370; background: rgba(0, 0, 0, 0); width: 276px; text-decoration-style: solid; text-decoration-color: #5c6370; font-style: italic;\"># 6. \u5220\u9664\u4e86java programing\u5173\u952e\u8bcd\u540e\u7684\u6548\u679c\u5982\u4e0b<\/span>\nkeyword_processor.extract_keywords(<span style=\"color: #98c379; background: rgba(0, 0, 0, 0); width: 310px; text-decoration-style: solid; text-decoration-color: #98c379;\">'I am a product manager for a java_2e platform'<\/span>)\n<span style=\"color: #5c6370; background: rgba(0, 0, 0, 0); width: 158px; text-decoration-style: solid; text-decoration-color: #5c6370; font-style: italic;\"># ['product management']<\/span><\/span><\/code><\/pre>\n<\/section>\n<section>\n<section>\n<section style=\"font-size: 16px;\">\n<section style=\"text-align: left; margin: 10px 0%;\">\n<section style=\"display: inline-block; width: auto; vertical-align: top; min-width: 10%; height: auto;\">\n<section>\n<section style=\"display: flex; flex-flow: row nowrap;\">\n<section style=\"display: inline-block; vertical-align: bottom; width: auto; align-self: flex-end; flex: 0 0 auto; min-width: 10%; height: auto;\">\n<section style=\"text-align: right;\">\n<section style=\"display: inline-block; width: auto; vertical-align: top; min-width: 10%; height: auto; border-bottom: 4px solid #0f4c81; border-bottom-right-radius: 0px; padding-right: 10px;\">\n<section style=\"text-align: center; font-size: 24px; color: #0f4c81;\"><span style=\"font-size: 18px;\"><em><strong>3.\u9ad8\u7ea7\u4f7f\u7528<\/strong><\/em><\/span><\/p>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<section style=\"display: inline-block; vertical-align: bottom; width: auto; align-self: flex-end; flex: 100 100 0%; height: auto; border-width: 2px 3px 4px 4px; border-radius: 0px; border-style: solid solid solid none; border-color: #0f4c81; padding-top: 5px; padding-right: 10px; padding-bottom: 5px;\">\n<section style=\"text-align: justify; color: #0f4c81;\">\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<p style=\"margin-top: 4px; margin-bottom: 26px; background: #ffffff; overflow-x: auto; color: #666666; font-family: 'PingFang SC', 'Microsoft Yahei', 'Helvetica Neue', Helvetica, STHeiTi, sans-serif; font-size: 15px; text-align: start; border: 0px initial initial;\"><strong>\u652f\u6301\u989d\u5916\u4fe1\u606f<\/strong><\/p>\n<p style=\"margin-top: 4px; margin-bottom: 26px; background: #ffffff; overflow-x: auto; color: #666666; font-family: 'PingFang SC', 'Microsoft Yahei', 'Helvetica Neue', Helvetica, STHeiTi, sans-serif; font-size: 15px; text-align: start; border: 0px initial initial;\">\u524d\u9762\u63d0\u5230\u5728\u6dfb\u52a0\u5173\u952e\u8bcd\u7684\u65f6\u5019\u7b2c\u4e8c\u4e2a\u53c2\u6570\u4e3a\u5176\u522b\u540d\uff0c\u5176\u5b9e\u4f60\u4e0d\u4ec5\u53ef\u4ee5\u6307\u793a\u522b\u540d\uff0c\u8fd8\u53ef\u4ee5\u5c06\u989d\u5916\u4fe1\u606f\u653e\u5230\u7b2c\u4e8c\u4e2a\u53c2\u6570\u4e2d\uff1a<\/p>\n<section>\n<pre style=\"background-image: none; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;\"><code style=\"border-radius: 4px; font-size: 0.85em; margin-right: 0.15em; margin-left: 0.15em; background: #282c34; color: #abb2bf; display: block; padding: 5.20625px; overflow-x: auto; white-space: nowrap;\"><span style=\"font-size: 12px;\"><span style=\"color: #c678dd; background: rgba(0, 0, 0, 0); width: 26px; text-decoration-style: solid; text-decoration-color: #c678dd;\">from<\/span>\u00a0flashtext <span style=\"color: #c678dd; background: rgba(0, 0, 0, 0); width: 39px; text-decoration-style: solid; text-decoration-color: #c678dd;\">import<\/span>\u00a0KeywordProcessor\n<span style=\"color: #5c6370; background: rgba(0, 0, 0, 0); width: 141px; text-decoration-style: solid; text-decoration-color: #5c6370; font-style: italic;\"># 1. \u521d\u59cb\u5316\u5173\u952e\u5b57\u5904\u7406\u5668<\/span>\nkp = KeywordProcessor()\n<span style=\"color: #5c6370; background: rgba(0, 0, 0, 0); width: 177px; text-decoration-style: solid; text-decoration-color: #5c6370; font-style: italic;\"># 2. \u6dfb\u52a0\u5173\u952e\u8bcd\u5e76\u9644\u5e26\u989d\u5916\u4fe1\u606f<\/span>\nkp.add_keyword(<span style=\"color: #98c379; background: rgba(0, 0, 0, 0); width: 72px; text-decoration-style: solid; text-decoration-color: #98c379;\">'Taj Mahal'<\/span>, (<span style=\"color: #98c379; background: rgba(0, 0, 0, 0); width: 66px; text-decoration-style: solid; text-decoration-color: #98c379;\">'Monument'<\/span>, <span style=\"color: #98c379; background: rgba(0, 0, 0, 0); width: 73px; text-decoration-style: solid; text-decoration-color: #98c379;\">'Taj Mahal'<\/span>))\nkp.add_keyword(<span style=\"color: #98c379; background: rgba(0, 0, 0, 0); width: 46px; text-decoration-style: solid; text-decoration-color: #98c379;\">'Delhi'<\/span>, (<span style=\"color: #98c379; background: rgba(0, 0, 0, 0); width: 66px; text-decoration-style: solid; text-decoration-color: #98c379;\">'Location'<\/span>, <span style=\"color: #98c379; background: rgba(0, 0, 0, 0); width: 46px; text-decoration-style: solid; text-decoration-color: #98c379;\">'Delhi'<\/span>))\n<span style=\"color: #5c6370; background: rgba(0, 0, 0, 0); width: 81px; text-decoration-style: solid; text-decoration-color: #5c6370; font-style: italic;\"># 3. \u6548\u679c\u5982\u4e0b<\/span>\nkp.extract_keywords(<span style=\"color: #98c379; background: rgba(0, 0, 0, 0); width: 158px; text-decoration-style: solid; text-decoration-color: #98c379;\">'Taj Mahal is in Delhi.'<\/span>)\n<span style=\"color: #5c6370; background: rgba(0, 0, 0, 0); width: 343px; text-decoration-style: solid; text-decoration-color: #5c6370; font-style: italic;\"># [('Monument', 'Taj Mahal'), ('Location', 'Delhi')]<\/span><\/span><\/code><\/pre>\n<\/section>\n<p style=\"margin-top: 4px; margin-bottom: 26px; background: #ffffff; overflow-x: auto; color: #666666; font-family: 'PingFang SC', 'Microsoft Yahei', 'Helvetica Neue', Helvetica, STHeiTi, sans-serif; font-size: 15px; text-align: start; border: 0px initial initial;\">\u8fd9\u6837\uff0c\u5728\u63d0\u53d6\u5173\u952e\u8bcd\u7684\u65f6\u5019\uff0c\u4f60\u8fd8\u80fd\u62ff\u5230\u5176\u4ed6\u4e00\u4e9b\u4f60\u60f3\u8981\u5728\u5f97\u5230\u6b64\u5173\u952e\u8bcd\u65f6\u8f93\u51fa\u7684\u4fe1\u606f\u3002<\/p>\n<p style=\"margin-top: 4px; margin-bottom: 26px; background: #ffffff; overflow-x: auto; color: #666666; font-family: 'PingFang SC', 'Microsoft Yahei', 'Helvetica Neue', Helvetica, STHeiTi, sans-serif; font-size: 15px; text-align: start; border: 0px initial initial;\"><strong>\u652f\u6301\u7279\u6b8a\u5355\u8bcd\u8fb9\u754c<\/strong><\/p>\n<p style=\"margin-top: 4px; margin-bottom: 26px; background: #ffffff; overflow-x: auto; color: #666666; font-family: 'PingFang SC', 'Microsoft Yahei', 'Helvetica Neue', Helvetica, STHeiTi, sans-serif; font-size: 15px; text-align: start; border: 0px initial initial;\">Flashtext \u68c0\u6d4b\u7684\u5355\u8bcd\u8fb9\u754c\u4e00\u822c\u5c40\u9650\u4e8e w [A-Za-z0-9_] \u5916\u7684\u4efb\u610f\u5b57\u7b26\uff0c\u4f46\u662f\u5982\u679c\u4f60\u60f3\u6dfb\u52a0\u67d0\u4e9b\u7279\u6b8a\u5b57\u7b26\u4f5c\u4e3a\u5355\u8bcd\u7684\u4e00\u90e8\u5206\u4e5f\u662f\u53ef\u4ee5\u5b9e\u73b0\u7684\uff1a<\/p>\n<section>\n<pre style=\"background-image: none; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;\"><code style=\"border-radius: 4px; font-size: 0.85em; margin-right: 0.15em; margin-left: 0.15em; background: #282c34; color: #abb2bf; display: block; padding: 5.20625px; overflow-x: auto; white-space: nowrap;\"><span style=\"font-size: 12px;\"><span style=\"color: #c678dd; background: rgba(0, 0, 0, 0); width: 26px; text-decoration-style: solid; text-decoration-color: #c678dd;\">from<\/span>\u00a0flashtext <span style=\"color: #c678dd; background: rgba(0, 0, 0, 0); width: 39px; text-decoration-style: solid; text-decoration-color: #c678dd;\">import<\/span>\u00a0KeywordProcessor\n<span style=\"color: #5c6370; background: rgba(0, 0, 0, 0); width: 141px; text-decoration-style: solid; text-decoration-color: #5c6370; font-style: italic;\"># 1. \u521d\u59cb\u5316\u5173\u952e\u5b57\u5904\u7406\u5668<\/span>\nkeyword_processor = KeywordProcessor()\n<span style=\"color: #5c6370; background: rgba(0, 0, 0, 0); width: 93px; text-decoration-style: solid; text-decoration-color: #5c6370; font-style: italic;\"># 2. \u6dfb\u52a0\u5173\u952e\u8bcd<\/span>\nkeyword_processor.add_keyword(<span style=\"color: #98c379; background: rgba(0, 0, 0, 0); width: 72px; text-decoration-style: solid; text-decoration-color: #98c379;\">'Big Apple'<\/span>)\n<span style=\"color: #5c6370; background: rgba(0, 0, 0, 0); width: 81px; text-decoration-style: solid; text-decoration-color: #5c6370; font-style: italic;\"># 3. \u6b63\u5e38\u6548\u679c<\/span>\nprint(keyword_processor.extract_keywords(<span style=\"color: #98c379; background: rgba(0, 0, 0, 0); width: 185px; text-decoration-style: solid; text-decoration-color: #98c379;\">'I love Big Apple\/Bay Area.'<\/span>))\n<span style=\"color: #5c6370; background: rgba(0, 0, 0, 0); width: 99px; text-decoration-style: solid; text-decoration-color: #5c6370; font-style: italic;\"># ['Big Apple']<\/span>\n<span style=\"color: #5c6370; background: rgba(0, 0, 0, 0); width: 162px; text-decoration-style: solid; text-decoration-color: #5c6370; font-style: italic;\"># 4. \u5c06 '\/' \u4f5c\u4e3a\u5355\u8bcd\u4e00\u90e8\u5206<\/span>\nkeyword_processor.add_non_word_boundary(<span style=\"color: #98c379; background: rgba(0, 0, 0, 0); width: 19px; text-decoration-style: solid; text-decoration-color: #98c379;\">'\/'<\/span>)\n<span style=\"color: #5c6370; background: rgba(0, 0, 0, 0); width: 105px; text-decoration-style: solid; text-decoration-color: #5c6370; font-style: italic;\"># 5. \u4f18\u5316\u540e\u7684\u6548\u679c<\/span>\nprint(keyword_processor.extract_keywords(<span style=\"color: #98c379; background: rgba(0, 0, 0, 0); width: 185px; text-decoration-style: solid; text-decoration-color: #98c379;\">'I love Big Apple\/Bay Area.'<\/span>))\n<span style=\"color: #5c6370; background: rgba(0, 0, 0, 0); width: 26px; text-decoration-style: solid; text-decoration-color: #5c6370; font-style: italic;\"># []<\/span><\/span><\/code><\/pre>\n<\/section>\n<section>\n<section>\n<section style=\"font-size: 16px;\">\n<section style=\"text-align: left; margin: 10px 0%;\">\n<section style=\"display: inline-block; width: auto; vertical-align: top; min-width: 10%; height: auto;\">\n<section>\n<section style=\"display: flex; flex-flow: row nowrap;\">\n<section style=\"display: inline-block; vertical-align: bottom; width: auto; align-self: flex-end; flex: 0 0 auto; min-width: 10%; height: auto;\">\n<section style=\"text-align: right;\">\n<section style=\"display: inline-block; width: auto; vertical-align: top; min-width: 10%; height: auto; border-bottom: 4px solid #0f4c81; border-bottom-right-radius: 0px; padding-right: 10px;\">\n<section style=\"text-align: center; font-size: 24px; color: #0f4c81;\"><span style=\"font-size: 18px;\"><em><strong>4.\u7ed3\u5c3e<\/strong><\/em><\/span><\/p>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<section style=\"display: inline-block; vertical-align: bottom; width: auto; align-self: flex-end; flex: 100 100 0%; height: auto; border-width: 2px 3px 4px 4px; border-radius: 0px; border-style: solid solid solid none; border-color: #0f4c81; padding-top: 5px; padding-right: 10px; padding-bottom: 5px;\">\n<section style=\"text-align: justify; color: #0f4c81;\">\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<p style=\"margin-top: 4px; margin-bottom: 26px; background: #ffffff; overflow-x: auto; color: #666666; font-family: 'PingFang SC', 'Microsoft Yahei', 'Helvetica Neue', Helvetica, STHeiTi, sans-serif; font-size: 15px; text-align: start; border: 0px initial initial;\">\u4e2a\u4eba\u8ba4\u4e3a\u8fd9\u4e2a\u6a21\u5757\u5df2\u7ecf\u6ee1\u8db3\u6211\u4eec\u7684\u57fa\u672c\u4f7f\u7528\u4e86\uff0c\u5982\u679c\u4f60\u6709\u4e00\u4e9b\u8be5\u6a21\u5757\u63d0\u4f9b\u7684\u529f\u80fd\u4e4b\u5916\u7684\u4f7f\u7528\u9700\u6c42\uff0c\u53ef\u4ee5\u7ed9 flashtext \u8d21\u732e\u4ee3\u7801\uff1a<br style=\"display: block;\" \/><span style=\"font-size: 12px; color: #0f4c81;\">https:\/\/github.com\/vi3k6i5\/flashtext<\/span><\/p>\n<p style=\"margin-top: 4px; margin-bottom: 26px; background: #ffffff; overflow-x: auto; color: #666666; font-family: 'PingFang SC', 'Microsoft Yahei', 'Helvetica Neue', Helvetica, STHeiTi, sans-serif; font-size: 15px; text-align: start; border: 0px initial initial;\">\u9644 FlashText \u4e0e\u6b63\u5219\u76f8\u6bd4\u00a0<strong>\u67e5\u8be2\u5173\u952e\u8bcd<\/strong>\u00a0\u6240\u82b1\u8d39\u7684\u65f6\u95f4\u4e4b\u6bd4\uff1a<\/p>\n<p style=\"text-align: center;\"><img decoding=\"async\" class=\"rich_pages wxw-img\" title=\"\u6bd4\u6b63\u5219\u5feb M \u500d\u4ee5\u4e0a\uff01Python \u66ff\u6362\u5b57\u7b26\u4e32\u7684\u65b0\u59ff\u52bf\" src=\"http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2022\/03\/10-1648647833.png\" alt=\"\u6bd4\u6b63\u5219\u5feb M \u500d\u4ee5\u4e0a\uff01Python \u66ff\u6362\u5b57\u7b26\u4e32\u7684\u65b0\u59ff\u52bf\" \/><\/p>\n<p style=\"margin-top: 4px; margin-bottom: 26px; background: #ffffff; overflow-x: auto; color: #666666; font-family: 'PingFang SC', 'Microsoft Yahei', 'Helvetica Neue', Helvetica, STHeiTi, sans-serif; font-size: 15px; text-align: start; border: 0px initial initial;\">\u9644 FlashText \u4e0e\u6b63\u5219\u76f8\u6bd4\u00a0<strong>\u66ff\u6362\u5173\u952e\u8bcd<\/strong>\u00a0\u6240\u82b1\u8d39\u7684\u65f6\u95f4\u4e4b\u6bd4\uff1a<\/p>\n<p><img decoding=\"async\" class=\"rich_pages wxw-img\" title=\"\u6bd4\u6b63\u5219\u5feb M \u500d\u4ee5\u4e0a\uff01Python \u66ff\u6362\u5b57\u7b26\u4e32\u7684\u65b0\u59ff\u52bf\" src=\"http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2022\/03\/5-1648647834.png\" alt=\"\u6bd4\u6b63\u5219\u5feb M \u500d\u4ee5\u4e0a\uff01Python \u66ff\u6362\u5b57\u7b26\u4e32\u7684\u65b0\u59ff\u52bf\" \/><\/p>\n<p style=\"white-space: normal; text-align: center;\"><span style=\"font-size: 15px; color: #888888;\">&#8211; EOF &#8211;<\/span><\/p>\n<section style=\"margin-top: 1em; margin-bottom: 1em; white-space: normal; text-align: start; max-width: 100%; caret-color: #000000; color: #000000; box-sizing: border-box !important; overflow-wrap: break-word !important; border: 0px initial initial;\"><\/section>\n<p>\u8f6c\u81ea\uff1ahttps:\/\/mp.weixin.qq.com\/s\/dawYdtbetE5IQ-Wq3cqakA<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>FlashText \u7b97\u6cd5\u662f\u7531 Vikash Singh \u4e8e2017\u5e74\u53d1\u8868\u7684\u5927\u89c4\u6a21\u5173\u952e\u8bcd\u66ff\u6362\u7b97\u6cd5\uff0c\u8fd9\u4e2a\u7b97\u6cd5\u7684\u65f6\u95f4 &hellip; <a href=\"http:\/\/www.zhushiyao.com\/?p=99769\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201c\u6bd4\u6b63\u5219\u5feb M \u500d\u4ee5\u4e0a\uff01Python \u66ff\u6362\u5b57\u7b26\u4e32\u7684\u65b0\u59ff\u52bf\u201d<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[8],"_links":{"self":[{"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/posts\/99769"}],"collection":[{"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=99769"}],"version-history":[{"count":2,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/posts\/99769\/revisions"}],"predecessor-version":[{"id":99775,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/posts\/99769\/revisions\/99775"}],"wp:attachment":[{"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=99769"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=99769"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=99769"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}