{"id":2986,"date":"2021-05-05T21:10:22","date_gmt":"2021-05-05T13:10:22","guid":{"rendered":"https:\/\/han.pm\/?p=2986"},"modified":"2021-05-05T21:10:22","modified_gmt":"2021-05-05T13:10:22","slug":"chatterbot-%e8%81%8a%e5%a4%a9%e6%9c%ba%e5%99%a8%e4%ba%ba%e4%b8%8a%e6%89%8b%e5%ae%9e%e6%93%8d","status":"publish","type":"post","link":"https:\/\/jianghan.tech\/?p=2986","title":{"rendered":"Chatterbot \u804a\u5929\u673a\u5668\u4eba\u4e0a\u624b\u5b9e\u64cd"},"content":{"rendered":"<p>\u9700\u6c42\u573a\u666f\u662f\u5f00\u53d1\u4e00\u4e2a\u4e13\u4e1a\u9886\u57df\u7684\u667a\u80fd\u5ba2\u670d\u7cfb\u7edf\uff0c<br \/>\n\u8fd9\u4e2a\u4e1c\u897f\u672c\u8d28\u662f\u4e00\u4e2a\u804a\u5929\u673a\u5668\u4eba<br \/>\n\u521d\u6b65\u8c03\u7814\u4e86\u4e00\u4e0b\uff0c\u89c9\u5f97 Chatterbot \u4e0d\u9519<\/p>\n<p>\u7136\u800c\u8dd1\u8d77\u6765\u7684\u8fc7\u7a0b\u5374\u5f88\u4e0d\u987a\u5229\uff0c\u5404\u79cd\u5e93\u627e\u4e0d\u5230\uff0c \u4e3b\u8981\u7684\u95ee\u9898\u6bd4\u5982<code>No module named \u2018en\u2019 || Can\u2018t find model \u2018en\u2019<\/code><\/p>\n<p>\u624b\u5de5\u4e0b\u8f7d\u8fd8\u662f\u627e\u4e0d\u5230\u4e8e\u662f\u81ea\u5df1\u57fa\u4e8e\u7f51\u4e0a\u7684\u4eba\u7684\u955c\u50cf\u5236\u4f5c\u4e86\u4e00\u4e2a\u53ef\u4ee5\u8fd0\u884c\u7684 docker \u955c\u50cf<\/p>\n<pre><code>FROM tiangolo\/uwsgi-nginx-flask:flask-python3.5\nLABEL MAINTAINER Han Jiang&lt;hanjiang.it@gmail.com&gt;\n\nCOPY requirements.txt .\nRUN pip install -r requirements.txt\nRUN pip install spacy\nRUN python -m spacy download en<\/code><\/pre>\n<p>\u57fa\u4e8e Docker \u7684\u597d\u5904\u514d\u53bb\u4e86\u7edd\u5927\u591a\u6570\u73af\u5883\u56e0\u7d20\u7684\u5f71\u54cd\uff0cspacy \u548c\u76f8\u5173\u7684\u8bed\u8a00\u5305\u662f\u7279\u610f\u5355\u72ec\u6dfb\u52a0\u7684\uff0c\u4e0d\u7136\u4f1a\u51fa\u9519<\/p>\n<pre><code class=\"language-yaml\">version: &#039;2&#039;\n\nservices:\n  chatterbot:\n    image: chatter:latest\n    working_dir: &quot;\/app&quot;\n    volumes:\n    - &quot;.:\/app&quot;      \n    command: python3 -u main.py\n    ports:\n      - &quot;8380:80&quot;\n<\/code><\/pre>\n<p>docker-compose up \u4e4b\u540e\uff0c\u8bbf\u95ee <code>localhost:8380\/chat?msg=hello<\/code> \u53ef\u4ee5\u770b\u5230\u673a\u5668\u56de\u590d\u4fe1\u606f\uff0c\u5b9e\u9645\u4f53\u9a8c\u52a0\u6df1\u5bf9\u9879\u76ee\u7684\u7406\u89e3.<\/p>\n<p>Full code:<\/p>\n<p><a href=\"https:\/\/github.com\/jianghan200\/ChatterBot-Flask\">https:\/\/github.com\/jianghan200\/ChatterBot-Flask<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u9700\u6c42\u573a\u666f\u662f\u5f00\u53d1\u4e00\u4e2a\u4e13\u4e1a\u9886\u57df\u7684\u667a\u80fd\u5ba2\u670d\u7cfb\u7edf\uff0c \u8fd9\u4e2a\u4e1c\u897f\u672c\u8d28\u662f\u4e00\u4e2a\u804a\u5929\u673a\u5668\u4eba \u521d\u6b65\u8c03\u7814\u4e86\u4e00\u4e0b\uff0c\u89c9\u5f97 Chatter [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/jianghan.tech\/index.php?rest_route=\/wp\/v2\/posts\/2986"}],"collection":[{"href":"https:\/\/jianghan.tech\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jianghan.tech\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jianghan.tech\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jianghan.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2986"}],"version-history":[{"count":0,"href":"https:\/\/jianghan.tech\/index.php?rest_route=\/wp\/v2\/posts\/2986\/revisions"}],"wp:attachment":[{"href":"https:\/\/jianghan.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2986"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jianghan.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2986"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jianghan.tech\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2986"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}