# Chat
`Chatbot based on natural language understanding and machine learning.`
`基于自然语言理解与机器学习的聊天机器人`
[![Documentation Status](https://readthedocs.org/projects/chat-cn/badge/?version=latest)](http://chat-cn.readthedocs.io/zh_CN/latest/?badge=latest)
[![PyPI Version](https://img.shields.io/pypi/v/chat.svg)](https://pypi.python.org/pypi/chat)
<div align=center>
![chat](https://github.com/Decalogue/chat/blob/master/docs/img/logo.png "chat")
</div>
## 这就是 Chat
* Chat 是一个基于自然语言理解与机器学习的语义理解库。
* Chat 提供丰富的语义分析工具与语义知识图的构建工具,非常适合从0开始迅速搭建自己的聊天机器人,也能够减少工程师在实际开发当中的重复工作。
* Chat 非常易于修改和扩展,可以方便地个性化定制。
* Chat 支持多用户并发及自定义的多轮对话场景。
## 如果您有如下需求,欢迎选择 Chat:
* 想从0开始迅速搭建自己的聊天机器人
* 想了解自然语言处理与机器学习算法在问答中的应用
* 想智能化生活工作,提升效率
* 对知识图谱以及 KBQA 感兴趣,想从0开始构建自己的知识图谱
> Chat适用的Python版本是:**Python 3.3-3.6**
## Installation 安装
pip install --upgrade chat
## Tutorial 快速开始
### Step 1 在终端中启动数据库
> (推荐)方式1:直接使用 chat/tests/nlu.db 这个已经初始化的数据库
>> 使用方法:对于安装版的 neo4j 手选 nlu.db 所在路径进行连接;对于免安装版本的将 nlu.db 放到 neo4j/data/databases/ 目录下并修改 neo4j/conf/neo4j.conf 文件中
# The name of the database to mount
dbms.active_database=nlu.db
>> 已经包含了3个用户及其知识库配置,具体的用户信息可直接查看数据库 User 或者 chat/tests/test_user.txt
>> 说明:chat/tests/ 目录下的示例知识库:
chat.xls 基础问答(命令+闲聊)
chat_bank.xls 银行业务(里面有一个详细的自定义多轮对话示例以及两个单节点场景示例)
chat_hospital.xls 医院事务(业务问答)
> 方式2:需自定义数据库,将其密码设为'train'
>> 若要修改密码:可在 chat/conf/self.conf 中修改 [neo4j] 选项 password)
neo4j start
### Step 2 初始化语义知识库
> 2.1 启动语义服务器并保持
(详见 chat/tests/test_server.py,可命令行运行 python test_server.py)
>> 启动前请将 chat/conf/self.conf 中 [path] 下的 log(问答日志) 和 do_not_know(回答不了的问题日志) 修改为自己的路径
from chat import server
server.start()
> 2.2 导入测试知识库(若 Step 1 中使用 chat/tests/nlu.db 则直接进入 Step 3)
(详见 chat/tests/test_graph.py,可命令行运行 python test_graph.py)
from chat.graph import Database
# 初始化实例的时候若指定 userid 参数则会被导入 userid 对应用户,若不指定则导入通用用户
kb = Database(password='train')
kb.reset(filename='chat.xls')
### Step 3 开始聊天
> (推荐)方式1:启动语义客户端(详见 chat/tests/test_client.py,可命令行运行 python test_client.py)
>> 可同时独立运行多个客户端,各个客户端的场景对话不会相互影响。
>> 推荐使用已经提供的 test_client_bank.py 和 test_client_hospital.py 测试
from chat import client
# userid 和 key 可在已有的3个测试用户中选或者自己添加
client.start(userid="您的 userid", key="您的 key")
> 方式2:使用 chat.qa 子模块
from chat.qa import Robot
from chat.config import getConfig
robot = Robot(password=getConfig("neo4j", "password"))
result = robot.search(question="您的自定义问题", userid="您的 userid", key="您的 key")
answer = result['content']
print(answer)
## Chat 的设计原则
* 用户友好:用户的使用体验始终是我们考虑的首要和中心内容。Chat 遵循减少认知困难的最佳实践:Chat 提供一致而简洁的 API, 能够极大减少一般应用下用户的工作量,同时,Chat 提供清晰和具有实践意义的 Bug 反馈。
* 模块性:完全独立可配置的模块可以用最少的代价自由组合在一起,您可以使用它们来构建自己的模块。
* 易扩展性:添加新模块超级容易,只需要仿照现有的模块编写新的类或函数即可。创建新模块的便利性使得 Chat 更适合于快速开发。
* 知识图谱:基于图数据库的知识图表达提供了更快的搜索速度与智能。
> 您可以在 [Read the docs](http://chat-cn.readthedocs.io/zh_CN/latest/) 中阅读官方中文文档。
> 如果您阅读在线中文文档时有什么问题,您可以在 Github 上下载这个项目,然后去 ***/docs/build/html/index.html*** 阅读离线中文文档。
## 非常感谢各位 Github 小伙伴的贡献
### 代码贡献
### 建议贡献
[TimLoveFreedom](https://github.com/TimLoveFreedom) 具体内容:分享支持
[zheyang0715](https://github.com/zheyang0715) 具体内容:chat.semantic.synonym_cut 句尾标点符号过滤
[zhengxijiang](https://github.com/zhengxijiang) 具体内容:chat.server 场景并发中 robot 实例化
### 文档贡献
[Mirza Zulfan](https://github.com/mirzazulfan) 具体内容:设计 chat LOGO
## 如果想了解更多,也欢迎扫二维码加我微信分享交流。
![Rain](https://github.com/Decalogue/chat/blob/master/docs/QRcode.jpg "一起学习")
`Copyright © 2017 Decalogue. All Rights Reserved.`
关于作者:[Decalogue](https://github.com/Decalogue)
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
基于自然语言理解与机器学习的聊天机器人,支持多用户并发及自定义多轮对话 基于自然语言理解与机器学习的聊天机器人,当支持多用户并发及自定义多轮对话时,通常涉及以下几个关键技术和设计考虑: 自然语言理解(NLP):这是聊天机器人的核心部分,它使机器人能够解析和理解用户的输入。NLP技术包括词法分析、句法分析、语义分析等,以将用户的自然语言文本转化为机器可以理解和处理的结构化信息。 机器学习算法:聊天机器人使用机器学习算法来训练模型,以便更好地理解和响应用户的输入。常见的机器学习算法包括深度学习算法,如循环神经网络(RNN)、长短期记忆网络(LSTM)和Transformer等。这些算法可以帮助机器人学习并优化对话流程,提高对话的准确性和流畅性。 多用户并发支持:为了满足多用户同时与聊天机器人交互的需求,系统需要支持多用户并发。这通常通过多线程、异步处理等技术实现,以确保每个用户都能得到及时的响应。 自定义多轮对话:聊天机器人需要支持自定义多轮对话,以便根据用户的需求和上下文信息提供个性化的回复。这通常涉及到对话管理模块的设计,该模块可以跟踪和管理多个对话的上下文信息,并根据用户的输入和上
资源推荐
资源详情
资源评论
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![caj](https://img-home.csdnimg.cn/images/20210720083646.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
收起资源包目录
![package](https://csdnimg.cn/release/downloadcmsfe/public/img/package.f3fc750b.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/HTML.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/HTML.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/HTML.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/HTML.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/HTML.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/HTML.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/HTML.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/HTML.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/HTML.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/HTML.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/HTML.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/HTML.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/HTML.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/HTML.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/HTML.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/HTML.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/HTML.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/HTML.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/HTML.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/HTML.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/HTML.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/HTML.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
共 272 条
- 1
- 2
- 3
资源评论
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
![avatar](https://profile-avatar.csdnimg.cn/d7864c98224046ec9a7f43fa6207c84e_qq_51320133.jpg!1)
生瓜蛋子
- 粉丝: 3828
- 资源: 6047
![benefits](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-1.c8e153b4.png)
下载权益
![privilege](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-2.ec46750a.png)
C知道特权
![article](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-3.fc5e5fb6.png)
VIP文章
![course-privilege](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-4.320a6894.png)
课程特权
![rights](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-icon.fe0226a8.png)
开通VIP
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
最新资源
- linux shell 脚本示例 升级用
- web开发课程设计/毕设-在线商城系统一个完整的在线商城网站,包括用户注册、商品展示、购物车、支付和订单管理
- 数据库课程设计/毕设-在线商城数据库系统支持在线购物的数据库系统
- Python 包管理器、程序打包工具、pip 镜像源设置工具、模块安装包下载器
- R语言数据分析-分析学生考试成绩计算每个学生的平均成绩,并将结果存储在新的列
- latex专业的排版系统生成高质量的科技和数学文档基于TeX排版系统增加了许多易用的功能和宏包
- Tomcat部署及优化
- github使用Git进行版本控制提供远程仓库存储代码支持多人协作
- matlab信号处理与分析控制系统设计PID控制器设计
- python宠物医院管理系统功能-添加新医生添加新主人预约就诊
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)