FAQ Chatbot

by yafeunteun

GitHub Readme.md

FAQ-chatbot-for-energym

https://travis-ci.org/yafeunteun/FAQ-chatbot-for-energym.svg?branch=master https://www.herokucdn.com/deploy/button.svg

FAQ Chatbot for Energym, this implementation uses the RASA-NLU library in Python.

./img/chatbot.png

Temp useful commands

Training on dialogs

python train.py --dial

Equivalent to:

python -m rasa_core.train -d domain.yml -s stories.md -o models/dialogue

Training on NLU

python train.py --nlu

Equivalent to:

python -m rasa_nlu.train -c nlu_config.yml --data nlu.md -o models --fixed_model_name nlu --project current --verbose

Start server

python -m rasa_core.run -d models/dialogue -u models/current/nlu     --port 5002 --credentials credentials.yml

Training the model

This task is required to generate the model. It must be performed the first time (the model is not version controled) and everytime the training set (aka nlu.md) is edited.

From the main directory (where this readme is located):

python -m rasa_nlu.train -c nlu_config.yml --data nlu.md -o models --fixed_model_name nlu --project current --verbose

If everything worked as expected the following structure should have been created:

models
└── current
    └── nlu
        ├── ... many files here ...

Start NLU Agent (server)

From this directory:

python -m rasa_nlu.server --path models

Note: default port 5000 can be modified with --port N option with N the desired port.

Test using cURL

curl -X POST localhost:5000/parse -d '{"q":"Hello Bot", "project":"current", "model":"nlu"}' | python -m json.tool

Answer format:

{
    "intent": {
        "name": "greet",
        "confidence": 0.9617286920547485
    },
    "entities": [],
    "intent_ranking": [
        {
            "name": "greet",
            "confidence": 0.9617286920547485
        },
        {
            "name": "thankyou",
            "confidence": 0.0044258832931518555
        },
        {
            "name": "get_hours",
            "confidence": 0.0
        },
        {
            "name": "get_services",
            "confidence": 0.0
        }
    ],
    "text": "Hello Bot",
    "project": "current",
    "model": "nlu"
}