classy-classifier
v0.0.1
Published
Bayes classifier
Downloads
1
Readme
Classy
This is a text classifier redesigned to be more modern and hopefully, in the future, faster than it's original version made by miguelmota.
Example Usage
var BayesClassifier = require('bayes-classifier')
var classifier = new BayesClassifier()
var positiveDocuments = [
`I love tacos.`,
`Dude, that burrito was epic!`,
`Holy cow, these nachos are so good and tasty.`,
`I am drooling over the awesome bean and cheese quesadillas.`
]
var negativeDocuments = [
`Gross, worst taco ever.`,
`The buritos gave me horrible diarrhea.`,
`I'm going to puke if I eat another bad nacho.`,
`I'd rather die than eat those nasty enchiladas.`
]
classifier.addDocuments(positiveDocuments, `positive`)
classifier.addDocuments(negativeDocuments, `negative`)
classifier.train()
API
classifier.addDocument(doc, class)
classifier.addDocuments([docs], class)
classifier.train()
classifier.classify(doc)
classifier.getClassifications(doc)
classifier.restore(classifier)
It is licensed with the MIT license