UNPKG

jonbrain

Version:
23 lines (18 loc) 898 B
# JonBrain A brain, like AI in works, but it's not very good yet. In early development so it's not much of an AI :) If you think the old version was easier, it is on github, and you can goto the versions tab :) Added "smart" search function. A few compatibility fixes added. ### Usage: ```javascript let jonbrain = require('jonbrain'); jonbrain.train(["yes",true], test); // trains the input "yes" to output true function test(thing) { // callback function example, JonBrain also returns directly, so you can let response=jonbrain.train(["yes"]); too console.log(thing, response); // you can both use callback and the returned value, they're the same though. } var response = jonbrain.run(["yes"], test, true); // runs the input "yes" and let's the code find the output jonbrain.search(["yes", 4], function(results){ /* top 5 results */ console.log(results[0]); }); ```