培训chatterbot问题

时间:2019-08-01 13:25:15

标签: python nltk training-data chatterbot

我决定使用ChatterBot库创建两个简单的对话。

from chatterbot import ChatBot
from chatterbot.trainers import ListTrainer

# Create a new chat bot named Charlie
chatbot = ChatBot('Charlie')
def name():
    return "I am Kacpedr"
def age():
    return "I am 20"
trainer = ListTrainer(chatbot)

trainer.train([
    "what is your name?",
    name()
])

trainer.train([
    "how old are you?",
    age()
])

while True:
    request = input()
    response = chatbot.get_response(request)
    print(response)

我希望对问题总是能得到相同的正确答案,但是,只有大约60%的答案是可取的。其余的是“我20岁”,“您叫什么名字?”和“你几岁?”。你能告诉我发生了什么吗?如何使其100%准确?我是聊天机器人的新手。在下面,我附上控制台的输出。

what is your name?
I am Kacpedr

what is your name?
I am Kacpedr

what is your name?
I am Kacpedr

what is your name?
what is your name?

what is your name?
I am Kacpedr

what is your name?
I am Kacpedr

what is your name?
I am Kacpedr

what is your name?
I am Kacpedr

what is your name?
what is your name?

what is your name?
what is your name?

what is your name?
I am 20

what is your name?
I am Kacpedr

what is your name?
I am Kacpedr

what is your name?
I am Kacpedr

what is your name?
I am Kacpedr

what is your name?
what is your name?

what is your name?
how old are you?

what is your name?
I am Kacpedr

'''

0 个答案:

没有答案