Analyze emotions
- Print
- PDF
Analyze emotions
- Print
- PDF
Article summary
Did you find this summary helpful?
Thank you for your feedback
Emotion analysis API
It is a REST API based on HTTP, which analyzes text data and returns the results as a service that analyzes the emotions within the content of the text, sentence, phrase.
Requests
POST https://naveropenapi.apigw.ntruss.com/sentiment-analysis/v1/analyze
Request headers
Header name | Description |
---|---|
X-NCP-APIGW-API-KEY-ID | Client ID issued when registering the appX-NCP-APIGW-API-KEY-ID:{Client ID} |
X-NCP-APIGW-API-KEY | Client secret issued when registering the appX-NCP-APIGW-API-KEY:{Client Secret} |
Content-Type | Binary transfer methodContent-Type: application/json |
Request body
Field name | Requirement status | Type | Description |
---|---|---|---|
content | Yes | String | Emotion analysis text |
config.negativeClassification | No | Boolean | Negative statement analysis option |
Responses
Response bodies
Field name | Data type | Description |
---|---|---|
document | Object | Object for all sentences |
document.sentiment | String | Emotion for all sentences |
document.confidence | Object | Emotion confidence for all sentences |
document.confidence.neutral | Float | Neutral confidence (%) |
document.confidence.positive | Float | Positive confidence (%) |
document.confidence.negative | Float | Negative confidence (%) |
sentences | List of Object | List object related to categorized sentences |
sentences.content | String | Categorized sentences |
sentences.offset | Int | Sentence start point in document.content |
sentences.length | Int | Character count for categorized sentences |
sentences.sentiment | String | Emotion for categorized sentences |
sentences.confidence | Object | Emotion confidence for the categorized sentence |
sentences.confidence.neutral | Float | Neutral confidence (%) |
sentences.confidence.positive | Float | Positive confidence (%) |
sentences.confidence.negative | Float | Negative confidence (%) |
sentences.highlights | List of Object | Emotion analysis section in sentences.content |
sentences.highlights.offset | Int | Start point of major emotion section |
sentences.highlights.length | Int | Character count for major emotion section |
sentences.negativeSentiment.sentiment | String | If negative emotion, detailed emotions |
sentences.negativeSentiment.confidence | Float | If negative emotion, confidence of detailed emotions |
Examples
Request examples
{
"content": "It's chilling. A dagger flies into my heart and pierces it."
}
Response examples
{
"document": {
"sentiment": "negative",
"confidence": {
"neutral": 0.14525136640572725,
"positive": 0.00186876227013191,
"negative": 0.8528798713241407
}
},
"sentences": [
{
"content": "It's chilling.",
"offset": 0,
"length": 5,
"sentiment": "negative",
"confidence": {
"negative": 0.9961358904838562,
"positive": 0.0036366574931889772,
"neutral": 0.0002274021098855883
},
"highlights": [
{
"offset": 0,
"length": 4
}
]
},
{
"content": "A dagger flies into my heart and pierces it.",
"offset": 5,
"length": 17,
"sentiment": "negative",
"confidence": {
"negative": 0.927976131439209,
"positive": 0.07131962478160858,
"neutral": 0.0007042606011964381
},
"highlights": [
{
"offset": 1,
"length": 15
}
]
}
]
}
Error
Error examples
{
"status": 400,
"error": {
"errorCode": "E001",
"message": "Unsupported empty or blank text"
}
}
Errors
HttpStatusCode | ErrorCode | ErrorMessage | Description |
---|---|---|---|
400 | E001 | Unsupported empty or blank text | Empty string or blank character |
400 | E002 | Utf-8 encoding error | UTF-8 encoding error |
400 | E003 | Text quota Exceeded | Sentences over the standard value |
400 | E103 | Invalid request body | Invalid request body’s json format or omitting required parameters |
400 | E415 | Unsupported media type | Content-type error |
400 | E900 | Unexpected error | Case without exception handling (Bad Request) |
500 | E501 | Endpoint connection failed | Endpoint connection failed |
500 | E900 | Unexpected error | Error without exception handling (Server Error) |
Was this article helpful?