> ## Documentation Index
> Fetch the complete documentation index at: https://docs.maia.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Cortex Sentiment

export const ComponentMetadata = ({warehouses, unsupportedWarehouses = [], componentType, connectionInputs, connectionOutputs}) => {
  const allWarehouses = [...warehouses.map(w => ({
    name: w,
    supported: true
  })), ...unsupportedWarehouses.map(w => ({
    name: w,
    supported: false
  }))];
  return <div style={{
    background: 'var(--colors-background-light, #f9fafb)',
    border: '1px solid var(--colors-border-default, #e5e7eb)',
    borderRadius: '12px',
    padding: '20px 28px',
    marginBottom: '28px',
    boxShadow: '0 1px 4px rgba(0,0,0,0.10)'
  }}>
      <table style={{
    width: '100%',
    borderCollapse: 'collapse'
  }}>
        <tbody>
          <tr>
            <td style={{
    fontWeight: '600',
    paddingRight: '32px',
    paddingBottom: '14px',
    whiteSpace: 'nowrap',
    verticalAlign: 'middle',
    width: '180px'
  }}>Project Availability</td>
            <td style={{
    paddingBottom: '14px',
    verticalAlign: 'middle'
  }}>
              <div style={{
    display: 'flex',
    flexWrap: 'wrap',
    gap: '8px'
  }}>
                {allWarehouses.map((w, i) => <span key={i} style={{
    background: w.supported ? '#dcfce7' : '#fee2e2',
    color: w.supported ? '#15803d' : '#b91c1c',
    border: `1px solid ${w.supported ? '#bbf7d0' : '#fca5a5'}`,
    borderRadius: '9999px',
    padding: '3px 12px',
    fontSize: '0.85rem',
    fontWeight: '500',
    whiteSpace: 'nowrap'
  }}>
                    {w.name} {w.supported ? '✅' : '❌'}
                  </span>)}
              </div>
            </td>
          </tr>
          <tr>
            <td style={{
    fontWeight: '600',
    paddingRight: '32px',
    paddingBottom: '14px',
    whiteSpace: 'nowrap',
    verticalAlign: 'middle'
  }}>Component Type</td>
            <td style={{
    paddingBottom: '14px',
    verticalAlign: 'middle'
  }}>{componentType}</td>
          </tr>
          <tr>
            <td style={{
    fontWeight: '600',
    paddingRight: '32px',
    paddingBottom: '14px',
    whiteSpace: 'nowrap',
    verticalAlign: 'middle'
  }}>Connection Inputs</td>
            <td style={{
    paddingBottom: '14px',
    verticalAlign: 'middle'
  }}>{connectionInputs}</td>
          </tr>
          <tr>
            <td style={{
    fontWeight: '600',
    paddingRight: '32px',
    whiteSpace: 'nowrap',
    verticalAlign: 'middle'
  }}>Connection Outputs</td>
            <td style={{
    verticalAlign: 'middle'
  }}>{connectionOutputs}</td>
          </tr>
        </tbody>
      </table>
    </div>;
};

<ComponentMetadata warehouses={["Snowflake"]} unsupportedWarehouses={["Databricks", "Amazon Redshift", "BigQuery"]} componentType="Transformation" connectionInputs="One" connectionOutputs="Unlimited" />

<Info>
  Production use of this feature is available for specific editions only. [Contact our sales team](https://www.matillion.com/contact) for more information.
</Info>

The [Cortex Sentiment](https://docs.snowflake.com/en/sql-reference/functions/sentiment-snowflake-cortex) transformation component uses [Snowflake Cortex](https://www.snowflake.com/en/data-cloud/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](https://docs.snowflake.com/en/sql-reference/snowflake-db-roles#label-snowflake-db-roles-cortex-schema). Read [Required Privileges](https://docs.snowflake.com/en/user-guide/snowflake-cortex/llm-functions#label-cortex-llm-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)](https://docs.snowflake.com/en/user-guide/snowflake-cortex/llm-functions).

### Use case

This component can be used to analyze responses in a number of industries. The [Example](#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

<ResponseField name="Name" type="string" required>
  A human-readable name for the component.
</ResponseField>

{/* <!-- param-start:[columns] | warehouses: [snowflake] --> */}

<ResponseField name="Columns" type="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.
</ResponseField>

{/* <!-- param-start:[includeInputColumns] | warehouses: [snowflake] --> */}

<ResponseField name="Include Input Columns" type="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**.
</ResponseField>

## 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\_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.                                                                  |
| 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 ambiance was nice and the staff were friendly.                              |
| Cold Brew      | The cold brew tasted a bit watered down. The service was lacking, with long wait times and a disorganized atmosphere.                              |
| 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. The service was prompt, and the ambiance was charming.                                                   |
| Pour Over      | The 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\_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.              | mixed             |
| Cappuccino     | My cappuccino was perfectly balanced, with a creamy foam that melted in my mouth.                                                                  | positive          |
| Latte          | The latte was velvety smooth, but it lacked the flavor I was hoping for. The barista was friendly, and the ambiance was pleasant.                  | mixed             |
| 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.         | mixed             |
| Mocha          | Indulging in the mocha was like sipping on liquid chocolate bliss. The ambiance was nice and the staff were friendly.                              | positive          |
| Cold Brew      | The cold brew tasted a bit watered down. The service was lacking, with long wait times and a disorganized atmosphere.                              | negative          |
| Macchiato      | The macchiato was the perfect balance of bold espresso and creamy foam. Unfortunately, the service was slow, and the coffee was lukewarm.          | mixed             |
| 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. | mixed             |
| Turkish Coffee | The Turkish coffee was rich and aromatic. The service was prompt, and the ambiance was charming.                                                   | positive          |
| Pour Over      | The pour-over coffee was fine.                                                                                                                     | neutral           |
