Skip to content

ken-morel/djamago

Repository files navigation

PyPI package Supported Python versions Test Coverage Status Documentation Status Pypi downloads Pypi downloads Pypi downloads

Djamago

djamago logo

Djamago

Hello, i am glad, to present to you djamago! 👏

Djamago is:

  • a python module ✔️
  • a chatbot robot library ✔️
  • my class 3's second classmate name ✔️

Note

Sorry for the emojis, just install a new sublime plugin and really glad test it. I am also fun of letting AI generate titles for me. 😏

Break away from the pack

What make Djamago unique from some other projects like chatbotai or chatterbot:

Unmoor from ML-Imposed Orthodoxy

Sorry, but it is not sort of an AI which you can fine tune in 3 lines of code to chat with your customers 😢 (I don't find the sad emoji, sorry). But that feature makes it pretty simple to run on low performance systems or servers(like a vercel free instance), or with some fixes I will be ready to care of, running on web browsers using brython.js(just made little tests).

Score-Driven Regular Expression Matching for Enhanced Input Validation

Imagine two callbacks, wantto and ishungry. wantto("eat") matches I want to eat, but ishungry matches that to!. In this simple case we could simply check ishungry before wantto, but lets see how djamago does fix.

Djamago uses a score based matching, permiting you to create an expression, e.g greetings, map it to a set of scores to regular expressions, and infer the names. That promotes DRY style permiting your code to be less repetitive.

Example, I could register

Expression.register("question", [
    (100, r"please (.+)\?"),  # perfect match
    (90, r"please (.+)"),  # missing interrogation point!, bit faulty.
    (20, r"(.+)\?"),  # just an interrogation point at the end
])

Expression.register("whatis", [
    (100, r"what is (.+)"),  # perfect match
    (70, r"do you know what is (.+)")  # step backwards
])

and infer them as: question(whatis("my name")) It will check the patterns as given and return the match with tha maximum score on match, or -1.

Enter the Demo Zone

Well, let's now explore the demo and see how it does:

from djamago.demo import cli

cli()

Sponsor this project

Languages