Text Sentiment
Overview
Text Sentiment is one of the intelligence services of the Filestack platform. You can detect general emotions of text.
Text Sentiment via the Processing API
Text Sentiment is available as a synchronous operation in the Processing API using the following task:
text_sentiment
To use this task in Processing API, you have to use security policy and signature. Read more about security policies here.
| PARAMETER | VALUE | OPTIONS | DESCRIPTION |
|---|---|---|---|
| text* | string | Text for analysis. | |
| language | string auto | auto, en, es, fr, de, it, pt, ar, hi, ja, ko, zh, zh-TW |
When auto value is used we will try to detect the language of the text automatically. |
Response
https://cdn.filestackcontent.com/security=p:<POLICY>,s:<SIGNATURE>/text_sentiment=text:"this product is outstanding"{
"emotions": {
"Positive": 0.9997168183326721,
"Negative": 0.0000452575332019,
"Neutral": 0.0001435235462849,
"Mixed": 0.0000943295744946
}
}Response Parameters
| emotions | dictionary | Contains detected emotions |
Examples
- Get the sentiment information of text:
https://cdn.filestackcontent.com/security=p:<POLICY>,s:<SIGNATURE>/text_sentiment=text:"quick brown fox"
Webhook
Below you can find an example webhook payload for text sentiment task
{
"id": 65374401,
"action": "fs.workflow",
"timestamp": 1551126197,
"text": {
"workflow": "c516549f-3755-4fb5-85a4-15ae4b31d475",
"createdAt": "2020-01-25T20:21:53.929686791Z",
"updatedAt": "2020-01-25T20:21:56.716186597Z",
"sources": [
"H2swKXwhRxKFrylakLwcd"
],
"results": {
"text_sentiment_1551120182170": {
"data": {
"emotions": {
"Mixed": 0.027882017195224762,
"Negative": 0.02189556509256363,
"Neutral": 0.7253097891807556,
"Positive": 0.22491265833377838
}
}
}
},
"status": "Finished"
}
}Please visit the webhooks documentation page to learn more.