I want to know, how is the best way to implement the bot with databases.
The workflow is like this:
- The user makes a question to the bot;
- The bot should searches an answer in the aiml files;
In this moment I want to:
- Specify in the aiml (I think) that, the boot should look for the answer in the database, and show the results;
- Another idea could be, if the bot doesn't find the answers in the aiml, the bot could take a look in the database;
I'm sharing the idea in order to talk about it with you!
Thnaks to spend your time!
The best strategy would be to implement a custom tag that connected to the database to get the information you need.
The following example code should get you started (i.e. this is an example that you need to change to meet your requirements and won't work properly unless you do):
public class databasetag : AIMLTagHandler
this.inputString = "databasetag";
protected override string ProcessChange()
if (this.templateNode.Name.ToLower() == "databasetag")
// Insert your database specific methods here
// e.g. connect to database and run "SELECT address FROM users WHERE surname = this.databasetag.InnerText"
// !!! OBVIOUSLY REMEMBERING TO CHECK FOR SQL INJECTION AND OTHER NASTIES
Hope this helps,
Thanks a lot, it really works good! :)
This is an interesting feature that give a big flexible to the bot.
Thanks a lot again!
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.