LLM Sentiment
The LLM Sentiment processor generates a sentiment score based on English-language text in specified columns. The processor uses the Snowflake Large Language Model (LLM) Sentiment function to evaluate the sentiment of the text and provide a floating point score between -1 and 1 for evaluated data.
The sentiment score uses 1 for sentiments evaluated as the most positive, -1 for those considered the most negative, and values around 0 for neutral sentiments.
When you configure the processor, you specify the source columns to evaluate and optionally define output columns for the sentiment scores.
Example
Comments
column for a product. To write the sentiment score to
a new Comments-Sentiment
column, you simply configure the processor
as follows:- Source Column:
Comments
- Output Column:
Comments_Sentiment
ProductId | UserId | Comments |
---|---|---|
507 | smartguy64 | totally bogus |
812 | lo234go | works ok |
1563 | 99ball00ns | Best cheese grater I ever bought! |
2360 | ac123 | this things terrible. dont waste your time. |
355 | msally55 | worked great for just over a year, then the handle cracked off and it doesn't work now |
ProductId | UserId | Comments | Comments_Sentiment |
---|---|---|---|
507 | smartguy64 | totally bogus | -0.8749435 |
812 | lo234go | works ok | 0.3357192 |
1563 | 99ball00ns | Best cheese grater I ever bought! | 0.8874393 |
2360 | ac123 | this things terrible. dont waste your time. | -0.83438915 |
355 | msally55 | worked great for just over a year, then the handle cracked off and it doesn't work now | -0.4387149 |
Notice how the works ok
comment receives only a slightly positive
score in comparison to the glowing response in the following row.
Source and Output Columns
- Source columns
- The processor evaluates data in the columns defined in the Source Column property.
- Output columns
- The processor writes generated sentiment scores into the columns defined in the Output Column property. The processor
creates columns and overwrites data in output columns as
follows:
- When you define an output column that does not exist in incoming data, the processor creates the column.
- When you define an output column that exists, the processor overwrites the data in the column.
- When you do not define an output
column, the processor places the data in the column being
evaluated, overwriting the original data.
For example, if you configure the processor to evaluate a
Feedback
column and do not specify an output column, the processor places the sentiment score in theFeedback
column.
Configuring an LLM Sentiment Processor
Configure an LLM Sentiment processor to evaluate and generate a sentiment score for English-language text in specified columns.
-
On the General tab, configure the following
properties:
General Property Description Name Stage name. Description Optional description. Cache Data Caches processed data. -
On the Sentiment tab, configure the following
property:
Sentiment Property Description Sentiment Configurations Specify the following properties, as needed: -
Source Column - Name of the column to evaluate. To evaluate multiple columns, you can use a regular expression to define a name pattern to match.
- Output Column - Output column for the generated summary. When not defined, the processor overwrites the associated source column. For information about defining multiple columns, see Source and Output Columns.
-