{"id":14959412,"url":"https://github.com/decalogue/chat","last_synced_at":"2025-04-12T19:48:48.569Z","repository":{"id":20103388,"uuid":"88808149","full_name":"Decalogue/chat","owner":"Decalogue","description":"基于自然语言理解与机器学习的聊天机器人，支持多用户并发及自定义多轮对话","archived":false,"fork":false,"pushed_at":"2024-07-10T09:13:12.000Z","size":32515,"stargazers_count":694,"open_issues_count":6,"forks_count":217,"subscribers_count":42,"default_branch":"master","last_synced_at":"2025-04-12T19:48:29.780Z","etag":null,"topics":["algorithm","chat","chatbot","context","database","graph","kb","machine-learning","natural-language-processing","natural-language-understanding","neo4j","nlp","nlu","python","python3","qa","question-answering","sentence-similarity"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Decalogue.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-04-20T01:42:01.000Z","updated_at":"2025-04-10T12:15:23.000Z","dependencies_parsed_at":"2024-09-22T09:02:28.754Z","dependency_job_id":"935ee773-3ce3-409f-a8c3-750d2c96016b","html_url":"https://github.com/Decalogue/chat","commit_stats":{"total_commits":142,"total_committers":2,"mean_commits":71.0,"dds":"0.27464788732394363","last_synced_commit":"433e7d7d668a0227ccb4fee11a870ecca509f1d3"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Decalogue%2Fchat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Decalogue%2Fchat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Decalogue%2Fchat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Decalogue%2Fchat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Decalogue","download_url":"https://codeload.github.com/Decalogue/chat/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248625501,"owners_count":21135513,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithm","chat","chatbot","context","database","graph","kb","machine-learning","natural-language-processing","natural-language-understanding","neo4j","nlp","nlu","python","python3","qa","question-answering","sentence-similarity"],"created_at":"2024-09-24T13:19:39.162Z","updated_at":"2025-04-12T19:48:48.542Z","avatar_url":"https://github.com/Decalogue.png","language":"Python","readme":"# Chat\n\n`Chatbot based on natural language understanding and machine learning.`\n\n`基于自然语言理解与机器学习的聊天机器人`\n\n[![Documentation Status](https://readthedocs.org/projects/chat-cn/badge/?version=latest)](http://chat-cn.readthedocs.io/zh_CN/latest/?badge=latest)\n[![PyPI Version](https://img.shields.io/pypi/v/chat.svg)](https://pypi.python.org/pypi/chat)\n\n\u003cdiv align=center\u003e\n\n![chat](https://github.com/Decalogue/chat/blob/master/docs/img/logo.png \"chat\")\n\n\u003c/div\u003e\n\n## 这就是 Chat\n\n* Chat 是一个基于自然语言理解与机器学习的语义理解库。\n* Chat 提供丰富的语义分析工具与语义知识图的构建工具，非常适合从0开始迅速搭建自己的聊天机器人，也能够减少工程师在实际开发当中的重复工作。\n* Chat 非常易于修改和扩展，可以方便地个性化定制。\n* Chat 支持多用户并发及自定义的多轮对话场景。\n\n## 如果您有如下需求，欢迎选择 Chat：\n  \n  * 想从0开始迅速搭建自己的聊天机器人\n  * 想了解自然语言处理与机器学习算法在问答中的应用\n  * 想智能化生活工作，提升效率\n  * 对知识图谱以及 KBQA 感兴趣，想从0开始构建自己的知识图谱\n\n\u003e Chat适用的Python版本是：**Python 3.3-3.6**\n\n## Installation 安装\n\n    pip install --upgrade chat\n    \n## Tutorial 快速开始\n\n### Step 1 在终端中启动数据库\n\n\u003e (推荐)方式1：直接使用 chat/tests/nlu.db 这个已经初始化的数据库\n\u003e\u003e 使用方法：对于安装版的 neo4j 手选 nlu.db 所在路径进行连接；对于免安装版本的将 nlu.db 放到 neo4j/data/databases/ 目录下并修改 neo4j/conf/neo4j.conf 文件中\n\n    # The name of the database to mount\n    dbms.active_database=nlu.db\n\n\u003e\u003e 已经包含了3个用户及其知识库配置，具体的用户信息可直接查看数据库 User 或者 chat/tests/test_user.txt\n\n\u003e\u003e 说明：chat/tests/ 目录下的示例知识库：\n\n    chat.xls 基础问答（命令+闲聊）\n    chat_bank.xls 银行业务（里面有一个详细的自定义多轮对话示例以及两个单节点场景示例）\n    chat_hospital.xls 医院事务（业务问答）\n\n\u003e 方式2：需自定义数据库，将其密码设为'train'\n\u003e\u003e 若要修改密码：可在 chat/conf/self.conf 中修改 [neo4j] 选项 password)\n\n    neo4j start\n\n### Step 2 初始化语义知识库\n\n\u003e 2.1 启动语义服务器并保持\n（详见 chat/tests/test_server.py，可命令行运行 python test_server.py）\n\u003e\u003e 启动前请将 chat/conf/self.conf 中 [path] 下的 log（问答日志） 和 do_not_know（回答不了的问题日志） 修改为自己的路径\n\n    from chat import server\n  \n    server.start()\n    \n\u003e 2.2 导入测试知识库（若 Step 1 中使用 chat/tests/nlu.db 则直接进入 Step 3）\n（详见 chat/tests/test_graph.py，可命令行运行 python test_graph.py）\n\n    from chat.graph import Database\n    \n    # 初始化实例的时候若指定 userid 参数则会被导入 userid 对应用户，若不指定则导入通用用户\n    kb = Database(password='train')\n    kb.reset(filename='chat.xls')\n    \n### Step 3 开始聊天\n\n\u003e （推荐）方式1：启动语义客户端（详见 chat/tests/test_client.py，可命令行运行 python test_client.py）\n\u003e\u003e 可同时独立运行多个客户端，各个客户端的场景对话不会相互影响。\n\n\u003e\u003e 推荐使用已经提供的 test_client_bank.py 和 test_client_hospital.py 测试\n\n    from chat import client\n    \n    # userid 和 key 可在已有的3个测试用户中选或者自己添加\n    client.start(userid=\"您的 userid\", key=\"您的 key\")\n\n\u003e 方式2：使用 chat.qa 子模块\n\n    from chat.qa import Robot\n    from chat.config import getConfig\n  \n    robot = Robot(password=getConfig(\"neo4j\", \"password\"))\n    result = robot.search(question=\"您的自定义问题\", userid=\"您的 userid\", key=\"您的 key\")\n    answer = result['content']\n    print(answer)\n\n\n## Chat 的设计原则\n\n* 用户友好：用户的使用体验始终是我们考虑的首要和中心内容。Chat 遵循减少认知困难的最佳实践：Chat 提供一致而简洁的 API， 能够极大减少一般应用下用户的工作量，同时，Chat 提供清晰和具有实践意义的 Bug 反馈。\n* 模块性：完全独立可配置的模块可以用最少的代价自由组合在一起，您可以使用它们来构建自己的模块。\n* 易扩展性：添加新模块超级容易，只需要仿照现有的模块编写新的类或函数即可。创建新模块的便利性使得 Chat 更适合于快速开发。\n* 知识图谱：基于图数据库的知识图表达提供了更快的搜索速度与智能。\n\n\u003e 您可以在 [Read the docs](http://chat-cn.readthedocs.io/zh_CN/latest/) 中阅读官方中文文档。\n\n\u003e 如果您阅读在线中文文档时有什么问题，您可以在 Github 上下载这个项目，然后去 ***/docs/build/html/index.html*** 阅读离线中文文档。\n\n## 非常感谢各位 Github 小伙伴的贡献\n\n### 代码贡献\n\n### 建议贡献\n\n[TimLoveFreedom](https://github.com/TimLoveFreedom) 具体内容：分享支持\n\n[zheyang0715](https://github.com/zheyang0715) 具体内容：chat.semantic.synonym_cut 句尾标点符号过滤\n\n[zhengxijiang](https://github.com/zhengxijiang) 具体内容：chat.server 场景并发中 robot 实例化\n\n### 文档贡献\n\n[Mirza Zulfan](https://github.com/mirzazulfan) 具体内容：设计 chat LOGO\n\n`Copyright © 2017 Decalogue. All Rights Reserved.`\n\n关于作者：[Decalogue](https://github.com/Decalogue)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdecalogue%2Fchat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdecalogue%2Fchat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdecalogue%2Fchat/lists"}