Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 7 commits into from
Nov 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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));
};