PHP code example of wfphpnlp / sentistrength
1. Go to this page and download the library: Download wfphpnlp/sentistrength 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/ */
wfphpnlp / sentistrength example snippets
use wfphpnlp/sentistrength;
$config = array(
'negation_conf' => true,
'booster_conf' => true,
'ungkapan_conf' => true,
'consecutive_conf' => true,
'repeated_conf' => true,
'emoticon_conf' => true,
'question_conf' => true,
'exclamation_conf' => true,
'punctuation_conf' => true,
);
// include composer autoloader
= array(
'negation_conf' => true,
'booster_conf' => true,
'ungkapan_conf' => true,
'consecutive_conf' => true,
'repeated_conf' => true,
'emoticon_conf' => true,
'question_conf' => true,
'exclamation_conf' => true,
'punctuation_conf' => true,
);
// create sentistrength
$senti = new Sentistrength($config);
// hitung nilai sentistrength
$hasil = $senti->main("agnezmo pintar dan cantik sekali tetapi lintah darat :)");
echo $hasil['kelas'];
// Positif
//menampilkan hasil perhitungan
print_r($hasil);
/*
Array
(
[classified_text] => agnezmo pintar [4] dan cantik [6] sekali tetapi lintah darat [-4] :) [3]
[tweet_text] => agnezmo pintar dan cantik sekali tetapi lintah darat :)
[sentence_score] => Array
(
[0] => agnezmo pintar [4] dan cantik [6] sekali tetapi lintah darat [-4] :) [3]
)
[max_positive] => 6
[max_negative] => -4
[kelas] => Positif
)
*/