AS93

26
5
39 MB
Sep, 2015
1 year ago
CoffeeScript

Sentiment Analysis

A light-weight sentiment analysis NPM module, based on the AFINN-111 word list


Usage

Simply install sentiment-analysis via Yarn/ NPM/ pnpm, then import and use it.

npm i sentiment-analysis
sentimentAnalysis = require('sentiment-analysis');

sentimentAnalysis('Dinosaurs are awesome!'); // +0.4
sentimentAnalysis('Everything is stupid');  // -0.2
sentimentAnalysis('JavaScript sucks'); // -0.3
sentimentAnalysis('My life is a catastrophic disaster');  // -0.6

For a more detailed usage example, see this example Gist


Developing

To make changes, clone the project, cd into it, install dev dependencies then start Gulp watch.

git clone [email protected]:Lissy93/sentiment-analysis.git
cd sentiment-analysis
npm i

The entry point, and bulk of the logic is in the index.coffee file.

The following scripts are availible:

  • npm run dev - Watch for file changes and rebuild the project for development
  • npm run build - Run tests, then lint, compile and minify the project for production
  • npm run test - Execute unit tests, quality gates, and coverage
  • npm run example - Run the example script

Testing

After cloning, run yarn test to execute the unit tests and generate quality and coverage report. The following files will be executed:

Any new features added must be tested, and all tests must be passing before any changes can be merged.


Contributing

Contributions are welcome :) Please be sure to follow the Contributor Covenant Code of Conduct.


License

For license explanation, see TLDR Legal > MIT

The MIT License (MIT)
Copyright (c) Alicia Sykes <[email protected]> 

Permission is hereby granted, free of charge, to any person obtaining a copy 
of this software and associated documentation files (the "Software"), to deal 
in the Software without restriction, including without limitation the rights 
to use, copy, modify, merge, publish, distribute, sub-license, and/or sell 
copies of the Software, and to permit persons to whom the Software is furnished 
to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included install 
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANT ABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

© Alicia Sykes 2015
Licensed under MIT

Thanks for visiting :)