All Projects → ajinkyaT → FAQ_Chatbot_Rasa

ajinkyaT / FAQ_Chatbot_Rasa

Licence: other
FAQ's answering chatbot using open source chatbot framework Rasa Stack

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to FAQ Chatbot Rasa

small-talk-rasa-stack
Collection of casual conversations that can be used with the Rasa Stack
Stars: ✭ 87 (+163.64%)
Mutual labels:  rasa-nlu, conversational-ai, rasa-core
Django-Rasa-Bot
Integrating Rasa Core with Django backend and finally using Webchat for chatbot user interface
Stars: ✭ 30 (-9.09%)
Mutual labels:  rasa-nlu, rasa-core
clofus-chatbot
Clofus® Chat bot Platform using rasa core and rasa nlu similar to rasa x but opensource demo https://clofus.github.io/clofus-chatbot/
Stars: ✭ 61 (+84.85%)
Mutual labels:  rasa-nlu, rasa-core
ContrastiveLearning4Dialogue
The codebase for "Group-wise Contrastive Learning for Neural Dialogue Generation" (Cai et al., Findings of EMNLP 2020)
Stars: ✭ 54 (+63.64%)
Mutual labels:  conversational-ai
Botpress
🤖 Dev tools to reliably understand text and automate conversations. Built-in NLU. Connect & deploy on any messaging channel (Slack, MS Teams, website, Telegram, etc).
Stars: ✭ 9,486 (+28645.45%)
Mutual labels:  conversational-ai
bot
Python Bot using RASA for NLP
Stars: ✭ 28 (-15.15%)
Mutual labels:  rasa-nlu
GSTFAQChatbot
Set of scripts to build a chatbot which will answer FAQ about Goods and Services Tax (GST) India.
Stars: ✭ 37 (+12.12%)
Mutual labels:  rasa-nlu
Medi-CoQA
Conversational Question Answering on Clinical Text
Stars: ✭ 22 (-33.33%)
Mutual labels:  conversational-ai
newbot-framework
Framework to create chatbots on all platforms and on the browser - https://newbot.io
Stars: ✭ 35 (+6.06%)
Mutual labels:  conversational-ai
rasa-bert-finetune
支持rasa-nlu 的bert finetune
Stars: ✭ 46 (+39.39%)
Mutual labels:  rasa-nlu
rasa-nlu-examples
This repository contains examples of custom components for educational purposes.
Stars: ✭ 126 (+281.82%)
Mutual labels:  rasa-nlu
Rasa core
Rasa Core is now part of the Rasa repo: An open source machine learning framework to automate text-and voice-based conversations
Stars: ✭ 2,302 (+6875.76%)
Mutual labels:  conversational-ai
Wechaty
Conversational RPA SDK for Chatbot Makers
Stars: ✭ 11,647 (+35193.94%)
Mutual labels:  conversational-ai
Nlp.js
An NLP library for building bots, with entity extraction, sentiment analysis, automatic language identify, and so more
Stars: ✭ 4,670 (+14051.52%)
Mutual labels:  conversational-ai
developers-community
LivePerson’s Developer Center and Community
Stars: ✭ 29 (-12.12%)
Mutual labels:  conversational-ai
few shot dialogue generation
Dialogue Knowledge Transfer Networks (DiKTNet)
Stars: ✭ 24 (-27.27%)
Mutual labels:  conversational-ai
Simpletransformers
Transformers for Classification, NER, QA, Language Modelling, Language Generation, T5, Multi-Modal, and Conversational AI
Stars: ✭ 2,881 (+8630.3%)
Mutual labels:  conversational-ai
Wisty.js
🧚‍♀️ Chatbot library turning conversations into actions, locally, in the browser.
Stars: ✭ 24 (-27.27%)
Mutual labels:  conversational-ai
Luci
Logical Unity for Communicational Interactivity
Stars: ✭ 25 (-24.24%)
Mutual labels:  conversational-ai
rasa-site-bot
A chatbot that fetches events details from a conference's website
Stars: ✭ 81 (+145.45%)
Mutual labels:  rasa-nlu

Open Source FAQ's answering chatbot using Rasa Stack

Blog post explaining working here.

Overview

We will be using Rasa Stack to build our conversational A.I chatbot to answer FAQ's about Git. The reason being Rasa is open source and hence we will no longer need to send our confidential data to some alternative cloud service providers.

Apart from that Rasa offers flexibility to customize our model according to our need. By default it uses some the most popular open source libraries for Natural Language Processing and Machine Learning like SpaCy and scikit-learn with default parameters optimized for most common NLP tasks like Intent classification (understanding what user wants eg, asking question, ordering something) and Named Entity Recognition (understanding what specific keywords means eg, Bangalore-location, Google - organization)

Rasa NLU handles the Natural Language Understanding (Intent clasification and N.E.R) part while Rasa Core handles the dialog management part. See below image for framework overview.

Installation

  1. Install Rasa NLU: Rasa NLU Installation

  2. For backend we will use spaCy + sklearn

  3. Install Rasa Core (version used 9.5): Rasa Core Installation

  4. fuzzywuzzy: Fuzzy string matching in Python for similar text retrieval

Getting Or Generating Data

We will need labeled user data for training our NLU or interpreter part. While it is always better to have more data to train our ML models but in case we don't have it we can use free services such as Chatito or Tracy to synthetically generate one to suite our use case.

Data should be in json format as specified by Rasa here. An example will look like:

{
  "text": "show me chinese restaurants",
  "intent": "restaurant_search",
  "entities": [
    {
      "start": 8,
      "end": 15,
      "value": "chinese",
      "entity": "cuisine"
    }
  ]
}

Once we have our training data store it in /data in the working directory.

data
├── data.json # data for training NLU
├── faq_data.csv # CSV file containing questions and answers
└── stories.md # Sample conversations 

U.I For Visualizing And Editing Data

There exits a tool called rasa-nlu-trainer which helps you visualize and edit the json data you created in the previous step. As shown below each training instance has an intent associated with it and entities highlighted (color coded for different entity type).

First install it using npm by following the instructions mentioned here and launch it by opening a terminal in your chatbot directory by typing,

$ rasa-nlu-trainer

This will open a new tab in your browser. You can even try it online without having to install anything by simply uploading your json training file.

Training Natural Language Understanding Model

Open a terminal in the project directory and run following command:

$ python nlu_model.py

This will train our model to identify intent form a user using SpaCy and sk-learn backend.

Configuration for backend has been specified in the config_spacy.json file in the project directory. Below is the content of the file:

{
  "pipeline":"spacy_sklearn",
  "path":"./models/nlu",
  "data":"./data/data.json"
}

Training Dialogue Management Model

To train a dialogue model which in our case is Rasa Core python library we need to first create a stories.md file in ./data directory. First write a sample story to the newly created empty file, copy below content:

## sample story
* greet
   - utter_greet
* goodbye
   - utter_goodbye

then in terminal type the following command to start dialogue model training:

$ python train_init.py

Once initial training is done this will create a dialogue folder in models directory (./models/dialogue) our dialogue management model will be stored here.

Full training to suite our use case haven't been done yet. Our model now only understands to greet and say good bye! To create stories suitable to our use case use online training recommended by Rasa Core. In terminal type the below command and follow the instructions on the screen to pose yourself as a bot and choose which actions should follow after which events.

$ python train_online.py

Once you think your bot has started to perform reasonably well then choose option "0" shown below to export current conversion to stories.md file in the project directory. (Note there are two such files named stories.md one in project directory and other one in ./data/stories.md)

The bot wants to [action_listen]. Is this correct?

	1.	Yes.
	2.	No, the action is wrong.
	0.	Export current conversations as stories and quit

Copy the content from project directory's stories.md file and append it to ./data/stories.md file

Once we have enough sample conversations to be suitable to our use case we can now repeat the first step to train our dialogue management model on the newly updated ./data/stories.md data by typing following command:

$ python train_init.py

You should be now be able to run complete bot in the terminal by typing following command:

$ python dialogue_management_model.py

Sentence Similarity And Similar Question Retrieval

actions.GetAnswer has been defined in faq_domain.yml whenever bot recognizes that text sent by user is a question. See actions.py file in project directory.

I have used FuzzyWuzzy python package which does approximate string matching by computing difference based on Levenshtein distance. I have used Token Set Ration method which takes care of partial string match and when string lengths differ.

This will find the nearest matching question in the question column of ./data/faq_data.csv file and return the answer along with other details as link and page no. Possible conversation will look something like below:

USER: hello!
BOT: Hello! How can I help?
USER: pushing my changes
BOT:  Here is something I found 
      Document: http://gitfaq.org/articles/how-do-i-push-my-changes.html 
      Page number: 1 
      Question:  How do I push my changes? 
      Answer: 
      git push
      git push origin branch-name

Server Deployment

It is possible to deploy our chatbot on a http server using flask. We can either,

  1. Host Rasa Core services on http server by following details mentioned here or
  2. Use flask and requests to connect our bot to http endpoints as mentioned here.

Disadvantage of approach one is that we can only get information of which action to execute following user query and need to define rules on our end to execute that action eg, search similar question, fetching data from database etc.

This can however be avoided if followed second option.

Future Directions

  1. I have used FuzzyWuzzy python package for string similarity which is based on Levenshtein distance and it requires both strings to contain exact or near similar words but will fail in case of semantic matching eg. in case of words like (lost, not found), (require, need) etc. To avoid this we can try to encode each question in our database and a user query by using some sentence encoder and then finding the similar pair using cosine-distance. Have a look at recently released Universal Sentence Encoder by TensorFlow.

  2. Our bot implementation can only handle questions which are available in the dataset and mapped to their corresponding answers. In case of handling questions based on some ontology or some structured dataset in general we need to follow the approach of creating a knowledge graph (the info box you see on right side whenever you search for a fact on Google) first and then using an Entity-relationship model.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].