Giter Site home page Giter Site logo

nlp_bot_restaurant's Introduction

Restaurant Bot

a restaurant chatbot using open source chat framework RASA. Integrates with Zomato API to fetch restaurant information.

Pre-requisites

  • python 3.7.0
  • rasa 1.1.4
  • spacy 2.1.4
  • en_core_web_md 2.1.0

Installation

RASA

Refer to official installation guide to install RASA

Spacy

  1. Package Installation

    pip install -U spacy
  2. Model Installation

    python -m spacy download en_core_web_md
  3. Create custom shortcut link to Spacy model

    python -m spacy link en_core_web_md en

Repo Information

This repo contains training data and script files necessary to compile and execute this restaurant chatbot. It comprises of the following files:

Data Files

  • data/nlu/nlu.md : contains training examples for the NLU model
  • data/core/stories.md : contains training stories for the Core model

Script Files

  • zomato : contains Zomato API integration code
    • zomato_api.py : contains functions to consume common Zomato APIs like fetch location details, type of cuisines, search for restaurants, etc
    • zomato_test.py : contains 3 test functions for Zomato API - location details, cuisine details and restaurant search
  • action_api_test.py : executes Zomato API test functions from command line
  • actions_server.py : contains code to start a RASA actions server. This is used to serve RASA custom actions.
  • actions.py : contains the following custom actions (insert ZOMATO API key in this script file before starting RASA server)
    • search restaurant
    • validate location
    • validate cuisine
    • send email
    • restart conversation
    • reset slots
  • nlu_test.py : contains code to test generated NLU models
  • nlu_train.py : contains code to
    • train a NLU model
    • persist NLU model in 'models' folder
    • run CLI to interact with generated model and validate extracted intents and entities
  • rasa_slack.py : contains code to integrate with slack channel
  • rasa_train.py : primary script file to test chatbot from CLI. Contains code to:
    • train both NLU and Core model
    • persist packaged model in 'models' folder
    • start CLI interface to interact with chatbot (RASA action server must be running for this to work)

Config Files

  • config.yml contains model configuration and custom policy
  • credentials.yml contains authentication token to connect with channels like slack
  • domain.yml defines chatbot domain like entities, actions, templates, slots
  • endpoints.yml contains the webhook configuration for custom action
  • smtpconfig.txt contains SMTP server configuration information (If using GMAIL, setup account and generate app password) .

Usages

  • Train ONLY NLU model and validate

    python nlu_train.py --shell

    This will generate restaurant-nlu-model.tar.gz inside models folder and start an interactive shell

  • Test generated NLU model (generated NLU model should be available in 'models' folder prior to test). 2 options are available:

    • DEFAULT : separate test set is created
    • VALIDATION : uses cross - validation
    python nlu_test.py --type DEFAULT
    
    python nlu_test.py --type VALIDATION
  • Run RASA action server ( mandatory step to interact with chatbot) on port 5055

    python actions_server.py

    Equivalent RASA CLI command

    rasa run actions
  • Train RASA NLU and Core model

    python rasa_train.py

    This will generate restaurant-rasa-model.tar.gz inside models folder

    Equivalent RASA CLI command

    rasa train
  • Starts an interactive session with restaurant chatbot

    python rasa_train.py --shell

    This step will recreate RASA NLU and Core models

    Equivalent RASA CLI command

    rasa shell
  • Run RASA server to connect slack channel

    rasa run -m models -p 5004 --connctor slack --credentials credentials.yml

nlp_bot_restaurant's People

Contributors

dhrubach avatar rashmi-singh avatar rakeshjr avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.