PHP code example of choccybiccy / sentiment
1. Go to this page and download the library: Download choccybiccy/sentiment library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
choccybiccy / sentiment example snippets
use Choccybiccy\Sentiment\Factory;
$factory = new Factory();
$sentiment = $factory->create(
Factory::ENDPOINT_ANALYSIS_SENTIMENT,
"MyApiKey"
);
$result = $sentiment->analyse("I don't like her, I love her!");
echo "The sentiment is " . $result->getResult(); # Will return: The sentiment is positive