Open GMT95 opened 6 years ago
@GMT95 chatterbot treas first statement and second as response. in your case
statement-1
response-1
....
....
statement-n
response-n
But you are trying in different fashion, for your use case it should be like this, Very good documentation on training process found here http://chatterbot.readthedocs.io/en/stable/training.html
-- what is the color of sky
-- blue
See Low confidence response selection filter out your responses with below confidence. http://chatterbot.readthedocs.io/en/stable/logic/index.html#low-confidence-response-adapter
Thankyou @vkosuri, i have no problem training with corpus data or custom training file. I just wanted to ask that if I can train chatterbot while having a conversation with it.
For Example if chatterbot doesn't know something it says:
I dont know this can you tell me
and when i reply with the answer,chatterbot saves it in the database.
Me: what is the color of sky? bot: I dont know, can you tell me. Me: blue
and when i ask chatterbot again What is the color of sky? it replies with blue
Is it possible to do something like this?
yes, try this example https://github.com/gunthercox/ChatterBot/blob/master/examples/learning_new_response.py
Thankyou @vkosuri, the last link is really helpful.
@vkosuri can i set a default response when something is not in Chatterbot's Knowledge like
Bot replies: I don't know or Can you please tell me
Yes
It sounds like this question has been answered? @GMT95 I'm going to close this ticket off for now, feel free to reopen it if your original question wasn't resolved.
yes, try this example https://github.com/gunthercox/ChatterBot/blob/master/examples/learning_new_response.py
This link is not working.. How can I solve the same issue raised by @GMT95 ?
It's has been very long, I understood @GMT95 question, The Statements
are sent through the console and the training process start on the fly, Bot return response
If that is the case I think this is not available right now.
@AfrahAsif See this example instead: https://github.com/gunthercox/ChatterBot/blob/master/examples/learning_feedback_example.py
@gunthercox Im also trying what @GMT95 and @AfrahAsif is trying can you help me how to implement it to the one im working on?
from chatterbot import ChatBot from chatterbot.trainers import ListTrainer
def get_response(usrText):
bot = ChatBot('Bot',
storage_adapter='chatterbot.storage.SQLStorageAdapter',
logic_adapters=[
{
'import_path': 'chatterbot.logic.BestMatch'
},
{
'import_path': 'chatterbot.logic.LowConfidenceAdapter',
'threshold': 0.70,
'default_response': 'I am sorry, but I do not understand.'
}
],
trainer='chatterbot.trainers.ListTrainer')
bot.set_trainer(ListTrainer)
while True:
if usrText.strip()!= 'Bye':
result = bot.get_response(usrText)
reply = str(result)
return('Bot :'+reply)
if usrText.strip() == 'Bye':
return('Bot :'+reply)
break
from chatterbot import ChatBot from chatterbot.trainers import ListTrainer import os
def setup(): chatbot = ChatBot( 'Bot', storage_adapter='chatterbot.storage.SQLStorageAdapter', trainer='chatterbot.trainers.ListTrainer') for file in os.listdir('C:/Users/hp/Chatbot/data/'): convData = open(r'C:/Users/hp/Chatbot/data/' + file,encoding='latin-1').readlines()
chatbot.set_trainer(ListTrainer)
chatbot.train(convData)
#print("Training completed")
setup()
@gunthercox also im having this kind of error
Type something to begin...
hi
Traceback (most recent call last):
File "feed.py", line 41, in
@vkosuri can you help me with this sir?
@Augus2411 It looks like the code you are using is from an older version of ChatterBot. I would suggest that you look over the latest version of the examples.
hi, i want to do something like this
Me: what is the color of sky? bot: I dont know, can you tell me. Me: blue
and the bot saves the "blue" output on "what is the color of sky input".
Currently the bot saves my input "what is the color of sky?"
Please help.