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
0.42857142857142855 // указывает на относительно отрицательное утверждение |
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 Analyzer = natural.SentimentAnalyzer; | |
var stemmer = natural.PorterStemmer; | |
var analyzer = new Analyzer("English", stemmer, "afinn"); | |
// getSentiment ожидает массив строк | |
console.log(analyzer.getSentiment(["I", "don't", "want", "to", "play", "with", "you"])); |
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
sell | |
buy |
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(); |
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
3 | |
3 | |
-1 |
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'); | |
console.log(natural.HammingDistance("karolin", "kathrin", false)); | |
console.log(natural.HammingDistance("karolin", "kerstin", false)); | |
console.log(natural.HammingDistance("short string", "longer string", false)); |
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
[ 'go', 'friend' ] |
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'); | |
natural.PorterStemmer.attach(); | |
console.log("I can see that we are going to be friends".tokenizeAndStem()); |
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
[ 'The', | |
'quick', | |
'brown', | |
'fox', | |
'jumps', | |
'over', | |
'the', | |
'lazy', | |
'dog' ] |
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 tokenizer = new natural.WordTokenizer(); | |
console.log(tokenizer.tokenize("The quick brown fox jumps over the lazy dog")); |