Detect Sentiment of Text v1.0.6
Performs sentiment analysis on the input text and determines if the sentiment is positive, negative, mixed, or neutral. Refers to Sentiment analysis.
How can I use the Step?
You can use the Step to add sentiment-based logic to the Flow to process different emotionally-colored texts separately. The Step lets you identify the tone for unstructured business texts such as comments, reviews, or surveys.
Input settings
To set up the section, take the following steps:
- In the Input text field, provide text to analyze. You can enter text manually or use the Merge fields here.
- In the Input language list, select the language that matches the input text.
Input text
The input text must be a UTF-8 string. The string must contain at least one character. The maximum string size is 5 KB.
Input language
The Step can identify the dominant language of the input text automatically. So if you do not know the language of the input text, leave the default value Any supported
for this setting.
The Step supports the following languages:
- German
- English
- Spanish
- Italian
- Portuguese
- French
- Japanese
- Korean
- Hindi
- Arabic
- Chinese (simplified)
- Chinese (traditional)
Output and exit behavior
Use this section to configure Flow branching behavior and handle ambiguous results.
Note: An ambiguous result is a result that has а close scores for different sentiment types. By default, the Step ignores such cases and classifies the text by the highest score.
To set up the section, follow these steps:
- For Exit behavior, select the appropriate option that suits your application. By default, the Step uses the
next
exit for all detected sentiments. - Optionally:
- Turn on the Use a separate exit for ambiguous results toggle to handle ambiguous results with a separate exit.
- In the Ambiguity threshold field, provide the threshold value used as a rule for treating parsed text as ambiguous.
Ambiguity threshold
An ambiguity threshold value must be a floating-point number from 0 to 1. If the difference between the top two sentiment scores is lower than the ambiguity threshold, the Step treats the text as ambiguous, and the Flow proceeds down the ambiguous
exit.
Merge field settings
The Step returns the result as a JSON object and stores it in the Merge field variable. Thus you can access the output JSON object from any point of your Flow. To learn more about this Step's output, see the Output example.
Skip logic exit
Use this setting to handle cases where duplicate Merge field variable names exist in your Flow, whereas the previously defined variable holds value.
By default, in such cases, the Step overwrites the existing variable with the new value. Another option is to skip the Step execution and direct the Flow down the selected exit. To do so, follow these steps:
- Enable the Skip step execution if existing merge field has data toggle.
- In the Skip logic exit list, select exit to direct the Flow.
Output example
The Step's output contains information about the detected sentiment, its confidence score, and the ambiguity present (if applicable).
For example:
{
"sentiment": "neutral",
"sentimentScore": {
"positive": 0.1466975212097168,
"negative": 0.3056486248970032,
"neutral": 0.399077832698822,
"mixed": 0.14857599139213562
},
"ambiguity": {
"topTwoDiff": 0.09342920780181885,
"isAmbiguous": true,
"threshold": 0.16
}
}
{
"sentiment": "neutral",
"sentimentScore": {
"positive": 0.1466975212097168,
"negative": 0.3056486248970032,
"neutral": 0.399077832698822,
"mixed": 0.14857599139213562
},
"ambiguity": {
"topTwoDiff": 0.09342920780181885,
"isAmbiguous": true,
"threshold": 0.16
}
}
Error Handling
By default, the Step handles errors using a separate exit. So if any error occurs during the Step execution, the Flow proceeds down the error
exit.
Note: If you disable the Handle error toggle, the Step does not handle errors. With this setup, if any error occurs during the Step execution, the Flow fails immediately after exceeding the Flow's timeout. To prevent the Flow from being suspended while continuing to handle errors in the Flow, place the Flow Error Handling Step before the main Flow logic.
Reporting
The Step reports once after its execution. You can change the Step log level and add new tags in the section.
Log level
By default, the Step inherits its log level from Flow's log level. You can change the Step's log level by selecting an appropriate option from the Log level list.
Tags
Tags help organize and filter session information when generating reports. You can specify the tag category, label, and value when adding a new tag.
Service dependencies
- flow builder - v2.28.3
- event-manager - v2.3.0
- deployer - v2.6.0
- comprehend provider - v0.9.0
Release notes
v1.0.6
- UI improvements
v1.0.0
- Initial release