- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSentimentAnalysisFree.php
More file actions
Latest commit
executable file
·31 lines (25 loc) · 749 Bytes
/
Copy pathSentimentAnalysisFree.php
File metadata and controls
executable file
·31 lines (25 loc) · 749 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
require_once("mashape/MashapeClient.php");
class SentimentAnalysisFree {
constPUBLIC_DNS = "chatterbox-analytics-sentiment-analysis-free.p.mashape.com";
private$authHandlers;
function__construct($publicKey, $privateKey) {
$this->authHandlers = array();
$this->authHandlers[] = newMashapeAuthentication($publicKey, $privateKey);
}
publicfunctionclassifytext($lang, $text, $exclude = null) {
$parameters = array(
"lang" => $lang,
"text" => $text,
"exclude" => $exclude);
$response = HttpClient::doRequest(
HttpMethod::POST,
"https://" . self::PUBLIC_DNS . "/sentiment/current/classify_text/",
$parameters,
$this->authHandlers,
ContentType::FORM,
true);
return$response;
}
}
?>