Closed ghost closed 6 years ago
classifier.getClassifications(message)
will return an object with all classifications.
It is the same interface as https://github.com/NaturalNode/natural#classifiers
Hmm, I think I solve it by doing in another way. Thank you anyway.
I'm using this right in https://github.com/mysamai/mysam/blob/master/lib/services/classify/classify.class.js#L40
var BrainJSClassifier = require('natural-brain'); var classifier = new BrainJSClassifier();
classifier.addDocument('my unit-tests failed.', 'software'); classifier.addDocument('tried the program, but it was buggy.', 'software'); classifier.addDocument('tomorrow we will do standup.', 'meeting'); classifier.addDocument('the drive has a 2TB capacity.', 'hardware'); classifier.addDocument('i need a new power supply.', 'hardware'); classifier.addDocument('can you play some new music?', 'music');
classifier.train();
////////SERVER METHOD
'sendToServer':function(message){ var classification = classifier.classify(message); console.log(classification); //=> print classificaiton return classification; //=> return undefined }