Skip to content

Instantly share code, notes, and snippets.

@RinatValiullov
Last active December 3, 2019 11:30
Show Gist options
  • Save RinatValiullov/8b3331d76253fa354aa7a899baf8da8c to your computer and use it in GitHub Desktop.
Save RinatValiullov/8b3331d76253fa354aa7a899baf8da8c to your computer and use it in GitHub Desktop.
For translation of article "Natural language processing for Node.js" - https://bit.ly/2QZsts1
// 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"]));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment