Hey there,
I’m developing an app (Ionic 3) with a chatbot using AIML. My project goal: The chatbot should ask questions and the user have to answer. That’s the plan. At the moment I’ve one big problem: There’s no working AIML-Interpreter.
I’ve tried to integrate a (npm) node.js module called “aiml-high” (https://www.npmjs.com/package/aiml-high) based on fs module.
A short descrition of my work:
I’ve installed the module with:
npm install aiml-high --save
Then I’ve imported the module in the chat.ts
file with
import aimlHigh from 'aiml-high'
…and now the function:
aimlinterprete() {
var aimlHigh = require('aiml-high');
var interpreter = new aimlHigh ({ name: 'Bot', age: '42' });
interpreter.loadFiles(['anatest.aiml']);
var callback = function(answer, wildCardArray, input) {
console.log(answer + ' | ' + wildCardArray + ' | ' + input);
};
interpreter.findAnswer('What is your name?', callback);
interpreter.findAnswer('My name is Ben.', callback);
interpreter.findAnswer('What is my name?', callback);
}
After running the code with ionic serve
there is always one error:
Runtime Error: fs.readFile is not a function
…so the error is in the interpreter.loadFiles(['anatest.aiml']);
line…but I don’t know what to do now. I’ve tried two other modules simular to “aiml-high” and I got the same error.
Can anyone help me?
Best regards
Rim