Auto chat example
Chat 1:
user: 在吗?
bot: 在
user: 在干嘛呢?
bot: 看电视
user: 看啥电视呀
bot: 活色生香
user: 很好看吗?
bot: 特搞笑
user: 你在哪里呀?
bot: 家里
user: 家里就你一个人嘛?
bot: 我喜欢一个人玩
user: 那我过来找你?
bot: 不可以,乖乖上班去
Chat 2:
Q: 在吗?
A: 在
Q: 干嘛呢?
A: 没事
Q: 陪我去逛街嘛?
A: 嗯
Q: 你在打游戏?
A: 没有
Q: 那去不去?
A: 去
This is based on the training of 2 million chat records, you can use the records of yourself and your girlfriend to try the effect: P
As for how to use the GitHub
robot, you can search for it at 0615fc7eca5cb4
project instruction
chatbot
is a Go Q&A engine that quickly generates answers from known dialog data sets.
Why is there a chatbot
project?
Many years ago, when we needed a chat bot, I first used ChatterBot
, but after using it, it takes about 21 seconds to answer a question with our 120 million paired speech data training model, which is really unacceptable. After carefully reading the ChatterBot
, I re-implemented one with Go and optimized it in parallel with go-zero's MapReduce framework. As a result, our answer took about 18 milliseconds on average.
During the National Day holiday, I had a little free time, so I organized this project to open source. One is to give you an actual go-zero MapReduce example; the other is to provide you with a chat robot project to play with.
BTW: I may open source the smart customer service robot project in the future, you can follow my github:
Code directory and command line instructions
bot
Q&A engine, you can customize your own matching algorithm
cli
train
Train the given question and answer data and generate
.gob
file-d
reads alljson
andyaml
corpus files in the specified directory-i
reads the specifiedjson
oryaml
corpus file, multiple files are separated by commas-o
specifies the output.gob
file-m
timing print memory usage
ask
A sample Q&A command line tool
-v
verbose-c
trained.gob
file- Several possible answers for
-t
Data Format
If you have corpus data, you can organize it yourself for training.
The data format can be provided through yaml
or json
file, https://github.com/kevwan/chatterbot-corpus
refer to the format in 0615fc7eca5fb8. It is roughly as follows:
categories:
- AI
conversations:
- - 什么是ai
- 人工智能是工程和科学的分支,致力于构建具有思维的机器。
- - 你是什么语言编写的
- Python
- - 你听起来像机器
- 是的,我受到造物者的启发
- - 你是一个人工智能
- 那是我的名字。
Thanks
go-zero - https://github.com/zeromicro/go-zero
go-zero
in the core/mr
package of MapReduce
chatbot
the response efficiency of 0615fc7eca6012!
ChatterBot - https://github.com/gunthercox/ChatterBot
At first I used ChatterBot , but because the answer was too slow, I could only implement it myself. Thanks to ChatterBot , a great project!
project address
https://github.com/kevwan/chatbot
Welcome to use and support star
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。