Sentimetnal
No, it's not a typo 😁. According to Google Translate this is the Esperanto word for 'sentimental'.
Sentimetnal is a very simple sentiment analyzer based on Finn Årup Nielsen's AFINN word list.
It is basically a Ruby port of https://gist.github.com/fnielsen/4183541/ It returns a float for the sentiment strength of an input text.
Positive values are for a positive valence, negative values for a negative valence.
Installation
Add this line to your application's Gemfile:
gem 'sentimetnal'
And then execute:
$ bundle
Or install it yourself as:
$ gem install sentimetnal
Usage
require 'sentimetnal'
analyzer = Sentimetnal::Analyzer.new
sentiment = analyzer.sentiment("The best & most delicious beef and friendly staff!" # 1.7677669529663687
sentiment.to_rating # 4
sentinment.to_emoji # :smile:
Contributing
I'd like to try translating the word list and prepare it for the use with other languages...
- Fork it ( https://github.com/[my-github-username]/sentimetnal/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
Ruby NLP
Unfortunately Ruby does not provide something like NLTK. But there are some interesting gems and code. I'm compiling my favorite ones here