Last active
December 2, 2019 06:04
-
-
Save RinatValiullov/7defb6e204bddba9e7b5ad36f3b3ca79 to your computer and use it in GitHub Desktop.
For translation of article "Natural language processing for Node.js" - https://bit.ly/2QZsts1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// index.js | |
var natural = require('natural'); | |
var classifier = new natural.BayesClassifier(); | |
classifier.addDocument('i am long qqqq', 'buy'); | |
classifier.addDocument('buy the q\'s', 'buy'); | |
classifier.addDocument('short gold', 'sell'); | |
classifier.addDocument('sell gold', 'sell'); | |
classifier.train(); | |
console.log(classifier.classify('i am short silver')); | |
console.log(classifier.classify('i am long copper')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment