chatterbot
Source code: https://github.com/Uttam580/chatterbot_chatbot
源代码: https : //github.com/Uttam580/chatterbot_chatbot
What are chatbot
什么是聊天机器人
A chatbot is an artificial intelligence-powered piece of software in a device (Siri, Alexa, Google Assistant etc), application, website or other networks that try to gauge consumer’s needs and then assist them to perform a particular task like a commercial transaction, hotel booking, form submission etc .
聊天机器人是设备(Siri,Alexa,Google助手等),应用程序,网站或其他网络中由人工智能驱动的软件,旨在衡量消费者的需求,然后协助他们执行特定任务,例如商业交易,酒店预订,表格提交等。
Today almost every company has a chatbot deployed to engage with the users. Some of the ways in which companies are using chatbots are:
如今,几乎每个公司都部署了聊天机器人来与用户互动。 公司使用聊天机器人的一些方式是:
* To deliver flight information
* to connect customers and their finances
* As customer support. The possibilities are (almost) limitless.
quick demo:
快速演示:
Chatterbot :
聊天机器人:
ChatterBot is a library in python which generates responses to user input. It uses a number of machine learning algorithms to produce a variety of responses. It becomes easier for the users to make chatbots using the ChatterBot library with more accurate responses
ChatterBot是python中的一个库,可生成对用户输入的响应。 它使用多种机器学习算法来产生各种响应。 用户使用ChatterBot库以更准确的响应来创建聊天机器人变得更加容易
How Does it works ?
它是如何运作的?
ChatterBot makes it easy to create software that engages in conversation. Every time a chatbot gets the input from the user, it saves the input and the response which helps the chatbot with no initial knowledge to evolve using the collected responses. With increased responses, the accuracy of the chatbot also increases. The program selects the closest matching response from the closest matching statement that matches the input, it then chooses the response from the known selection of statements for that response.
ChatterBot使得创建参与对话的软件变得容易。 每当聊天机器人从用户那里获取输入时,它都会保存输入和响应,这将帮助没有初始知识的聊天机器人使用收集到的响应来发展。 随着响应的增加,聊天机器人的准确性也会提高。 程序从最匹配输入的匹配语句中选择最匹配的响应,然后从已知的该响应的语句选择中选择响应。
I trained based on english greetings and conversations corpora.
我根据英语问候和对话语料库进行了训练。
```#created chatbot with name john
#SQLStorageAdapter which allows the chat bot to connect to SQL databases. By default, this adapter will create a SQLite database.
english_bot = ChatBot("John", storage_adapter="chatterbot.storage.SQLStorageAdapter")
trainer = ChatterBotCorpusTrainer(english_bot)#allows the chat bot to be trained using data from the ChatterBot dialog corpus.
trainer.train("chatterbot.corpus.english")# trainning based on english greetings and conversations corpora.```
The design of ChatterBot is such that it allows the bot to be trained in multiple languages. On top of this, the machine learning algorithms make it easier for the bot to improve on its own using the user’s input.
ChatterBot的设计使其可以用多种语言来训练机器人。 最重要的是,机器学习算法使机器人更容易根据用户的输入自行进行改进。
Project directory tree:
项目目录树:
flask-chatterbot-master
├─ app.py
├─ demo.gif
├─ README.md
├─ requirements.txt
├─ static
│ ├─ css
│ │ └─ style.css
│ └─ js
│ └─ main.js
└─ templates
└─ index.html
Local setup:
本地设置:
Ensure that Python, Flask, SQLAlchemy, and ChatterBot are installed (either manually, or run
pip install -r requirements.txt
).确保已安装Python,Flask,SQLAlchemy和ChatterBot(手动或运行
pip install -r requirements.txt
)。Run app.py with
python app.py
.使用
python app.py
运行app.py。The demo will be live at http://localhost:5000/
该演示将在http:// localhost:5000 /上直播
Bug/Feature Request:
错误/功能要求:
If you find a bug, kindly open an issue by including your search query and the expected result.any suggestions will be appericiated
如果发现错误,请通过添加搜索查询和预期结果来打开一个问题。任何建议将被提出
For other projects check out Git repo , Feel free to fork it
对于其他项目,请查看Git repo ,随时进行分叉
Thanks for reading the blog.
感谢您阅读博客。
翻译自: https://medium.com/@uttam94/chatbot-creation-using-chatterbot-and-integrated-with-flask-27d766905b21
chatterbot