A light-weight sentiment analysis NPM module, based on the AFINN-111 word list
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
To make changes, clone the project, cd into it, install dev dependencies then start Gulp watch.
git clone git@github.com: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 developmentnpm run build
- Run tests, then lint, compile and minify the project for productionnpm run test
- Execute unit tests, quality gates, and coveragenpm run example
- Run the example script
After cloning, run yarn test
to execute the unit tests and generate quality and coverage report. The following files will be executed:
utils.test.coffee
- All utility unit testsmain.test.coffee
- Main integration tests
Any new features added must be tested, and all tests must be passing before any changes can be merged.
Contributions are welcome :) Please be sure to follow the Contributor Covenant Code of Conduct.
For license explanation, see TLDR Legal > MIT
The MIT License (MIT)
Copyright (c) Alicia Sykes <alicia@omg.com>
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 :)