A chatbot designed to perform basic life coaching.
Running on Kik and Facebook Messenger, and locally on jupyter notebook and terminal.
Coachybot is a chatbot that leads you through a coaching conversation. During this coaching conversation, Coachybot will:
- Ask how you day was, with a focus on highlights and lowlights
- Probe for open issues and problems
- Ask you to evaluate how relevant and solvable a given problem is
- Brainstorm various possible solutions with you
- Try to get a commitment from you for implementing a solution
Do you think it's hopeless/insane/wrong/fascinating to 'teach' coaching, a skill highly based on empathy and wisdom, to a bot? Sometimes I do, too. On this background page, you can find some thoughts on why I still think this is valuable and worth trying.
Technically, each state of the coaching conversation is represented as a node class that uses the user's history and current message as arguments and returns the updated user history, the answer and the name of the next node.
>>> user = {
... "firstname" : "Alan"
... }
>>> message = "Hello there! :)"
>>> test_node = Welcome( message, user)
>>> test_node.answer
['Oh hello! What a pleasure to meet you, Alan!',
'My name is Coachybot, but you can call me Coachy.',
'I have been programmed to improve your life by providing some basic coaching. So...',
'How are you today?']
>>> test_node.node_next
'HowAreYou'
>>> test_node.user
{'firstname': 'Alan',
'message_previous': False,
'node_current': 'HowAreYou',
'node_previous': 'Welcome'}
The natural language processing facilities (dubbed 'skills') of Coachybot are based on keyword lists and regular expressions. Some attempts for a more grammar-based approach using NLTK and sentiment analysis have been implemented, with yet unsatisfactory results.
>>> message = "i really hope that Coachybot provides some value."
>> check_if_statement( message, "has_desire")
True
Coachybot is currently hosted on the cloud service Heroku, uses Heroku's postgreSQL database and runs on Facebook Messenger. This repository contains the scripts for running Coachybot on Kik Messenger as well, where the setup process is somewhat easier.
In terms of maturity, Coachybot is in minimum viable product / alpha stage. Chances that you will have a satisfying conversation with Coachybot on Facebook Messenger are not quite bad! The scope of the conversation is limited, and you might well encounter some points where the conversation doesn't flow smoothly.
To run Coachybot locally, just download and unzip this entire repository from GitHub, either interactively, or by entering the following in your Terminal:
git clone https://github.com/botmaker-florian/coachybot
Next, navigate into the top directory of your local repository and install Python's NLTK and regex package, if you don't have them already:
cd coachybot
pip install nltk
pip install regex
To have a conversation with Coachybot in your browser and to get a first impression of how he works, open the repository's notebook file:
jupyter notebook coachybot_notebook.ipynb
Alternatively, to enjoy a plain terminal conversation with Coachybot, do the following:
python coachybot_terminal.py
You can find the installation guide here. It contains instructions to run Coachybot at the cloud hosting service Heroku and to register your bot at Kik and Facebook.
Coachybot node classes were developed using rigorous Test-Driven Development. The test suite for the node classes can be run by
python node-tests.py
By toggling the verbose argument in each test function, the node evaluation with the specific arguments can be investigated.
Most of Coachybot's skills were developed using Test-Driven Development. Admittedly, there is some confirmation bias, and for a few skills there are no unit tests. The test suite for skills can be run by
python skill-tests.py
Currently, I am not well aware of how to run unit test for the cloud-based functionality. Any suggestions and hints are welcome!
This is my first open source project, and every form of positive engagement and contribution is welcome!
Please check CONTRIBUTING.md for ideas about how and what to contribute. To make engagement in this project a positive experience for everyone involved, please take not of and adhere to the Contributor Covenant code of conduct.
This repository contains a local version of Peter Norvig's ngram-based spell correction program that I manually tweaked to perform better for my use case. It is on my To Do list to replace it with a current, crowdsourced version.
Coachybot is published under the MIT license.
I look forward to getting in touch with you! The choice of channel is yours: