COVID-19 Chatbot with Rasa 2.0: open source conversational AI

Overview

COVID-19 Chatbot with Rasa 2.0: open source conversational AI

Table of Contents

  1. introduction
  2. COVID-19 data
  3. Conversational flow
  4. Implementation
  5. Installation
  6. References

introduction

As natural language processing (NLP) technology and chatbot systems over the past few years have evolved quickly, also the usefulness of chatbots has increased. The motivation of chatbots is productivity; they have an instant access to information they refer to and are efficient in assisting users. (Brandtzaeg, 2017, Why people use chatbots. COVID-19 chatbot is an excellent use case example for the technology.

The content of a chatbot consists of the personality, conversation flows and the information it can deliver to the user. Personality is created by interactions and responses and by acting differently in different situations. These responses should be designed so that it maximises the engagement between the bot and the user (Katz, 2019, The Ultimate Guide to chatbot personality, Chatbots Magazine). The COVID-19 chatbot described here aims to use these principles, however due to the efforts required, in a rather minimalistic way leaving plenty of room for future improvements. e.g. in the area of how to handle chitchat.

COVID-19 data

The COVID-19 data format chosen here is defined by (https://api.rootnet.in/covid19-in/stats/history), which provides COVID-19 data freely for developers.

Conversation Flow

The conversation is initiated by the end-user. A greeting or a goodbye should reset any prior assumptions or knowledge collected by the bot during previous interactions. When time or COVID-19 detail are not contained in the query, the bot shall report the current and generic COVID-19 conditions. When the city is not provided in the query, the bot shall request for it. Any further specifics in the query should be answered in more detail if information is available.

3 Major queries that a user can perform apart from greeting,goodbye etc:

As this is a demo modal of how to integrate API in rasa. So I have designed this COVID-19 bot to answer limited queries as follows:

Query1

user can ask for current confirmed covid cases of any city in India

Examples:

-what is the number of cases currently in Delhi?
- how's the covid currently in Delhi?
- Tell me about covid currently in Maharashtra
- covid cases in Punjab currently

Query2

user can ask for total current confirmed cases of any two cities in India

Examples:

- Hey, what’s the total count of confirmed cases in Delhi, Maharashtra altogether?
- total confirmed cases in Delhi and Maharashtra together?
- total cases currently in Delhi and Maharashtra
- Get me the total current confirmed cases in Delhi and Maharashtra
- Tell me the total current confirmed cases in Delhi and Maharashtra

Query3

user can ask total cases between any dates(format: yyyy-mm-dd)

Examples:

- What’s the confirmed case count from 2020-10-01 to 2020-10-12?
- Hey, what's the current confirmed cases from 2020-10-01 to 2020-10-12?
- currently cases from 2020-10-01 to 2020-10-12?
- Hey, what’s the total count of confirmed cases from 2020-10-01 to 2020-10-12?
- total confirmed cases from 2020-10-01 to 2020-10-12 in India?
- total cases from from 2020-10-01 to 2020-10-12? in India
- Get me the total current confirmed cases from 2020-10-01 to 2020-10-12? in India
- Tell me the total current confirmed cases from 2020-10-01 to 2020-10-12? in India

Implementation

All components are defined to support the conversation flow . The end-user intents here are: who_are_you, covid_in_city, covid_in_two_city, covid_in_period, covid_without_city, greet, goodbye, affirm, deny, mood_great, mood_unhappy, bot_challenge, how_are_you, capabilities In Rasa, the slots can be used for passing information to and back between Rasa and external actions. Three slots are required: city,city2, init_date,final_date.

The responses where the personality is also largely created are: utter_greet, utter_goodbye, utter_ask city (triggers city_form), utter_iamabot, utter_capabilities, utter_im_well so on. This also includes the external action, action_covid, which fetches the COVID-19 data, parses it and generates the COVID-19 response sentence.

External actions are user defined functions written in python. Only one action, action_covid, is required. It is split in two separate functionalities here: actions.py which receives slots: city,city2,init_date and final_date from Rasa. It then queries the COVID-19 data for specific city from covid_api.py where a function covid_data(city,city2,init_data,final_data) is defined. The function returns the COVID-19 data(totalcases) after getting filtered out from (https://api.rootnet.in/covid19-in/stats/history) onecall json format to action_covid, which then forms a response sentense to be passed back to Rasa.

The user intents, stories and rules are used for training the NLP model. These intent examples cover tens of different ways of asking questions, and explaining to the model how to find the values for the three slots and what is the intent the user has. The stories contain the conversation flows and rules that will stop any conversation and force a different path.

Installation

Installation assumes existing installation of miniconda or anaconda. https://www.anaconda.com/

pip3 & Rasa

Below are the simple steps for creating a virtual environment, install pip3 and Rasa Open Source 2.0.

conda create -n RasaEnv python=3.7.6 
conda activate RasaEnv
conda install -c anaconda pip3
pip3 install rasa==2.8.11  

In case of issue, please refer to Rasa Open Source installation pages: https://rasa.com/docs/rasa/installation/

Creating and initialising a new project:

mkdir rasa
cd rasa
rasa init --no-prompt

This will create a new directlry, under which rasa creates all necessary directories and files.

Replace all files in the rasa directory with the files in the project.

Train the model and run the bot

Train the model with command

rasa train

There are additional actions that need to be started before starting the bot evaluation. These are in actions.py and covid_api.py files. To do so, run below commands on two different terminals:

rasa run actions

Start the discussion with rasabot:

rasa shell

References

- Rasa. (n.d.). Rasa: Open source conversational AI. URL: https://rasa.com

Owner
Aazim Parwaz
I am a 3rd year computer science undergraduate at NIT Srinagar
Aazim Parwaz
DeepAmandine is an artificial intelligence that allows you to talk to it for hours, you won't know the difference.

DeepAmandine This is an artificial intelligence based on GPT-3 that you can chat with, it is very nice and makes a lot of jokes. We wish you a good ex

BuyWithCrypto 3 Apr 19, 2022
An ActivityWatch watcher to pose questions to the user and record her answers.

aw-watcher-ask An ActivityWatch watcher to pose questions to the user and record her answers. This watcher uses Zenity to present dialog boxes to the

Bernardo Chrispim Baron 33 Dec 03, 2022
Cải thiện Elasticsearch trong bài toán semantic search sử dụng phương pháp Sentence Embeddings

Cải thiện Elasticsearch trong bài toán semantic search sử dụng phương pháp Sentence Embeddings Trong bài viết này mình sẽ sử dụng pretrain model SimCS

Vo Van Phuc 18 Nov 25, 2022
Search for documents in a domain through Google. The objective is to extract metadata

MetaFinder - Metadata search through Google _____ __ ___________ .__ .___ / \

Josué Encinar 85 Dec 16, 2022
A framework for evaluating Knowledge Graph Embedding Models in a fine-grained manner.

A framework for evaluating Knowledge Graph Embedding Models in a fine-grained manner.

NEC Laboratories Europe 13 Sep 08, 2022
Text classification is one of the popular tasks in NLP that allows a program to classify free-text documents based on pre-defined classes.

Deep-Learning-for-Text-Document-Classification Text classification is one of the popular tasks in NLP that allows a program to classify free-text docu

Happy N. Monday 2 Mar 17, 2022
使用Mask LM预训练任务来预训练Bert模型。训练垂直领域语料的模型表征,提升下游任务的表现。

Pretrain_Bert_with_MaskLM Info 使用Mask LM预训练任务来预训练Bert模型。 基于pytorch框架,训练关于垂直领域语料的预训练语言模型,目的是提升下游任务的表现。 Pretraining Task Mask Language Model,简称Mask LM,即

Desmond Ng 24 Dec 10, 2022
Code for our paper "Transfer Learning for Sequence Generation: from Single-source to Multi-source" in ACL 2021.

TRICE: a task-agnostic transferring framework for multi-source sequence generation This is the source code of our work Transfer Learning for Sequence

THUNLP-MT 9 Jun 27, 2022
Implementing SimCSE(paper, official repository) using TensorFlow 2 and KR-BERT.

KR-BERT-SimCSE Implementing SimCSE(paper, official repository) using TensorFlow 2 and KR-BERT. Training Unsupervised python train_unsupervised.py --mi

Jeong Ukjae 27 Dec 12, 2022
Use PaddlePaddle to reproduce the paper:mT5: A Massively Multilingual Pre-trained Text-to-Text Transformer

MT5_paddle Use PaddlePaddle to reproduce the paper:mT5: A Massively Multilingual Pre-trained Text-to-Text Transformer English | 简体中文 mT5: A Massively

2 Oct 17, 2021
Official Stanford NLP Python Library for Many Human Languages

Official Stanford NLP Python Library for Many Human Languages

Stanford NLP 6.4k Jan 02, 2023
Code for the ACL 2021 paper "Structural Guidance for Transformer Language Models"

Structural Guidance for Transformer Language Models This repository accompanies the paper, Structural Guidance for Transformer Language Models, publis

International Business Machines 10 Dec 14, 2022
Weakly-supervised Text Classification Based on Keyword Graph

Weakly-supervised Text Classification Based on Keyword Graph How to run? Download data Our dataset follows previous works. For long texts, we follow C

Hello_World 20 Dec 29, 2022
Stuff related to Ben Eater's 8bit breadboard computer

8bit breadboard computer simulator This is an assembler + simulator/emulator of Ben Eater's 8bit breadboard computer. For a version with its RAM upgra

Marijn van Vliet 29 Dec 29, 2022
A crowdsourced dataset of dialogues grounded in social contexts involving utilization of commonsense.

A crowdsourced dataset of dialogues grounded in social contexts involving utilization of commonsense.

Alexa 62 Dec 20, 2022
A2T: Towards Improving Adversarial Training of NLP Models (EMNLP 2021 Findings)

A2T: Towards Improving Adversarial Training of NLP Models This is the source code for the EMNLP 2021 (Findings) paper "Towards Improving Adversarial T

QData 17 Oct 15, 2022
天池中药说明书实体识别挑战冠军方案;中文命名实体识别;NER; BERT-CRF & BERT-SPAN & BERT-MRC;Pytorch

天池中药说明书实体识别挑战冠军方案;中文命名实体识别;NER; BERT-CRF & BERT-SPAN & BERT-MRC;Pytorch

zxx飞翔的鱼 751 Dec 30, 2022
🎐 a python library for doing approximate and phonetic matching of strings.

jellyfish Jellyfish is a python library for doing approximate and phonetic matching of strings. Written by James Turk James Turk 1.8k Dec 21, 2022

This repository contains the code for EMNLP-2021 paper "Word-Level Coreference Resolution"

Word-Level Coreference Resolution This is a repository with the code to reproduce the experiments described in the paper of the same name, which was a

79 Dec 27, 2022
Unsupervised text tokenizer focused on computational efficiency

YouTokenToMe YouTokenToMe is an unsupervised text tokenizer focused on computational efficiency. It currently implements fast Byte Pair Encoding (BPE)

VK.com 847 Dec 19, 2022