Dengan menggunakan Datumbox, gw masih bingung untuk pembelajaran data nya, dan juga Analisis nya hanya mengenal English language aja, belum bahasa yang lain.
OK..kita mulai saja dengan Viralheat
Dengan Viralheat, kita bisa menggunakan sosial media seperti Facebook dan Twitter untuk penggunaan Sentiment Analysis-nya.
Untuk contoh di atas, kita hanya menggunakan Twitter saja.
Dari timeline yang di tunjukkan di atas, kita bisa melihat adanya hasil dari Sentiment Analysis dari tiap-tiap tweets. Positive-Neutral-ataupun Negative.
Untuk pembelajaran bagi Viralheat nya sendiri, kita juga bisa langsung melakukan "Mark as" untuk pembelajaran Sentiment Analysis nya, misalkan "Mark as Positive".
Untuk pembelajaran secara manual, kita bisa menggunakan API yang ada (comot dari Developer Doc nya Viralheat):
Sentiment API
Analyze sentiment of your social data*. Understand if sentiment is positive, negative or neutral around your brand, products and more.
GET /social/api/sentiment
GET /social/api/sentiment/train
GET /social/api/sentiment
The Sentiment will return the mood based on the context of the text. It will also turn a probability score.
You can define your own thresholds to classify sentiment appropriately. For e.g. all mentions with positive and probability above 0.9 can be highly positive.
RESOURCE URL
GET https://app.viralheat.com/social/api/sentimentResponse
URL QUERY PARAMETERS
api_key:
The authenticated account key. Required
text:
Text for which you want the sentiment. The limit on the text is 360 characters. Required
GET/social/api/sentiment/train
You can even train our Sentiment Analysis for more accurate results. Simply use this call to send us training data set back so we can apply it to our engines to improve scoring and accuracy.
RESOURCE URL
GET https://app.viralheat.com/social/api/sentiment/trainResponse
URL QUERY PARAMETERS
api_key:
The authenticated account key. Required
text:
Text for which you want the sentiment. The limit on the text is 360 characters. Required
mood:
1 for Positive, -1 for negative and 0 for neutral Required
hmmm sekarang kita bahas contoh penggunaannya,
untuk review kita bisa membuat seperti ini:
<?php
$qry_str = "?api_key=KEY&text=kampret";
$ch = curl_init();
// Set query data here with the URL
curl_setopt($ch, CURLOPT_URL, 'https://app.viralheat.com/social/api/sentiment' . $qry_str);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, '3');
$content = trim(curl_exec($ch));
curl_close($ch);
print $content;
?>
hasil keluaran nya akan berbentuk:
| {"status":200,"error":null,"text":"'kampret'","mood":"'positive'","prob":"0.5"} |
untuk training nya, kita bisa membuat seperti ini:
<?php
$qry_str = "?api_key=KEY&text=kampret&mood=-1";
$ch = curl_init();
// Set query data here with the URL
curl_setopt($ch, CURLOPT_URL, 'https://app.viralheat.com/social/api/sentiment/train' . $qry_str);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, '3');
$content = trim(curl_exec($ch));
curl_close($ch);
print $content;
?>
resultnya:
{"status":200,"error":null}

Komentar
Posting Komentar