'use strict';
const TextClassifier = require('text-classifier');
let classifier = new TextClassifier;
let classifier = new TextClassifier({
replacers: [
[/[\-_]+/g, ' '],
[/[^\w\d\s]+/g, ''],
]
});
classifier.learn('amazing, awesome movie!! Yeah!! Oh boy.', 'positive');
classifier.learn('Sweet, this is incredibly, amazing, perfect, great!!', 'positive');
classifier.learn('terrible, shitty thing. Damn.', 'negative');
classifier.learn([
'amazing, awesome movie!! Yeah!! Oh boy.',
'Sweet, this is incredibly, amazing, perfect, great!!'
], 'positive');
classifier.learn('terrible, shitty thing. Damn.', 'negative');
classifier.learn({
'amazing, awesome movie!! Yeah!! Oh boy.': 'positive',
'Sweet, this is incredibly, amazing, perfect, great!!': 'positive',
'terrible, shitty thing. Damn.': 'negative'
});
classifier.classify('awesome, cool, amazing!! Yay.');
classifier.toJSON();
classifier.load(jsonOrObject);