Skip to content

Instantly share code, notes, and snippets.

@jfahrenkrug
Last active December 29, 2022 13:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jfahrenkrug/c5dcd57aa9f35ee28729b4f1032cdcd6 to your computer and use it in GitHub Desktop.
Save jfahrenkrug/c5dcd57aa9f35ee28729b4f1032cdcd6 to your computer and use it in GitHub Desktop.
const Sentiment = require('sentiment')
export class Analyzer {
static analyze(phrase) {
// Make sure nativeLog is defined and is a function
if (typeof nativeLog === 'function') {
nativeLog(`Analyzing '${phrase}'`)
}
let sentiment = new Sentiment()
let result = sentiment.analyze(phrase)
return result['score']
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment