/chatbot-grammatical-framework

Web-based chatbot using Grammatical Framework

Primary LanguageCSS

SUBWAY CHATBOT

When it comes to implementing a chatbot that will be used in real life, developers usually construct a work flow of which questions the chatbot has to ask the user to acquire adequate information that can lead to a decision or action.

However, taking the advantage of variants parameter - a feature of Grammatical Framework, we can instruct the chatbot to construct its work flow without explicit step-by-step declaration.

This repo is to demonstrate that feature with a web-based chatbot for customers to order Subway.

Disclaimer: this work has nothing to do with Subway at all, except the fact that I ate their sandwiches a lot during my MSc 1st year.

Installation

Prerequisites

sudo apt-get install autoconf automake libtool make
sudo apt-get install python python-pip python-dev
sudo apt-get install virtualenv

GF

Download GF lib from http://www.grammaticalframework.org/download/gf_3.8-1_amd64.deb (64-bit) or http://www.grammaticalframework.org/download/gf_3.8-1_i386.deb (32-bit)

Install GF

sudo dpkg -i gf_3.8-1_amd64.deb

Create a virtual environment

virtualenv --no-site-packages -p python2 env
source ./env/bin/activate

Install GF Python API

git clone git@github.com:GrammaticalFramework/GF.git
cd src/runtime/c/
autoreconf -i
./configure
make
make install
cd ../python
python setup.py build
python setup.py install
cd ../../../..

Python packages

pip install requirements.txt

Demo

Run the chatbot

python app.py

Demo

Acknowledgements