-
Notifications
You must be signed in to change notification settings - Fork 188
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
Changes from 1 commit
2176073
65121cf
259b31c
be66e83
8ef394e
d07a3ac
93e9623
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* 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 striped | ||
* HTML text as parameters i.e text containg no tags, and returns a promise | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does "stripped HTML" mean? Do you want plain text or HTML? If the former, I'd say that instead. |
||
* object whcih contains the result | ||
*/ | ||
|
||
var Sentiment = require('sentiment'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Prefer |
||
var sentiment = new Sentiment(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Prefer |
||
|
||
module.exports.startAnalysys = function(blogText){ | ||
jatinAroraGit marked this conversation as resolved.
Show resolved
Hide resolved
|
||
var result; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can be simplified bit: return Promise.resolve(sentiment.analyze(text)); Since this call doesn't throw, we just need to wrap it in a call to |
||
return new Promise(function(resolve,reject){ | ||
result = sentiment.analyze(blogText); | ||
resolve(result); | ||
}); | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo on line 4: "The function accepts striped" should be "The function accepts stripped"
Otherwise looks good 👍 , need to rebase to match the current master branch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @ImmutableBox ,
Resolved this in commit 259b31c