- カテゴリ:
文字列とバイナリ関数 関数
SENTIMENT (SNOWFLAKE.CORTEX)¶
与えられた英語の入力テキストに対する全体的な感情スコアを返します。
構文¶
SNOWFLAKE.CORTEX.SENTIMENT(<text>) 引数¶
text感情スコアを計算するテキストを含む文字列。
戻り値¶
A floating-point number from -1 to 1 (inclusive) indicating the model's level of certainty of any detected sentiment. A score close to 0 indicates that the function could not determine a clear sentiment in the text; this result can be considered neutral. A score close to 1 indicates positive sentiment, while a score close to -1 indicates negative sentiment. The chart below provides guidance on how to interpret the sentiment scores:
センチメント | センチメントスコア |
|---|---|
肯定的 | 0.5~1 |
中立的 | -0.5~0.5 |
否定的 | -0.5~-1 |
この結果は、感情の強さではなく、極性(肯定的、中立的、否定的)と確信度を示しています。
アクセス制御の要件¶
Users must use a role that has been granted the SNOWFLAKE.CORTEX_USER database role. See Cortex LLM privileges for more information on this privilege.
例¶
次の例では、SENTIMENT を使用して、フードサービスのレビューの感情分類を取得します。
SELECT SNOWFLAKE.CORTEX.SENTIMENT('A tourist\'s delight, in low urban light, Recommended gem, a pizza night sight. Swift arrival, a pleasure so right, Yet, pockets felt lighter, a slight pricey bite. 💰🍕🚀'); 応答:
0.5424458 この例では、 reviews という名前のテーブルに review_content という名前の列があり、ユーザーが投稿したレビューのテキストが格納されています。クエリは、各レビューの感情スコアを返します。
SELECT SNOWFLAKE.CORTEX.SENTIMENT(review_content), review_content FROM reviews LIMIT 10; 法的通知¶
Snowflake AI と ML をご参照ください。
制限事項¶
Snowflake Cortex関数は動的テーブルをサポートしていません。