# DetectSentiment Processor

This processor will take in input string and return the sentiment of the text. The sentiment can be thought of as the connotation of the message.

## Properties

{% hint style="info" %}
All of our Comprehend processors also include these [common properties](https://calculatedsystems.gitbook.io/cloud-nifi-processors/amazon-web-services/comprehend-api/..#common-properties).
{% endhint %}

This processor does not have any unique properties outside of the common ones.

## Data Output

If the *Destination* property is set to `flowfile-attribute`, then the output of this processor will be routed to the FlowFile's `nlp.Sentiment` attribute, which will be created if it isn't present.

{% tabs %}
{% tab title="Output Format" %}

| Field Name   | Data Type          | Description                              |
| ------------ | ------------------ | ---------------------------------------- |
| sentiment    | string (Sentiment) | The sentiment of the text                |
| score        | float              | How confident the API is in its response |
| {% endtab %} |                    |                                          |

{% tab title="Relevant Data Structures" %}

#### `Sentiment`

An enumeration that can take any one of the following values: `POSITIVE`, `NEGATIVE`, `NEUTRAL`, or `MIXED`.
{% endtab %}

{% tab title="Example Output" %}

```javascript
{
	"raw-input": "Machine learning is very cool!",
	"output": {
		"sentiment": "POSITIVE",
		"score": 0.992412
	}
}
```

{% endtab %}
{% endtabs %}
