Using Amazon Comprehend connections in visualization expressions
You can use the analytic connections in visualization expressions. The syntax when using the analytic connections in expressions must follow the server side extensions syntax.
Data should be processed in a visualization expression only when it will dynamically change based on the input from a user. If the text for text analysis is from the data model and will always be the same, the text analysis should instead be calculated in the load script and cached in the data model.
If the use case is based on user input, you can use an analytic connection and corresponding server side extension syntax in your chart expression to create interactive charts that visualize data received from the model endpoints.
Do the following:
-
When editing a visualization, click to enter the expression editor.
-
In the expression editor, enter an expression in the expression field The expression must be constructed using the server side extension syntax.
Working with the expression editor
Example
You can have a variable containing some user input text that can be scored for sentiment.
The above example uses the function “ScriptAggrStr” – “Aggr” to send a single row contained in the variable vText. String values are being sent and returned.
The example uses a pre-set language in the connection settings. You can change these settings dynamically in the request script, by providing a parameter in the script to change the language code. In this case the variable vLanguage is set for the parameter languagecode to dynamically change the language based on the users input without needing to create a new connection.