- dom-js
- random-js
- This is a self-project solely for Nodejs only.
- Installation of these dependencies: 'dom-js' and 'random-js'
- Make sure you have Nodejs installed on your Operating System.
- Clone or Download the Package.
- On your command prompt, goto the directory and type 'npm install'.
- You can open the 'demo.js' to see a sample code.
- Store your .aiml files in a folder called 'aiml' in the same directory as your running code.
- Example, if I am writing a code aimlbot.js on C:/test/
- Add a aiml folder such that the directory becomes C:/test/aiml/
- Add all your test1.aiml, test.aiml into the directory C:/test/aiml/
- To use this API, you can type these to your code headers:
var AIMLParser = require('./path/.../AIMLParser');
var aiml = new AIMLParser({name:'bot name', age:'bot age'});
var isLoaded = false;
var callback = function(){
// do nothing
};
//loading the AIML files
aiml.load(function(){
isLoaded = true;
});
var yourFunction = function(message, inputStr, replyMessage, callback){
while(!isLoaded){
var message = aiml.reply(message, callback);
// ... use message here
}
};
// you can use a reply wrapper and set a timeout if you want to have continuous reply stream.