keiffster / program-y

Python 3.x based AIML 2.0 Chatbot interpreter, framework, related programs and knowledge files
https://keiffster.github.io/program-y/
Other
348 stars 138 forks source link

V4.0 is coming #248

Closed keiffster closed 4 years ago

keiffster commented 4 years ago

V4.0 is coming soon

As documented before I set out to create a code base that could be used in production systems. I have been running nosetests, pytype and pylint over and over the code fixing any issues. This has result in code that is rather Pep compliant, also has no type issues and has had an additional 1700 unit tests added. The core system now stands at 99% code coverage, and the entire system measures in at 96%. Its been fun, but not the only thing to be added

One of the biggest queries is how to add a bot to your own code. You can now do this with 2 lines of code, yes 2 lines of code. After an installation via pip

pip install programy

You can now add a bot to you code as follows

from programy.clients.embed.basic import EmbeddedBasicBot

 my_bot = EmbeddedBasicBot()

print("Response = %s" % my_bot.ask_question("Hello"))

And thats it, it loads a predefined set of grammars as close to Y-bot as possible, and you are can ask it as many questions as you like

If you then want to add you own files, it takes 1 additional line, yes 1.

from programy.clients.embed.basic import EmbeddedBasicBot

files = {'aiml': ['y-bot/storage/categories'],
         'learnf': ['y-bot/storage/learnf'],
         'patterns': 'y-bot/storage/nodes/pattern_nodes.conf',
         'templates': 'y-bot/storage/nodes/template_nodes.conf',
         'properties': 'y-bot/storage/properties/properties.txt',
         'defaults': 'y-bot/storage/properties/defaults.txt',
         'sets': ['y-bot/storage/sets'],
         'maps': ['y-bot/storage/maps'],
         'rdfs': ['y-bot/storage/rdfs'],
         'denormals': 'y-bot/storage/lookups/denormal.txt',
         'normals': 'y-bot/storage/lookups/normal.txt',
         'genders': 'y-bot/storage/lookups/gender.txt',
         'persons': 'y-bot/storage/lookups/person.txt',
         'person2s': 'y-bot/storage/lookups/person2.txt',
         'regexes': 'y-bot/storage/regex/regex-templates.txt',
         'spellings': 'y-bot/storage/spelling/corpus.txt',
         'preprocessors': 'y-bot/storage/processing/preprocessors.conf',
         'postprocessors': 'y-bot/storage/processing/postprocessors.conf',
         'postquestionprocessors': 'y-bot/storage/processing/postquestionprocessors.conf'
         }

my_bot = EmbeddedDataFileBot(files)

print("Response = %s" % my_bot.ask_question("Hello"))

Ok, so the big blob of Jason is more than one line, but you can now pass in a series of data files and they will be loaded and you can then just ask it questions

ohoachuck commented 4 years ago

👍

Envoyé de mon iPhone

Le 20 déc. 2019 à 21:34, Keith Sterling notifications@github.com a écrit :

 V4.0 is coming soon

As documented before I set out to create a code base that could be used in production systems. I have been running nosetests, pytype and pylint over and over the code fixing any issues. This has result in code that is rather Pep compliant, also has no type issues and has had an additional 1700 unit tests added. The core system now stands at 99% code coverage, and the entire system measures in at 96%. Its been fun, but not the only thing to be added

One of the biggest queries is how to add a bot to your own code. You can now do this with 2 lines of code, yes 2 lines of code. After an installation via pip

pip install programy You can now add a not to you code as follows

from programy.clients.embed.basic import EmbeddedBasicBot

my_bot = EmbeddedBasicBot()

print("Response = %s" % my_bot.ask_question("Hello")) And thats it, it loads a predefined set of grammars as close to Y-bot as possible, and you are can ask it as many questions as you like

If you then want to add you own files, it takes 1 additional line, yes 1.

from programy.clients.embed.basic import EmbeddedBasicBot

files = {'aiml': ['y-bot/storage/categories'], 'learnf': ['y-bot/storage/learnf'], 'patterns': 'y-bot/storage/nodes/pattern_nodes.conf', 'templates': 'y-bot/storage/nodes/template_nodes.conf', 'properties': 'y-bot/storage/properties/properties.txt', 'defaults': 'y-bot/storage/properties/defaults.txt', 'sets': ['y-bot/storage/sets'], 'maps': ['y-bot/storage/maps'], 'rdfs': ['y-bot/storage/rdfs'], 'denormals': 'y-bot/storage/lookups/denormal.txt', 'normals': 'y-bot/storage/lookups/normal.txt', 'genders': 'y-bot/storage/lookups/gender.txt', 'persons': 'y-bot/storage/lookups/person.txt', 'person2s': 'y-bot/storage/lookups/person2.txt', 'regexes': 'y-bot/storage/regex/regex-templates.txt', 'spellings': 'y-bot/storage/spelling/corpus.txt', 'preprocessors': 'y-bot/storage/processing/preprocessors.conf', 'postprocessors': 'y-bot/storage/processing/postprocessors.conf', 'postquestionprocessors': 'y-bot/storage/processing/postquestionprocessors.conf' }

my_bot = EmbeddedDataFileBot(files)

print("Response = %s" % my_bot.ask_question("Hello")) Ok, so the big blob of Jason is more than one line, but you can now pass in a series of data files and they will be loaded and you can then just ask it questions

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

Harmon758 commented 4 years ago

Will version 4.0 include the restructuring mentioned in #221?

keiffster commented 4 years ago

Not quite, as I've described in previous posts 4.0 is the base for all future work. with refactoring complete and unit test coverage at an all time high ( 96% overall, with core at 99% ) its in a place that the split can now start.

The intention is to split all clients out in 4.1, this will create 2 package programy-core and programy-clients. Core will include console, webchat and rest ( flask & sanic ), with Clients containing all the clients to date, post this release I'll start split clients into individual packages ( Slack, Facebook ,Alex etc )

In the meantime, I will be splitting out Extensions into seperate packages, ( Energy, Telecoms, Banking, etc ) these will be named programy-ext-xxxx,

The intent is to be in a place by v5.0 that we have core, clients and extension packages all seperated out into their own pypi installs

I'm also working on AIPL language which is a personal project along with a new bot which is the most advanced bot I have worked on, designed to use all of AIML and Programy features