Categories:

String & binary functions (Large Language Model)

SENTIMENT (SNOWFLAKE.CORTEX)

Returns a sentiment score for the given English-language input text.

Syntax

SNOWFLAKE.CORTEX.SENTIMENT(<text>)
Copy

Arguments

text

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

Returns

A floating-point number from -1 to 1 (inclusive) indicating the level of negative or positive sentiment in the text. Values around 0 indicate neutral sentiment.

Access control requirements

Users must use a role that has been granted the SNOWFLAKE.CORTEX_USER database role. See Required privileges for more information on this privilege.

Example

In this example, a table named reviews contains a column named review_content containing the text of reviews submitted by users. The query returns a sentiment score for each review.

SELECT SNOWFLAKE.CORTEX.SENTIMENT(review_content), review_content FROM reviews LIMIT 10;
Copy
Language: English