Giter Site home page Giter Site logo

Comments (3)

ahmadfaizalbh avatar ahmadfaizalbh commented on June 5, 2024

Learn tag usage Example:

{% block %}
    {% client %}Remember (?P<object>.*) (?P<description>(is|are) .*){% endclient %}
    {% response %}I will remember that %object %description {% endresponse %}
    {% learn %}
      {% group %}
        {% block %}
            {% client %}(Do you know|tell me) about %object{% endclient %}
            {% response %}%object %description{% endresponse %}
        {% endblock %}
      {% endgroup %}
    {% endlearn %}
{% endblock %}

when above is present in your templates you could have sample conversation as follows
screenshot png

from chatbot.

ahmadfaizalbh avatar ahmadfaizalbh commented on June 5, 2024

Topic based groups are used when you are building chatbot that has multiple topics and sub topics to handle for example lets say you are building bot that needs to answer about movies, travel and with in movie you have sub topic such as Bollywood, Hollywood, ... etc. Then your template would look as follows.

{% block %}
    {% client %}can we discuss about movie{% endclient %}
    {% response %}Sure why not. {% topic Movie %}{% endresponse %}
{% endblock %}
{% block %}
    {% client %}can we discuss about travel{% endclient %}
    {% response %}Sure why not. {% topic Travel %}{% endresponse %}
{% endblock %}
{% block %}
    {% client %}can we discuss about (?P<movie_industry>(b|h)ollywood){% endclient %}
    {% response %}Sure why not. {% topic Movie.{% cap %movie_industry %} %}{% endresponse %}
{% endblock %}
{% group Travel %}
    {% block %}
        {% client %}Regex{% endclient %}
        {% response %} Response{% endresponse %}
    {% endblock %}
    {% block %}
        {% client %}Regex{% endclient %}
        {% response %} Response{% endresponse %}
    {% endblock %}
    ...
{% endgroup %}
{% group Movie %}
    {% block %}
        {% client %}Regex{% endclient %}
        {% response %} Response{% endresponse %}
    {% endblock %}
    {% group Hollywoood %}
        {% block %}
            {% client %}Regex{% endclient %}
            {% response %} Response{% endresponse %}
        {% endblock %}
        ...
    {% endgroup %}
    {% group Bollywoood %}
        {% block %}
            {% client %}Regex{% endclient %}
            {% response %} Response{% endresponse %}
        {% endblock %}
        ...
    {% endgroup %}
    ...
{% endgroup %}

Let's say topic is Movie.Bollywoood then first it will try solving as per block definitions under Movie.Bollywoood if none satisfies then it would try with group Movie when even that is not able to handle default group is taken.

from chatbot.

mordi-d avatar mordi-d commented on June 5, 2024

Thank you very much
sorry for the delay

from chatbot.

Related Issues (20)

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.