Skip to content

Latest commit

 

History

History
55 lines (34 loc) · 1.66 KB

README.md

File metadata and controls

55 lines (34 loc) · 1.66 KB

PHP Sentiment Analyzer

PHP Sentiment Analyzer is a lexicon and rule-based sentiment analysis tool that is used to understand sentiments in a sentence using VADER (Valence Aware Dictionary and sentiment Reasoner).

GitHub license GitHub issues Twitter

Requirements

  • PHP 5.5 and above

Steps:

Install

Composer

Run the following to include this via Composer

composer require davmixcool/php-sentiment-analyzer

Usage

Use Sentiment\Analyzer;

$sentence = "David is smart, handsome, and funny.";
$analyzer = new Analyzer(); 
$result = $analyzer->getSentiment($sentence);

print_r($result);

##Output

['neg'=> 0.0, 'neu'=> 0.337, 'pos'=> 0.663, 'compound'=> 0.7096]

License

This package is licensed under the MIT license.

Reference

Hutto, C.J. & Gilbert, E.E. (2014). VADER: A Parsimonious Rule-based Model for Sentiment Analysis of Social Media Text. Eighth International Conference on Weblogs and Social Media (ICWSM-14). Ann Arbor, MI, June 2014.