/moodbot

Chatbot web-app with registration

Primary LanguagePython

Moodbot

Simple user based chat with a mood recognition chatbot
API stability

Come discuss with us @Reddit

This project from Queen Mary University of London is a bot application for personal goals/motivation support. So far it is a rule-based platform recognizing up to seven emotions.

Technically it is a locally designed flask application that has a Client, which is a simple UI chat interface, and a server CLI backend that fetches users conversations and understands details and answer with Rasa, an open source NLU tool.

chatbot photo is comming back soon!

Installation

Requirements

pip install -r requirements.txt command may fail for few packages like spacy. So you have to install the following pip install spacy and those which might lack.

  • rasa-nlu, please follow the official documentation
  • rasa_core pip install rasa-core==0.9.0a3
  • for the weather you might need pip install git+https://github.com/apixu/apixu-python.git

You then have to create the database myflaskapp using MySQL. It will contains users and conversations.

CREATE DATABASE myflaskapp;
USE myflaskapp;
CREATE TABLE users(id INT(11) AUTO_INCREMENT PRIMARY KEY, name VARCHAR(100), username VARCHAR(100), password VARCHAR(100), register_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP);
CREATE TABLE conversations(id INT(11) AUTO_INCREMENT PRIMARY KEY, title VARCHAR(255), author VARCHAR(100), body TEXT, create_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP);

Settings to change

This is a locally designed chatbot, you will probably have to change the credentials.

In app.py

  • MySQL credentials
  • app secret key in the main

You may be able to ask the weather to the bot ! For that you must first create you own credentials on apixu.com.

Running the app

Don't forget to build your model first with python train_init.py. You have to run both the client and the server. You may then run in two terminals in your project directory the following command :

  • python app.py which launch the client.
  • python -m rasa_core.server -d models/dialogue/ -u models/nlu/default/moodnlu/ --debug -o out.log --cors * which launch the server.

Modifying the NLU model

This chatbot is a totally open-source project, you are free to modify it in every way

Modifying the domain

The domain specifies the universe in which the bot's policy acts. A Domain subclass provides the actions the bot can take, the intents and entities it can recognise

Create more stories for better answers

If the model is done you may want to add more stories in order to have better actions from the bot. In order to do that you may run python train_online.py. You will be able to stack new stories to the old ones but pay attention to where you save it !

Create more data for better understanding

The training data is essential to develop chatbots. It should include texts to be interpreted and the structured data (intent/entities) we expect chatbots to convert the texts into. The best way to get training texts is from real users, and the best way to get the structured data is to pretend to be the bot yourself. There is already some data saved in data/data.json.

For data visualization it you shall use the open source rasa-nlu-trainer on Chrome. You may download it with node packet manager with npm i -g rasa-nlu-trainer. To use it just launch rasa-nlu-trainer.

Contribution

We will be happy to let you join the team! We would like to :

  • have more data in data/data.json. Indeed, the more data you have here, the more the bot will be able to understand.
  • have more stories in data/stories.md for better answers.
  • have more mood, actions and templates in the domain.yml.
  • enable people to talk to each other and store their conversation as anonymous data which could then be used for ML NLU for furthering the dialog agent. Today this is provided by the article systems, which isn't the best way to chat.

Do not hesitate to fork the project !

Reporting Issues

We love feedback from our former padawans, feel free to raise an issue for any problem.