Skip to content

Commit

Permalink
feat: round normaized score to 4 decimal places
Browse files Browse the repository at this point in the history
  • Loading branch information
sanjayaksaxena committed Nov 16, 2018
1 parent 38ccc82 commit 0efea39
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/global.html
Expand Up @@ -327,7 +327,7 @@ <h5>Returns:</h5>
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Nov 16 2018 16:28:17 GMT+0530 (IST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Nov 16 2018 16:33:30 GMT+0530 (IST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>

<script>prettyPrint();</script>
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Expand Up @@ -102,7 +102,7 @@ <h3>Copyright &amp; License</h3><p><strong>wink-sentiment</strong> is copyright
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Nov 16 2018 16:28:17 GMT+0530 (IST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Nov 16 2018 16:33:30 GMT+0530 (IST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>

<script>prettyPrint();</script>
Expand Down
4 changes: 2 additions & 2 deletions docs/wink-sentiment.js.html
Expand Up @@ -239,7 +239,7 @@ <h1 class="page-title">wink-sentiment.js</h1>
// Return score and its normalized value.
return {
score: ( ss + hss ),
normalizedScore: normalize( hss, ss, sentiHashtags, sentiWords, words ),
normalizedScore: +( normalize( hss, ss, sentiHashtags, sentiWords, words ) ).toFixed( 4 ),
tokenizedPhrase: tokenizedPhrase
};
}; // sentiment()
Expand All @@ -259,7 +259,7 @@ <h1 class="page-title">wink-sentiment.js</h1>
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Nov 16 2018 16:28:17 GMT+0530 (IST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Nov 16 2018 16:33:30 GMT+0530 (IST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>

<script>prettyPrint();</script>
Expand Down
2 changes: 1 addition & 1 deletion src/wink-sentiment.js
Expand Up @@ -196,7 +196,7 @@ var sentiment = function ( phrase ) {
// Return score and its normalized value.
return {
score: ( ss + hss ),
normalizedScore: normalize( hss, ss, sentiHashtags, sentiWords, words ),
normalizedScore: +( normalize( hss, ss, sentiHashtags, sentiWords, words ) ).toFixed( 4 ),
tokenizedPhrase: tokenizedPhrase
};
}; // sentiment()
Expand Down
4 changes: 2 additions & 2 deletions test/wink-sentiment-specs.js
Expand Up @@ -150,7 +150,7 @@ describe( 'sentiment', function () {
it( 'should return a score of 8/2.6666666666666665 with "love you<3 :)"', function () {
expect( ws( 'love you<3 :)' ) ).to.deep.equal( {
score: 8,
normalizedScore: 2.6666666666666665,
normalizedScore: 2.6667,
tokenizedPhrase: [
{ value: 'love', tag: 'word', score: 3 },
{ value: 'you', tag: 'word' },
Expand Down Expand Up @@ -306,7 +306,7 @@ describe( 'sentiment', function () {
// This will trigger condition when # words > 15 (average sentence length).
expect( ws( 'Sound quality on both end is excellent, I use headset to call my wife and ask my wife to use headset to call me!' ) ).to.deep.equal( {
score: 5,
normalizedScore: 1.976423537605237,
normalizedScore: 1.9764,
tokenizedPhrase: [
{ value: 'Sound', tag: 'word' },
{ value: 'quality', tag: 'word', score: 2 },
Expand Down

0 comments on commit 0efea39

Please sign in to comment.