Code Monkey home page Code Monkey logo

easy-chatbot's Introduction

Created Date: 18 Nov 2018

INSTALLATION:


pip install -r requirements.txt

Python EXECUTION: Run conversation.py to run the bot
Web api EXECUTION: Run bot.py, once it runs, open the link and start chatting with the bot...

DEMO

chatbotgif

Easy Chatbot using AIML

As said in Wikipedia, AIML [Artificial Intelligence Markup Language] is an XML dialect for creating natural language software agents.

These days as you can see that Chatbots are in high trend when it comes to Artificial Intelligence. As most of the organizations have already started implementing chatbots on their sites especially on e-commerce websites. 

Some of the best examples of chatbots are:

  1. Replika
  2. Watson Assistant
  3. Alexa
  4. Dialogflow
  5. Cleverbot

So you want to build a chatbot? No worries! 

We will be using AIML because to build a chatbot using NLP/ML/Deep Learning takes a lot of time to build while AIML helps to build a chatbot easily but the only problem is that you need to feed as many data as you can for the bot to learn and here data doesn't just mean the questions and its category but also the question pattern.

To understand about AIML coding structure, refer to the previous article published: AIML TUTORIAL Hope you know from the previous articles what each tag denotes and how to get started. 

Here you will need 3 files:

1 Python file: conversation.py
2 aiml file: learningFileList.aiml, and conversation.aiml

conversation.py

code for loading and running the bot

learningFilesList.aiml

code to load the files to train

data folder

Data folder contains all the AIML files
Each aiml file contains the conversation patterns which the kernel will load for chatting

Note: Kernel object is the public interface to the AIML interpreter. "learn" method loads the contents of an AIML file into the kernel. While "respond" method is used to get the response from the learned AIML file. And "LEARN AIML" is the pattern that k.respond from conversation.py calls. The tag loads the AIML file to respond.

Demo OUTPUT:

Loading conversation.aiml…done (0.00 seconds)
User > Hello Bot
bot > Hello! Nice to meet you.

easy wasn't it? Add more to categories to the conversation.aiml so that your bot can answer to any questions! You can also make your chatbot to any domain specific like hotel booking, food ordering, flight booking,etc.

Try it out and let me know how it goes 😍

PS:

I added more data from the aiml package which you can get after installing: pip install aiml
HTML template: https://bootsnipp.com/snippets/0e3Ma

easy-chatbot's People

Contributors

pemagrg1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

easy-chatbot's Issues

How to manage discussion threads for multiple concurrent users?

Hi, as a web app (flask) the chatbot can be potentially hit by multiple users at once. Handling variables will not be safe such as: "My name is user 1" then "My name is user 2" will set the final variable as "user 2" even if user 1 continues the dialog.

Is there a technique available to maintain the user context?

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.