0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Simple Ruby sentiment analyzer based on the AFINN word list. Returns a float value for the sentiment strength of an input text
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.6
~> 2.6
~> 10.0
~> 3
 Project Readme

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...

  1. Fork it ( https://github.com/[my-github-username]/sentimetnal/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. 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