Giter Club home page Giter Club logo

chatbot-1's Introduction

Chatbot

Python chatbot

from chatbot import Chat,reflections,multiFunctionCall
import wikipedia

def whoIs(query,sessionID="general"):
    try:
        return wikipedia.summary(query)
    except:
        for newquery in wikipedia.search(query):
            try:
                return wikipedia.summary(newquery)
            except:
                pass
    return "I don't know about "+query
        
call = multiFunctionCall({"whoIs":whoIs})
firstQuestion="Hi, how are you?"
Chat("examples/Example.template", reflections,call=call).converse(firstQuestion)

For Detail on how to build Facebook messenger bot checkout Facebook Integration.ipynb

For Jupyter notebook Chatbot checkout Infobot built using NLTK-Chatbot

Sample Apps

  1. A sample facebook messenger bot built using messengerbot, Django and NLTK-Chatbot is available here Facebook messenger bot
  2. A sample microsoft bot built using Microsoft Bot Connector Rest API - v3.0, Django and NLTK-Chatbot is available here Micosoft Chatbot

List of feature supported in bot template

  1. Memory
  2. Get matched group
  3. Recursion
  4. Condition
  5. Change Topic
  6. Interact with python function
  7. Execute shell script
  8. Topic based group
  9. Learn
  10. To upper case
  11. To lower case
  12. Capitalize
  13. Previous

Memory

Set Memory

{ variable : value }

In think mode

{! variable : value }


#### Get Memory
> ```
{ variable }

Get matched group

Get Nth matched group of client pattern

%N

Example to get first matched
> ```
%1

Get Nth matched group of bots pattern

%!N

Example to get first matched
> ```
%!1

Recursion

Get response as if client said this new statement

{% chat statement %}

It will do a pattern match for statement

Condition

{% if condition %} do this first {% elif condition %} do this next {% else %} do otherwise {% endif %}


## Change Topic
> ```
{% topic TopicName %}

Interact with python function

{% call functionName: value %}


## Execute shell script
> ```
[ cmd ]

Execute command in think mode

[! cmd ]


## Topic based group 
>```
{% group topicName %}
  {% block %}
      {% client %}client says {% endclient %}
      {% response %}response test% endresponse %}
  {% endblock %}
  ...
{% endgroup %}

Learn

{% learn %} {% group topicName %} {% block %} {% client %}client says {% endclient %} {% response %}response test% endresponse %} {% endblock %} ... {% endgroup %} ... {% endlearn %}


# To upper case
>```
{% up string %}

To lower case

{% low string %}


# Capitalize
>```
{% cap string %}

Previous

{% block %} {% client %}client's statement pattern{% endclient %} {% prev %}previous bot's statement pattern{% endprev %} {% response %}response string{% endresponse %} {% endblock %}

chatbot-1's People

Contributors

ahmadfaizalbh avatar bhava08 avatar

Watchers

James Cloos 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.