Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
var _ = require('lodash');
var natural = require('natural'),
classifier = new natural.BayesClassifier();
// First item denotes "changed motor oil"
var notes = [
[true, 'Change oil, oil filter, air filter, spark plugs'],
[true, 'Change oil, oil filter. 4qt Rotella T6, 0.5 Mobil 1 5W-40'],
[false, 'Change gearbox oil, rear drive oil, valve adjustment, torque heads'],
[false, 'Change transmission oil'],
[false, 'Change headlight fluid']
_.each(notes, function(n) {
classifier.addDocument(n[1], (n[0] ? 'changed motor oil' : ''));
classifier.classify('Change power steering fluid')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment