Skip to content

Commit

Permalink
docs(README): add more examples
Browse files Browse the repository at this point in the history
  • Loading branch information
sanjayaksaxena committed Nov 16, 2018
1 parent 0efea39 commit 5c18576
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 3 deletions.
29 changes: 29 additions & 0 deletions README.md
Expand Up @@ -29,6 +29,8 @@ var sentiment = require( 'wink-sentiment' );
// Just give any phrase and checkout the sentiment score. A positive score
// means a positive sentiment, whereas a negative score indicates a negative
// sentiment. Neutral sentiment is signalled by a near zero score.

// Positive sentiment text.
sentiment( 'Excited to be part of the @imascientist team:-)!' );
// -> { score: 5,
// normalizedScore: 2.5,
Expand All @@ -45,6 +47,33 @@ sentiment( 'Excited to be part of the @imascientist team:-)!' );
// { value: '!', tag: 'punctuation' }
// ]
// }

// Negative sentiment text.
console.log( sentiment( 'Not a good product :(' ) );
// -> { score: -5,
// normalizedScore: -2.5,
// tokenizedPhrase: [
// { value: 'Not', tag: 'word' },
// { value: 'a', tag: 'word', negation: true },
// { value: 'good', tag: 'word', negation: true, score: -3 },
// { value: 'product', tag: 'word' },
// { value: ':(', tag: 'emoticon', score: -2 }
// ]
// }

// Neutral sentiment text.
console.log( sentiment( 'I will meet you tomorrow.' ) );
// -> { score: 0,
// normalizedScore: 0,
// tokenizedPhrase: [
// { value: 'I', tag: 'word' },
// { value: 'will', tag: 'word' },
// { value: 'meet', tag: 'word' },
// { value: 'you', tag: 'word' },
// { value: 'tomorrow', tag: 'word' },
// { value: '.', tag: 'punctuation' }
// ]
// }
```
Try [experimenting with this example and more on Runkit](https://npm.runkit.com/wink-sentiment) in the browser.

Expand Down
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:33:30 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:44:08 GMT+0530 (IST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>

<script>prettyPrint();</script>
Expand Down
31 changes: 30 additions & 1 deletion docs/index.html
Expand Up @@ -67,6 +67,8 @@ <h3>Installation</h3><p>Use <a href="https://www.npmjs.com/package/wink-sentimen
// Just give any phrase and checkout the sentiment score. A positive score
// means a positive sentiment, whereas a negative score indicates a negative
// sentiment. Neutral sentiment is signalled by a near zero score.

// Positive sentiment text.
sentiment( 'Excited to be part of the @imascientist team:-)!' );
// -> { score: 5,
// normalizedScore: 2.5,
Expand All @@ -82,6 +84,33 @@ <h3>Installation</h3><p>Use <a href="https://www.npmjs.com/package/wink-sentimen
// { value: ':-)', tag: 'emoticon', score: 2 },
// { value: '!', tag: 'punctuation' }
// ]
// }

// Negative sentiment text.
console.log( sentiment( 'Not a good product :(' ) );
// -> { score: -5,
// normalizedScore: -2.5,
// tokenizedPhrase: [
// { value: 'Not', tag: 'word' },
// { value: 'a', tag: 'word', negation: true },
// { value: 'good', tag: 'word', negation: true, score: -3 },
// { value: 'product', tag: 'word' },
// { value: ':(', tag: 'emoticon', score: -2 }
// ]
// }

// Neutral sentiment text.
console.log( sentiment( 'I will meet you tomorrow.' ) );
// -> { score: 0,
// normalizedScore: 0,
// tokenizedPhrase: [
// { value: 'I', tag: 'word' },
// { value: 'will', tag: 'word' },
// { value: 'meet', tag: 'word' },
// { value: 'you', tag: 'word' },
// { value: 'tomorrow', tag: 'word' },
// { value: '.', tag: 'punctuation' }
// ]
// }</code></pre><p>Try <a href="https://npm.runkit.com/wink-sentiment">experimenting with this example and more on Runkit</a> in the browser.</p>
<h3>Documentation</h3><p>Check out the <a href="http://winkjs.org/wink-sentiment/">wink sentiment API</a> documentation to learn more.</p>
<h3>Need Help?</h3><p>If you spot a bug and the same has not yet been reported, raise a new <a href="https://github.com/winkjs/wink-sentiment/issues">issue</a> or consider fixing it and sending a pull request.</p>
Expand All @@ -102,7 +131,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:33:30 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:44:08 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/wink-sentiment.js.html
Expand Up @@ -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:33:30 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:44:08 GMT+0530 (IST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>

<script>prettyPrint();</script>
Expand Down

0 comments on commit 5c18576

Please sign in to comment.