Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

chatterbot unexpected default behaviour

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!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...