This stripped-down example finds a perfect match to the?first input,?but treats it as repetition?to be ignored with no known? responses found. Obviously this unexpected?behaviour can be fixed by tinkering with filters, thresholds?&c.
from chatterbot import ChatBot
from chatterbot.trainers import ChatterBotCorpusTrainer
chatbot = ChatBot("Ron Obvious", logic_adapters=["chatterbot.logic.BestMatch"])
trainer=ChatterBotCorpusTrainer(chatbot)
trainer.train("chatterbot.corpus.english.greetings")
import logginglogging.basicConfig(level=logging.INFO)? ? # Enable info level logging? ? ? ? ? ?
response = chatbot.get_response("Good morning!")
print(response)
INFO:chatterbot.chatterbot:Beginning search for close text match
INFO:chatterbot.chatterbot:Processing search results
INFO:chatterbot.chatterbot:Similar text found: Good morning! 1.0INFO:chatterbot.chatterbot:Using "Good morning!" as a close match to "Good morning!" with a confidence of 1.0
INFO:chatterbot.chatterbot:0. Excluding recent repeated response of "Good morning!"
INFO:chatterbot.chatterbot:No responses found. Generating alternate response list.
INFO:chatterbot.chatterbot:No known response to the input was found. Selecting a random response.
INFO:chatterbot.chatterbot:BestMatch selected Greetings" as a response with a confidence of 0
INFO:chatterbot.chatterbot:Adding "Good morning!" as a response to "Good morning!
Greetings!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…