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

<dl>
<dt>Categories:</dt>
<dd>

[String & binary functions](/sql-reference/functions-string) (AI Functions)

</dd>
</dl>

# ENTITY_SENTIMENT (SNOWFLAKE.CORTEX)

Available to all accounts.

This feature is not available in the People's Republic of China.

This page is provided for backward compatibility. For new use cases, start with
%aisql-new-func-link%, which is the canonical surface going forward.
This legacy function will be deprecated by the end of 2026.

- [AI_SENTIMENT](/sql-reference/functions/ai_sentiment)
- [SENTIMENT (SNOWFLAKE.CORTEX)](/sql-reference/functions/sentiment-snowflake-cortex)

Returns sentiment scores for English-language text, including overall sentiment and specific sentiment for specified entities.

## Syntax

```sqlsyntax
SNOWFLAKE.CORTEX.ENTITY_SENTIMENT(<text> [, <entities> ])
```

## Arguments

<dl>
<dt><code className="samp"><em>text</em></code></dt>
<dd>

A string containing the text for which sentiment scores should be calculated.

</dd>
<dt><code className="samp"><em>entities</em></code></dt>
<dd>

An array containing up to ten entities or aspects for which sentiment scores should be calculated. Each entity is a
string. For example, if scoring sentiment from a restaurant review, the `entities` array might be `['cost',
'quality', 'waiting time']`. Entities may be a maximum of 30 characters long.

This argument is optional. If you do not provide it, the function will return only the overall sentiment.

</dd>
</dl>

## Returns

An OBJECT containing a `categories` field. `categories` is an ARRAY of category records. Each category includes these fields:

- `name`: The name of the category.
- `sentiment`: The sentiment of the category: positive, negative, neutral, mixed, or unknown, as a string.

Additionally, an `overall` category contains the overall sentiment of the text.

## Access control requirements

Users must use a role that has been granted the [SNOWFLAKE.CORTEX_USER database role](#label-snowflake-db-roles-cortex-user).
See [](#label-cortex-llm--privileges) for more information on this privilege.

## Legal notices

Refer to [Snowflake AI and ML](/guides-overview-ai-features).