-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Open
Description
import logging
from chatterbot import ChatBot
from chatterbot.trainers import ListTrainer
from chatterbot.conversation import Statement
from chatterbot.trainers import ChatterBotCorpusTrainer
Uncomment the following line to enable verbose logging
logging.basicConfig(level=logging.INFO)
yes_resp = ["yes", "y"]
no_resp = ["no", "n"]
def get_feedback():
text = input()
if text.lower() in yes_resp:
return True
elif text.lower() in no_resp:
return False
else:
print('Only "Yes" or "No"')
return get_feedback()
bot = ChatBot(
'Bot',
storage_adapter='chatterbot.storage.SQLStorageAdapter',
logic_adapters=[
{
'import_path': 'chatterbot.logic.BestMatch',
}
],
input_adapter='chatterbot.input.TerminalAdapter',
output_adapter='chatterbot.output.TerminalAdapter',
database_uri='sqlite:///database.db'
)
trainer = ChatterBotCorpusTrainer(bot)
trainer.train("./my_own.yml")
print('Type something to begin...')
while True:
try:
input_statement = Statement(text="How are you?")
response = bot.generate_response(input_statement)
print("\nConfidence: " + str(response.confidence))
print('"{}" It is correct "{}"?'.format(response.text, input_statement.text))
if response.text != "fine":
correct_response = Statement(text="fine")
bot.learn_response(correct_response, input_statement)
else:
break
# Press ctrl-c or ctrl-d on the keyboard to exit
except (KeyboardInterrupt, EOFError, SystemExit):
print("Arrivederci")
break
I am trying to use feedback training but I have noticed that when I enter information via input the confidence is not changed and the new answer is not entered in the database.
I tried to do this cycle to see if with many more answers this was inserted in the database but it doesn't happen.
Where am I doing wrong?
Is there a way to manually change the confidense?
Thanks everyone in advance
Metadata
Metadata
Assignees
Labels
No labels