PHP Classes

PHP Sentiment analyzer

Recommend this page to a friend!

      PHP Sentiment Analyzer  >  PHP Sentiment Analyzer package blog  >  PHP Sentiment Analysi...  >  All threads  >  PHP Sentiment analyzer  >  (Un) Subscribe thread alerts  
Subject:PHP Sentiment analyzer
Summary:SentimentAnalyzer.class.php Error
Author:Brahim Hadj
Date:2017-04-06 00:03:28

  1. PHP Sentiment analyzer   Reply   Report abuse  
Picture of Brahim Hadj Brahim Hadj - 2017-04-06 00:03:29
Please, i tried to use the PHP Sentiment analyser class, but i had this error :
Warning: Division by zero in C:\wamp\www\SIPHP\src\SentimentAnalyzer.class.php on line 106
and on line 123,131,137 and 138

this is my code :
$sat = new SentimentAnalyzerTest(new SentimentAnalyzer());
$sentence1 = 'while the performances are often engaging , this loose collection of largely improvised numbers would probably have worked better as a one-hour tv documentary . ';

$sentimentAnalysisOfSentence1 = $sat->analyzeSentence($sentence1);
$resultofAnalyzingSentence1 = $sentimentAnalysisOfSentence1['sentiment'];
$probabilityofSentence1BeingPositive = $sentimentAnalysisOfSentence1['accuracy']['positivity'];
$probabilityofSentence1BeingNegative = $sentimentAnalysisOfSentence1['accuracy']['negativity'];