Skip to content

Instantly share code, notes, and snippets.

@ismaelc
Last active February 5, 2021 19:33
Show Gist options
  • Save ismaelc/e63c9ed36e57e76fa07265a1889d41a6 to your computer and use it in GitHub Desktop.
Save ismaelc/e63c9ed36e57e76fa07265a1889d41a6 to your computer and use it in GitHub Desktop.
ml-classify-text-js-sample
let positive = [
'This is great, so cool!',
'Wow, I love it!',
'It really is amazing',
]
let negative = [
'This is really bad',
'I hate it with a passion',
'Just terrible!',
]
classifier.train(positive, 'positive')
classifier.train(negative, 'negative')
predictions = classifier.predict('It sure is pretty great!')
//positive (0.5423261445466404)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment