Skip to main content
Production use of this feature is available for specific editions only. Contact our sales team for more information.
The Cortex Sentiment transformation component uses Snowflake Cortex to analyze English-language input text and return a sentiment for that text. The returned sentiment is one of the following strings:
  • unknown: The component cannot determine the sentiment.
  • positive: The sentiment is positive.
  • negative: The sentiment is negative.
  • neutral: The sentiment is neither positive nor negative.
  • mixed: The sentiment is both positive and negative.
To use this component, 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, read Large Language Model (LLM) Functions (Snowflake Cortex).

Use case

This component can be used to analyze responses in a number of industries. The Example section of this guide shows how it could be used in the hospitality industry to analyze reviews of a coffee shop. You could also use it to analyze online product reviews, customer satisfaction survey responses, or employee engagement survey answers, to name a few examples.

Properties

Name
string
required
A human-readable name for the component.
Columns
dual listbox
required
Use the arrow buttons or use drag-and-drop to move the columns you want to analyze into the right-hand listbox. A new sentiment column is created for each column that is analyzed.
Include Input Columns
boolean
required
  • Yes: Outputs both your source input columns and the sentiment columns. This will also include those input columns not selected in Columns.
  • No: Only includes the new sentiment column(s) generated for the selected Columns.

Example

A coffee shop has been collecting customer reviews left on a website, and wants to obtain a sentiment for each review so that they can more easily sort them and focus on their positive and negative reviews. Today’s reviews look like this: Input data:
COFFEE_TYPEREVIEW
EspressoThe espresso was bold and aromatic, but a tad too bitter for my taste. The barista was friendly, though, and the atmosphere was cozy.
CappuccinoMy cappuccino was perfectly balanced, with a creamy foam that melted in my mouth.
LatteThe latte was velvety smooth, but it lacked the flavor I was hoping for. The barista was friendly, and the ambiance was pleasant.
AmericanoThe Americano was strong and robust, just how I like it. However, the service was a bit impersonal, and the coffee could have been hotter.
MochaIndulging in the mocha was like sipping on liquid chocolate bliss. The ambiance was nice and the staff were friendly.
Cold BrewThe cold brew tasted a bit watered down. The service was lacking, with long wait times and a disorganized atmosphere.
MacchiatoThe macchiato was the perfect balance of bold espresso and creamy foam. Unfortunately, the service was slow, and the coffee was lukewarm.
Flat WhiteThe 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 CoffeeThe Turkish coffee was rich and aromatic. The service was prompt, and the ambiance was charming.
Pour OverThe pour-over coffee was fine.
The shop can use the Cortex Sentiment component to generate a sentiment from the review text. The sentiment indicates the level of negative or positive sentiment in the input text, and can then be used to sort the reviews. 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_TYPEREVIEWsentiment_REVIEW
EspressoThe espresso was bold and aromatic, but a tad too bitter for my taste. The barista was friendly, though, and the atmosphere was cozy.mixed
CappuccinoMy cappuccino was perfectly balanced, with a creamy foam that melted in my mouth.positive
LatteThe latte was velvety smooth, but it lacked the flavor I was hoping for. The barista was friendly, and the ambiance was pleasant.mixed
AmericanoThe Americano was strong and robust, just how I like it. However, the service was a bit impersonal, and the coffee could have been hotter.mixed
MochaIndulging in the mocha was like sipping on liquid chocolate bliss. The ambiance was nice and the staff were friendly.positive
Cold BrewThe cold brew tasted a bit watered down. The service was lacking, with long wait times and a disorganized atmosphere.negative
MacchiatoThe macchiato was the perfect balance of bold espresso and creamy foam. Unfortunately, the service was slow, and the coffee was lukewarm.mixed
Flat WhiteThe 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.mixed
Turkish CoffeeThe Turkish coffee was rich and aromatic. The service was prompt, and the ambiance was charming.positive
Pour OverThe pour-over coffee was fine.neutral