python chatterbot(案例)

from chatterbot import ChatBot
from chatterbot.trainers import ListTrainer

conversation = [
    "Hello",
    "Hi there!",
    "How are you doing?",
    "I'm doing great.",
    "That is good to hear",
    "Thank you.",
    "You're welcome."
]
chatbot = ChatBot('Ron obvious')  # 建立聊天机器人
chatbot.set_trainer(ListTrainer)  # 训练聊天机器人
chatbot.train(conversation)
response = chatbot.get_response("good morining!")  # 输入数据测试
print(response)

你可能感兴趣的:(python,数据挖掘)