Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

simple_sentiment

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple_sentiment

  • 0.0.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Sentiment

Simple Sentiment Analysis

Installation

Add this line to your application's Gemfile:

gem 'simple_sentiment'

And then execute:

$ bundle

Or install it yourself as:

$ gem install simple_sentiment

Usage

Call SimpleSentiment.sentiment with the string you want to parse. This will return a results object that includes a score, which is negative for a negative sentiment and positive for a positive sentiment. It will also return a comparative score which is the average of negative or positive words over the entire string. The results object also contains a list of the tokens and the words that it found.

This is a simple dictionary based mechanism. Each word is given a numeric sentiment value and those values are added up as they are found in the string after punctuation is removed.

If your string contains HTML or any other type of markup you will need to remove that before sending it into the Sentiment mechanism.

This is a port of:

https://github.com/thisandagain/sentiment

Which is largely the same algorithm for node.js. This version includes one refinement which is some extra code to handle a few two-word cases that appear in the dictionary.

Contributing

  1. Fork it
  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 new Pull Request

FAQs

Package last updated on 12 Nov 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc