Как получить пустой ответ при поиске некоторых вопросов, которые недоступны?
Если вопрос доступен, он должен вернуть правильный ответ.
from chatterbot import ChatBot
from chatterbot.trainers import ListTrainer
chatterbot = ChatBot("Training Example")
chatterbot.set_trainer(ListTrainer)
chatterbot.train([
"Hi there!",
"Hello",
])
chatterbot.train([
"Greetings!",
"Hello",
])
chatbot.train(["Greetings!","Hello",])
chatbot.train(["How are you?","I am good.","That is good to
hear.","Thank you","You are welcome.",])
while True:
try:
a = input("question please..? ")
response = chatterbot.get_response(a)
print(response)
except (KeyboardInterrupt,SystemExit):
print("your loop has been closed: ")
break