SentimentAnalyser - Scoped
-
- UpdatedAug 3, 2023
- 3 minutes to read
- Vancouver
- API reference
The SentimentAnalyser API performs sentiment analysis on a string value.
You should use this API should in a script that is treated as an admin-executing script. For example, we should use the Sentiment Analysis API in Script Action or Scheduled Job.
To use this class in a scoped application, use the sn_nlp_sentiment
namespace identifier. The Sentiment Analysis plugin (com.snc.sentiment_analysis) must be
enabled to access the SentimentAnalyser API.
SentimentAnalyser - SentimentAnalyser()
Creates an instance of the SentimentAnalyser class with the default connector configuration that is used for sentiment analysis.
Example
SentimentAnalyser - SentimentAnalyser(GlideRecord configGR)
Creates an instance of the SentimentAnalyser class with the specified connector configuration that is used for sentiment analysis.
Name | Type | Description |
---|---|---|
configGR | GlideRecord | GlideRecord object of a connector configuration. |
Example
SentimentAnalyser - analyze(String inputText)
Performs sentiment analysis on the specified text.
Name | Type | Description |
---|---|---|
inputText | String | Text on which sentiment analysis should be performed. |
Type | Description |
---|---|
JSON object | Result of the sentiment analysis specifying the status, score, normalised score, sys_id of the relevant connector configuration, and error message. |
Example
Output:
SentimentAnalyser - analyzeWithLanguage(String inputText, String language)
Performs sentiment analysis on a specified text and language.
Name | Type | Description |
---|---|---|
inputText | String | Text on which to perform sentiment analysis. |
language | String | Language for the input text. This can vary for different sentiment services. |
Type | Description |
---|---|
JSON object | Result of the sentiment analysis specifying the status, score, normalized score, sys_id of the relevant connector configuration, and error message. |
Example
Output:
SentimentAnalyser - analyzeMultiple(Array inputTextArray)
Performs sentiment analysis on an array of strings.
Name | Type | Description |
---|---|---|
inputTextArray | Array | Array of text (string) on which to perform sentiment analysis. |
Type | Description |
---|---|
JSON Array | An array that gives the result of the sentiment analysis performed on multiple texts specifying the status, score, normalized score, sys_id of the relevant connector configuration, and error message. |
Example
Output:
SentimentAnalyser - analyzeMultipleWithLanguage(Array inputTextArray, String language)
Performs sentiment analysis on an array of strings in the specified language.
Name | Type | Description |
---|---|---|
inputTextArray | Array | Array of text (string) on which to perform sentiment analysis. |
language | String | Language for the input text. This can very for different sentiment services. |
Type | Description |
---|---|
JSON Array | An array with the result of the sentiment analysis performed on multiple texts of the mentioned language, specifying the status, score, normalized score, sys_id of the relevant connector configuration, and error message. |
Example
Output:
SentimentAnalyser - getConnectorByName(String connectorName)
Returns the GlideRecord of the specified connector configuration.
Name | Type | Description |
---|---|---|
connectorName | String | Name of the connector configuration. |
Type | Description |
---|---|
GlideRecord | GlideRecord of the specified connector configuration. |
Example
Output:
SentimentAnalyser - getDefaultConnector()
Returns the GlideRecord of the default connector configuration.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
GlideRecord | GlideRecord of the default connector configuration. |
Example
On this page
- SentimentAnalyser - SentimentAnalyser()
- SentimentAnalyser - SentimentAnalyser(GlideRecord configGR)
- SentimentAnalyser - analyze(String inputText)
- SentimentAnalyser - analyzeWithLanguage(String inputText, String language)
- SentimentAnalyser - analyzeMultiple(Array inputTextArray)
- SentimentAnalyser - analyzeMultipleWithLanguage(Array inputTextArray, String
language)
- SentimentAnalyser - getConnectorByName(String connectorName)
- SentimentAnalyser - getDefaultConnector()