gunthercox / ChatterBot

ChatterBot is a machine learning, conversational dialog engine for creating chat bots
https://chatterbot.readthedocs.io
BSD 3-Clause "New" or "Revised" License
14.03k stars 4.44k forks source link

Limiting training #260

Closed gsingers closed 7 years ago

gsingers commented 8 years ago

Is there a way to only learn based on conversations that are marked? I'm integrating Chatterbot with a bot I'm building for Slack and I want to use "Slack reactions" as a way of giving feedback to the bot as to the correctness of the conversation. I know there is a "read only" mode, but this is slightly different.

Thanks for the great tool!

gunthercox commented 8 years ago

Hi @gsingers, this currently isn't possible to do but I like the idea. Currently, the learning done by ChatterBot is done in the get_response method of the main ChatBot class. The "learning" is done by updating the database with the user's response to the chat bot's output.

I think it might be an excellent idea to separate the learning code from the response generation code. After making this change, an additional value could be returned from the logic adapter responsible for retrieving input from Slack.

gsingers commented 8 years ago

@gunthercox yeah, I'd like that. Given conversations aren't threaded in Slack, I'm doing some additional work to try to correlate the questions I'm trying to answer and the responses from the chatterbot.

FWIW, I don't think my use case is straight up "chat". It's more like Q&A bot where I eventually only want to learn and answer specific questions/interactions. You can see my total work in progress at https://github.com/gsingers/rtfmbot. That being said, in about 2 hours of work, thanks to this tool, I'm able to get somewhat decent results. YMMV.

gsingers commented 8 years ago

BTW, @gunthercox I reworked to make the slack connectors use Input/OutputAdapters, if you want, I can make a Pull Request to fold them in upstream.

gunthercox commented 8 years ago

@gsingers The slack adapters sound like a great addition. If you're interested in making a pull request I'd be happy to accept it.

davizucon commented 8 years ago

@gsingers , this is exactly what I was looking for. :) Are you using Slack RTM ?

gsingers commented 7 years ago

@gunthercox I'll try to get a PR up soon. @davizucon see the link above to RTFMbot.

@gunthercox I've looked through the code, not sure I see where the training is happening. Can you point me at it?

gunthercox commented 7 years ago

@gsingers Check out the two training modules (ListTrainer, ChatterBotCorpusTrainer) in trainers.py

gunthercox commented 7 years ago

@gsingers I've made changes that break up the response generation and response learning parts of the get_response method. #365 adds a new example file that demonstrates this. Feel free to provide feedback if you have any.