Main groups of emotional traits
The emotional-traits document classification resources can be used in a standard way, composing their endpoints as indicated in this reference section article. In this case, the output of the resource is also standard.
It is also possible to obtain extra output containing the main groups of emotional traits.
To achieve this you need to add a query string parameter to the resource endpoint.
The parameter is called features and must be set to extradata. For example, this is the resource endpoint for English with the addition of the parameter:
https://nlapi.expert.ai/v2/categorize/emotional-traits/en?features=extradata
The resulting output has this format:
{
"success": Boolean success flag,
"data": {
"content": analyzed text,
"language": language code,
"version": technology version info,
"categories": as in the standard classification output,
"extraData": {
"groups": Main group(s) data
}
}
}
It is the standard classification output with the addition of the extraData object which in turn contains the main groups data.
The groups property is an array, each item of which is an object representing a main group, for example:
"extraData": {
"groups": [
{
"id": "0500",
"label": "Group Dejection",
"position": 1
}
]
}
These are the properties returned for each group:
| Description | Property name in the JSON object |
|---|---|
| Identification number or name of the group category in the category tree | id |
| Group category description | label |
| Ranking of the group | position |
The group with the highest rank has position set to 1. Other groups, when present, have consecutive values.