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

Conversation

jatinAroraGit
Copy link
Contributor

@jatinAroraGit jatinAroraGit commented Nov 5, 2019

Fixes #15

The pull request will add the feature of analyzing sentiment of a blog post with the help of a node package called sentiment.
Let me know if there are any issues with it.

@humphd
Copy link
Contributor

humphd commented Nov 6, 2019

@jatinAroraGit can you rebase this please?

/* 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
Copy link
Contributor

@Immutablevoid Immutablevoid Nov 6, 2019

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.

Copy link
Contributor Author

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

Copy link
Contributor

@Immutablevoid Immutablevoid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍 , need to rebase to match the current master branch.

@jatinAroraGit
Copy link
Contributor Author

Hey there,
The branch is now up to date with the upstream/master.

Copy link
Contributor

@humphd humphd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good. I left a few comments.

* 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 stripped
* HTML text as parameters i.e text containg no tags, and returns a promise
Copy link
Contributor

Choose a reason for hiding this comment

The 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');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer const to var

*/

var Sentiment = require('sentiment');
var sentiment = new Sentiment();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer const here too, and also, let's move this into your function below so we don't reuse this between runs. If there's any shared state between runs, we'll get into weird bugs.

src/sentiment-analysis.js Outdated Show resolved Hide resolved
var sentiment = new Sentiment();

module.exports.startAnalysys = function(blogText){
var result;
Copy link
Contributor

Choose a reason for hiding this comment

The 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 resolve

jatinAroraGit and others added 2 commits November 6, 2019 21:36
Adds async function.

Co-Authored-By: David Humphrey <david.humphrey@senecacollege.ca>
@jatinAroraGit
Copy link
Contributor Author

Hey @humphd ,
Let me know if 8ef394e resolves the comments.

@Immutablevoid
Copy link
Contributor

Immutablevoid commented Nov 7, 2019

Sorry @jatinAroraGit going to have to rebase because #55 was merged. Should only need to fix package.json file.

Copy link
Contributor

@humphd humphd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the package-lock.json is out of sync. Since it gets auto-generated, you can rebase and then run npm install to have it update your dependencies and rewrite the lock file.

*/

module.exports.run = async function (text) {
const Sentiment = require('sentiment');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line needs to go above: we only want to require this once, not every call to run(). The next line, where you create an instance, is what I wanted in here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still not fixed. Move line 10 out of this function, and above like you had it before.

@birtony birtony changed the title Fixes #15. Added new file sentiment-analysis.js. Added dependencies Fixes #15: Added new file sentiment-analysis.js. Added dependencies Nov 7, 2019
Copy link
Contributor

@humphd humphd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should get some tests for this. Can you file another issue to add them?

@humphd humphd merged commit a9a2ce8 into Seneca-CDOT:master Nov 9, 2019
menghif pushed a commit to menghif/telescope that referenced this pull request Mar 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement sentiment analysis of blog posts
4 participants