AIML Interpreter written in node.js
AIMLInterpreter is a module that allows you to parse AIML files and to find the correct answer to a given message.
Installation
$ npm install aimlinterpreter
Dependencies
fs dom-js
AIMLInterpreter = require('./AIMLInterpreter');
var aimlInterpreter = new AIMLInterpreter({name:'WireInterpreter', age:'42'});
aimlInterpreter.loadAIMLFilesIntoArray(['./test.aiml.xml']);
var callback = function(answer, wildCardArray, input){
console.log(answer + ' | ' + wildCardArray + ' | ' + input);
};
aimlInterpreter.findAnswerInLoadedAIMLFiles('What is your name?', callback);
aimlInterpreter.findAnswerInLoadedAIMLFiles('My name is Ben.', callback);
aimlInterpreter.findAnswerInLoadedAIMLFiles('What is my name?', callback);
<bot name="NAME"/> <get name="NAME"/> <set name="NAME">TEXT</set> <random><li>A</li><li>B</li><li>C</li></random> <srai>PATTERN TEXT</srai> <sr/> <star/> <that>TEXT</that> <condition name="NAME" value="VALUE">TEXT</condition> <condition><li name="NAME" value="VALUE">TEXT</li><li name="NAME" value="VALUE">TEXT</li><li>TEXT</li></condition> <condition name="NAME"><li value="VALUE">TEXT</li><li value="VALUE">TEXT</li><li>TEXT</li></condition> <think><set name="NAME">TEXT</set></think> <anyElement/><random><li>A</li><li>B</li><li>C</li></random><anyElement/> <random><li><think><set name="NAME">TEXT</set></think></li><li>B</li></random> <random><li><srai>PATTERN TEXT</srai></li><li>B</li></random> <condition name="NAME" value="VALUE"><srai>PATTERN TEXT</srai></condition> <condition><li name="NAME" value="VALUE"><srai>PATTERN TEXT</srai></li><li name="NAME" value="VALUE">TEXT</li></condition> <condition name="NAME"><li value="VALUE"><srai>PATTERN TEXT</srai></li><li value="VALUE">TEXT</li></condition>
Contributors
Special thanks go to Sergio Rodriguez (https://github.com/sergiorodez), who contributed to the interpreter and enhanced its functionalities