npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

sentiword

v0.0.1

Published

SentiWordNet based sentiment analysis for node.js focusing on accuracy and POS analysis.

Readme

SentiWord

SentiWordNet based sentiment analysis for node.js focusing on accuracy and POS analysis.

SentiWord is a sentiment analysis module for node.js that uses SentiWordNet to determine a words sentiment. Since SentiWordNet has words classified by POS, this module first runs the input text through the node.js module pos to more accurately determine the sentiment of words within sentences based on their actual pos. To improve accuracy, only words that can be identified within their proper POS tag are used, therefore if a word is used and tagged as a verb, if it has no sentiment value when used as a verb within SentiWordNet, it won't be evaluated.

Changes to SentiWordNet

In standard form, SentiWordNet has synonyms grouped together with one sentiment value for a group of words. That makes lookup of individual words slightly more difficult especially when taking into account POS. To fix this for this module, SentiWordNet was changed to different lists of words based on their pos (verb, noun, adverb, etc.). These lists were then ordered alphabetically with one object per word (instead of one object and sentiment value for many words as is standard for SentiWordNet). These changes don't alter the sentiment values for each word within SentiWordNet whatsoever.

Installation

npm install sentiword

Usage


var sw = require('sentiword');

var ex = sw("It is a truth universally acknowledged, that a single man in possession of a good fortune, must be in want of a wife. However little known the feelings or views of such a man may be on his first entering a neighbourhood, this truth is so well fixed in the minds of the surrounding families, that he is considered the rightful property of some one or other of their daughters.");

/** Result:
ex = { sentiment: 0.25,
  avgSentiment: 0.013157894736842105,
  objective: 17.75,
  positive: 0.75,
  negative: 0.5,
  ngrams:
   [ 'truth',
     'single',
     'man',
     'possession',
     'good',
     'fortune',
     'be',
     'wife',
     'little',
     'such',
     'man',
     'be',
     'first',
     'neighbourhood',
     'truth',
     'rightful',
     'property',
     'one',
     'other' ],
  words:
   [ { '# POS': 'n',
       ID: '11350705',
       PosScore: '0',
       NegScore: '0',
       SynsetTerms: 'truth' },
     { '# POS': 'a',
       ID: '493460',
       PosScore: '0',
       NegScore: '0',
       SynsetTerms: 'single' },
     { '# POS': 'n',
       ID: '10288516',
       PosScore: '0',
       NegScore: '0',
       SynsetTerms: 'man' },
     { '# POS': 'n',
       ID: '14407795',
       PosScore: '0',
       NegScore: '0',
       SynsetTerms: 'possession' },
     { '# POS': 'a',
       ID: '1068306',
       PosScore: '0.375',
       NegScore: '0.125',
       SynsetTerms: 'good' },
     { '# POS': 'n',
       ID: '13370938',
       PosScore: '0',
       NegScore: '0',
       SynsetTerms: 'fortune' },
     { '# POS': 'v',
       ID: '2744820',
       PosScore: '0',
       NegScore: '0',
       SynsetTerms: 'be' },
     { '# POS': 'n',
       ID: '10780632',
       PosScore: '0',
       NegScore: '0',
       SynsetTerms: 'wife' },
     { '# POS': 'a',
       ID: '1455732',
       PosScore: '0',
       NegScore: '0',
       SynsetTerms: 'little' },
     { '# POS': 'a',
       ID: '1554230',
       PosScore: '0',
       NegScore: '0.125',
       SynsetTerms: 'such' },
     { '# POS': 'n',
       ID: '10288516',
       PosScore: '0',
       NegScore: '0',
       SynsetTerms: 'man' },
     { '# POS': 'v',
       ID: '2744820',
       PosScore: '0',
       NegScore: '0',
       SynsetTerms: 'be' },
     { '# POS': 'n',
       ID: '13597444',
       PosScore: '0',
       NegScore: '0',
       SynsetTerms: 'first' },
     { '# POS': 'n',
       ID: '8225090',
       PosScore: '0',
       NegScore: '0',
       SynsetTerms: 'neighbourhood' },
     { '# POS': 'n',
       ID: '11350705',
       PosScore: '0',
       NegScore: '0',
       SynsetTerms: 'truth' },
     { '# POS': 'a',
       ID: '1370475',
       PosScore: '0.375',
       NegScore: '0',
       SynsetTerms: 'rightful' },
     { '# POS': 'n',
       ID: '4916342',
       PosScore: '0',
       NegScore: '0',
       SynsetTerms: 'property' },
     { '# POS': 'n',
       ID: '5870055',
       PosScore: '0',
       NegScore: '0',
       SynsetTerms: 'one' },
     { '# POS': 'a',
       ID: '1730820',
       PosScore: '0',
       NegScore: '0.25',
       SynsetTerms: 'other' } ] }
}
**/