chatterbot安装(一)
开源项目地址:
https://github.com/gunthercox/ChatterBot
安装ChatterBot
pip install chatterbot
我们需要准备一段对话,试试,我们用这段对话来训练机器人,训练完以后我们就能够跟机器聊天了。
# -*- coding: utf-8 -*-
from chatterbot import ChatBot
# Create a new chat bot named Charlie
chatbot = ChatBot(
'Charlie',
trainer='chatterbot.trainers.ListTrainer'
)
chatbot.train([
"Hi, can I help you?",
"Sure, I'd to book a flight to Iceland.",
"Your flight has been booked.",
"and you."
])
# Get a response to the input text 'How are you?'
response = chatbot.get_response('I would like to book a flight.')
print(response)
导入项目
遇到安装问题
解决:
问题二;https://blog.****.net/qq_29678299/article/details/90297370