Implementing the rule-based chatbot

In this section, we will understand the implementation of the chatbot. This implementation is divided into two parts. You can find this code by visiting: https://github.com/jalajthanaki/Chatbot_Rule_Based:

  • Implementing the conversation flow
  • Implementing RESTful APIs using flask

Implementing the conversation flow

In order to implement the conversation logic, we are writing a separate Python script, so that whenever we need to add or delete some logic it will be easy for us. Here, we create one Python package in which we put this conversation logic. The name of the file is conversationengine.py and it uses JSON, BSON, and re as Python dependencies.

In this file, we have implemented each conversation in the form of ...

Get Machine Learning Solutions now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.