dmitry-udod/php-insight

Sentiment analysis tool for PHP


Keywords
php, sentiment, insight, sentiment analysis, php7, sentiment-analysis
Licenses
GPL-3.0/GPL-3.0+

Documentation

php-insight - Sentiment Analysis in PHP

Installation

composer require dmitry-udod/php-insight

Usage

use PHPInsight\Sentiment;
#....
$analyzer = new Sentiment();
$analyzer->categorise($string); #return text category, positive, negative or neutral
$scores = $analyzer->score($string);

#Returns text scores, for example
#(
#    [neg] => 0.865
#    [neu] => 0.108
#    [pos] => 0.027
#)

Demo

Run

composer demo

Generate dictionaries

Run

composer generate-dictionaries

Tests

Install and run phpunit in project dir