Skip to content

Commit

Permalink
Fixes #15: Added new file sentiment-analysis.js. Added dependencies (#46
Browse files Browse the repository at this point in the history
)

* Fixes #15. Added new file sentiment-analysis.js. Added dependencies

* Fixed Typo in comments

* Update src/sentiment-analysis.js

Adds async function.

Co-Authored-By: David Humphrey <david.humphrey@senecacollege.ca>

* Replaced var with const, updated function.

* Updated sentiment-analysis.js
  • Loading branch information
jatinAroraGit authored and humphd committed Nov 9, 2019
1 parent 8e16281 commit a9a2ce8
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"bent": "^7.0.2",
"bull": "^3.11.0",
"dotenv": "^8.2.0",
"feedparser-promised": "^2.0.1"
"feedparser-promised": "^2.0.1",
"sentiment": "^5.0.2"
},
"devDependencies": {
"eslint": "^6.6.0",
Expand Down
13 changes: 13 additions & 0 deletions src/sentiment-analysis.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/* This file contains the code for analyzing blog posts text to identify the
* negative or positve words being used in a post and return a summary of it
* along with a score. The file uses a node module called sentiment to implement
* the functionality of analyzing text of blogs. The function accepts plain
* text as a parameter i.e text containg no HTML tags, and returns a promise
* object whcih contains the result.
*/
const Sentiment = require('sentiment');

module.exports.run = async function (text) {
const sentiment = new Sentiment();
return Promise.resolve(sentiment.analyze(text));
};

0 comments on commit a9a2ce8

Please sign in to comment.