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).
- PHP 5.5 and above
Composer
Run the following to include this via Composer
composer require davmixcool/php-sentiment-analyzer
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]
This package is licensed under the MIT license.
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.