From dfe51354c8c1b79a9e003e2a41721cce827d47a6 Mon Sep 17 00:00:00 2001 From: JCharis Jesse Date: Sat, 15 Sep 2018 09:21:49 +0300 Subject: [PATCH] Added NLP with JS - Sentiment Analysis --- NLP with JavaScript/index.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 NLP with JavaScript/index.js diff --git a/NLP with JavaScript/index.js b/NLP with JavaScript/index.js new file mode 100644 index 0000000..71b1ad5 --- /dev/null +++ b/NLP with JavaScript/index.js @@ -0,0 +1,13 @@ +var Sentiment = require('sentiment'); +var sentiment = new Sentiment(); + +var docx = sentiment.analyze("I like apples"); +console.log(docx); + +// Applying to An Array +var mydocx = ["I love apples","I don't eat pepper","the movie was very nice","this book is the best"] + +mydocx.forEach(function(s){ + console.log(sentiment.analyze(s)); +}) +