Fingers on my neck / Smell of someone else's hair / I just want a hug
2
   
Award
Favorite
Favorited
Unfavorite
Download
"const fs = require('fs');
const Burly = require('burlyy');
const bot = new Burly({
defaultResponse: "I don't know what you're on about.",
name: 'Botto'
});
var aiml_files = [
'reduction0.safe.aiml',
'reduction1.safe.aiml',
'reduction2.safe.aiml',
'reduction3.safe.aiml',
'reduction4.safe.aiml',
'mp0.aiml',
'mp1.aiml',
'mp2.aiml',
'mp3.aiml',
'mp4.aiml',
'mp5.aiml',
'mp6.aiml',
];
//aiml_files = aiml_files.concat(
// fs.readdirSync('aiml-en-us-foundation-alice/').map(file => 'aiml-en-us-foundation-alice/'+file));
aiml_files = fs.readdirSync('aiml/').map(file => 'aiml/'+file);
var prompt = 'You: ';
(function load_aiml_files(f = 0) {
if (f != aiml_files.length) {
bot.loadFile(aiml_files[f]).then(() => {
console.log('loading file: ' + aiml_files[f]);
load_aiml_files(f+1);
});
} else {
console.log(`${bot.name}: Hello! Type quit to quit or /help for unhelpful help.`);
process.stdout.write(prompt);
process.stdin.on('data', data => {
let sentence = data.toString().replace(/\r?\n/g, '');
if (sentence === 'quit' || sentence === 'exit') {
console.log('Yeah, ♥♥♥♥ off.');
process.exit();
}
bot.talk(sentence).then(res => {
console.log(`${bot.name}: ${res}`);
process.stdout.write(prompt);
}).catch(err => {
console.error(`\n\nSome ♥♥♥♥ happened.\n${err.stack}`);
process.exit(1);
});
});
}
})();
//##############################################################################
var aimlHigh = require('aiml-high');
var interpreter = new aimlHigh({name:'Bot', age:'42'}, 'Goodbye');
var aiml_files = [
'reduction0.safe.aiml',
'reduction1.safe.aiml',
'reduction2.safe.aiml',
'reduction3.safe.aiml',
'reduction4.safe.aiml',
'mp0.aiml',
'mp1.aiml',
'mp2.aiml',
'mp3.aiml',
'mp4.aiml',
'mp5.aiml',
'mp6.aiml',
];
aiml_files = aiml_files.concat(
fs.readdirSync('aiml-en-us-foundation-alice/').map(file => 'aiml-en-us-foundation-alice/'+file));
console.log(aiml_files);
interpreter.loadFiles(aiml_files);
console.log('loaded');
var callback = function(answer, wildCardArray, input){
console.log(answer + ' | ' + wildCardArray + ' | ' + input);
};
setTimeout(function() { interpreter.findAnswer('hello', callback); }, 2000);
//##############################################################################
const fs = require('fs');
var pkg = require('./package.json');
var Surly = require('./src/Surly');
var conf = {
brain: ''
};
var bot = new Surly({
brain: conf.brain
});
var aiml_files = [
'reduction0.safe.aiml',
'reduction1.safe.aiml',
'reduction2.safe.aiml',
'reduction3.safe.aiml',
'reduction4.safe.aiml',
'mp0.aiml',
'mp1.aiml',
'mp2.aiml',
'mp3.aiml',
'mp4.aiml',
'mp5.aiml',
'mp6.aiml',
];
aiml_files = aiml_files.concat(
fs.readdirSync('aiml-en-us-foundation-alice/').map(file => 'aiml-en-us-foundation-alice/'+file));
console.log(aiml_files);
var prompt = 'You: ';
(function load_aiml_files(f = 0) {
if (f == aiml_files.length) {
console.log('loading file: ' + aiml_files[f]);
bot.loadFile(aiml_files[f], function(err, response) {
load_aiml_files(f+1);
});
} else {
console.log(`${bot.name}: Hello! Type quit to quit or /help for unhelpful help.`);
process.stdout.write(prompt);
process.stdin.on('data', data => {
let sentence = data.toString().replace(/\r?\n/g, '');
if (sentence === 'quit' || sentence === 'exit') {
console.log('Yeah, ♥♥♥♥ off.');
process.exit();
}
bot.talk(sentence, function (err, response) {
console.log('Surly: ' + response);
process.stdout.write(prompt);
});
});
}
})();"
1 Comments
🥱💤only sleep😴🛌 21 May, 2020 @ 1:06pm 
:brfire: