Cortex Sentiment
Editions
Production use of this feature is available for specific editions only. Contact our sales team for more information.
Cortex Sentiment is a transformation component that uses Snowflake Cortex to analyze English-language input text and return a sentiment score for that text.
The returned sentiment score is a floating point number from -1 to 1 (inclusive), indicating the level of negative or positive sentiment in the input text. Values close to 0 indicate neutral sentiment.
You must use a Snowflake role that has been granted the SNOWFLAKE.CORTEX_USER database role. Read Required Privileges to learn more about granting this privilege.
To learn more about Snowflake Cortex, such as availability, usage quotas, managing costs, and more, visit Large Language Model (LLM) Functions (Snowflake Cortex).
Properties
Name
= string
A human-readable name for the component.
Columns
= dual listbox
Use the arrow buttons or use drag-and-drop to move columns to the right-hand listbox to analyze for sentiment. A new column is created for each column that is analyzed.
Include Input Columns
= boolean
- Yes: Outputs both your source input columns and the sentiment score columns. This will also include those input columns not selected in Columns.
- No: Only includes the new target language translation columns.
Example
A coffee shop has been collecting customer reviews left on a website, and wants to obtain a sentiment score for each review so that they can more easily rank them and focus on the more positive and negative reviews. Today's reviews look like this:
Input data:
COFFEE TYPE | REVIEW |
---|---|
Espresso | The espresso was bold and aromatic, but a tad too bitter for my taste. The barista was friendly, though, and the atmosphere was cozy. |
Cappuccino | My cappuccino was perfectly balanced, with a creamy foam that melted in my mouth. However, the service was a bit slow, and the coffee wasn't piping hot. |
Latte | The latte was velvety smooth, but it lacked the flavor I was hoping for. The barista was friendly, and the ambiance was pleasant. |
Americano | The Americano was strong and robust, just how I like it. However, the service was a bit impersonal, and the coffee could have been hotter. |
Mocha | Indulging in the mocha was like sipping on liquid chocolate bliss. The service, however, was lacking, with long wait times and a disorganized atmosphere. |
Cold Brew | The cold brew was refreshingly smooth, but it tasted a bit watered down. The ambiance was nice, though, and the staff was friendly. |
Macchiato | The macchiato was the perfect balance of bold espresso and creamy foam. Unfortunately, the service was slow, and the coffee was lukewarm. |
Flat White | The flat white was silky smooth, but it lacked the depth of flavor I was expecting. The barista was friendly, though, and the atmosphere was cozy. |
Turkish Coffee | The Turkish coffee was rich and aromatic, but it was too bitter for my taste. The service was prompt, and the ambiance was charming. |
Pour Over | The pour-over coffee was delicate and nuanced, but it was a bit too acidic for my liking. The barista was knowledgeable, and the coffee house had a cozy vibe. |
The shop can use the Cortex Sentiment component to generate a sentiment score from the review text, giving a numeric value that can then be used to rank the reviews.
The returned sentiment score is a floating point number from -1 to 1 (inclusive), indicating the level of negative or positive sentiment in the input text. Values close to 0 indicate neutral sentiment.
Cortex Sentiment component properties:
- Columns: REVIEW
- Include Input Columns: YES
By setting Include Input Columns to YES, the original columns from the table will be kept as part of the pipeline run, and the sentiment column is appended to the end of the table.
Output data:
COFFEE TYPE | REVIEW | sentiment_REVIEW |
---|---|---|
Espresso | The espresso was bold and aromatic, but a tad too bitter for my taste. The barista was friendly, though, and the atmosphere was cozy. | 0.12250977 |
Cappuccino | My cappuccino was perfectly balanced, with a creamy foam that melted in my mouth. However, the service was a bit slow, and the coffee wasn't piping hot. | 0.14366674 |
Latte | The latte was velvety smooth, but it lacked the flavor I was hoping for. The barista was friendly, and the ambiance was pleasant. | 0.06666183 |
Americano | The Americano was strong and robust, just how I like it. However, the service was a bit impersonal, and the coffee could have been hotter. | 0.2022247 |
Mocha | Indulging in the mocha was like sipping on liquid chocolate bliss. The service, however, was lacking, with long wait times and a disorganized atmosphere. | -0.11909427 |
Cold Brew | The cold brew was refreshingly smooth, but it tasted a bit watered down. The ambiance was nice, though, and the staff was friendly. | 0.15057838 |
Macchiato | The macchiato was the perfect balance of bold espresso and creamy foam. Unfortunately, the service was slow, and the coffee was lukewarm. | -0.03614796 |
Flat White | The flat white was silky smooth, but it lacked the depth of flavor I was expecting. The barista was friendly, though, and the atmosphere was cozy. | 0.024382059 |
Turkish Coffee | The Turkish coffee was rich and aromatic, but it was too bitter for my taste. The service was prompt, and the ambiance was charming. | 0.06510518 |
Pour Over | The pour-over coffee was delicate and nuanced, but it was a bit too acidic for my liking. The barista was knowledgeable, and the coffee house had a cozy vibe. | 0.099522464 |
Snowflake | Databricks | Amazon Redshift |
---|---|---|
✅ | ❌ | ❌ |