Closed IvanBrasilico closed 7 years ago
Hi @IvanBrasilico, thanks for the pull request. I would like to ask you to break it in small PRs. In this one, you're suggesting not only new patterns but also changes in the internal behavior of bottery itself. The smallest PR, the better.
Also, I believe you have commited your bot together width the changes you proposed.
Again, thank you very much!
I'm closing this since you're breaking this PR in smaller ones.
76
A collection of classes and Patterns that allow to use bottery to do a "rule based" user interface in the command line way, mapping "commands"(sequence of words) to "actions" (http urls for JSON APIs) and parsing parameters also. All with basic unit tests, and an example of implementation on the '/patterns.py' file.
Reads the configuration from a simple dict and makes all the context and flow management.
It is a initial idea, but I have already easily implemented access to a Telegram bot to 3 diferent JSON APIs with it.
Although fancy chatbots do "Natural Language Processing", to do real actions, in the end of the NLP flow we will always have a Softmax classificator that will map "I wanna shop", "I want stuf", "Browse your clothes", and whatever to "catalog list", for example. So im most chatbots the "NLP layer" probably will be on top of a "rule based" layer. I think this could be very useful if improved a litle. In fact, for me, it is already useful.
Needed litle changes on plataform/ that havent breaked back compatibility.
Improvements needed:
An async http request. (Since asyncio needs a chain of async method calls, this improvement needs to be made in the core) Problem already reported in #77
The view probably would be better as an object than a function, with an interface defined so the developer can personalize the parsing of the response (like doing json_to_md or some manual parsing), overriding a "parse_response" method.