sentiment
Sentiment analysis
The Sentiment module uses the AFINN-165 wordlist and Emoji Sentiment Ranking to provide sentiment analysis on arbitrary blocks of text.
Installation
-
Add the dependency to your
shard.yml
:dependencies: sentiment: github: cadmiumcr/sentiment
-
Run
shards install
Usage
require "cadmium_sentiment"
sentiment = Cadmium.sentiment
"Crystal is seriously the best programming language.".sentiment
# or
sentiment.analyze("Crystal is seriously the best programming language.")
# => {
score: 3,
comparative: 0,
tokens: ["Crystal", "is", "seriously", "the", "best", "programming", "language"],
words: ["best"],
positive: ["best"],
negative: []
}
"I really hate Python".is_negative?
# => true
"I really 💗 Crystal. It's my favorite.".is_positive?
# => true
Contributing
- Fork it (https://github.com/cadmiumcr/sentiment/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- Chris Watson - creator and maintainer
Repository
sentiment
Owner
Statistic
- 1
- 1
- 2
- 1
- 2
- over 4 years ago
- August 26, 2019
License
MIT License
Links
Synced at
Thu, 21 Nov 2024 14:33:59 GMT
Languages