This page gives an overview of the Tools API which provides turnkey text and sentiment analysis functionality for understanding opinionated content such as user reviews, customer feedback, etc.
API Key
To use the Tools API, you must have an API key. Contact [email protected] to obtain a key.
The Tools API provides the following functionality:
Analysis endpoints handle POST requests with parameters supplied via JSON objects in the message body.
- Sentiment analysis - extracts opinions from text, optionally identifying key topics for each opinion
- Topic extraction - identifies important entities (brands, names, etc.), features, and descriptors in a piece of text
- Summarization - distills content into overall sentiment, representative quotes, and best and worst features
- Feature sets - allows storage of taxonomies to be reused in sentiment analysis
Analysis endpoints handle POST requests with parameters supplied via JSON objects in the message body.
$obj = array(
"text" => "I love natural language processing! NLP is lots of fun.",
"entities" => array(array("nlp", "natural language processing"))
);
$options = array(
'http' => array(
'method' => 'POST',
'content' => json_encode($obj),
'header'=> "Content-Type: application/json\r\n" .
"Accept: application/json\r\n"
)
);
$context = stream_context_create($options);
$result = file_get_contents("http://api.addstructure.com/v1/analysis/sentiment?key=APIKEY", false, $context);
echo($result);
The output is also formatted as JSON.
{
"success":true,
"message":"",
"opinions":[
{"sentenceID":"s1", "entity":"nlp", "feature":"general", "sentiment":1, "emotion":"joy", "sentence":"I love natural language processing!", "segment":"I love natural language processing!", "showsIntent":false},
{"sentenceID":"s2", "entity":"nlp", "feature":"general", "sentiment":1, "emotion":"none", "sentence":"NLP is lots of fun."," segment":"NLP is lots of fun.","showsIntent":false}
]
}