surfaceanalysissentiment
Analysisaggregate · returns double

SENTIMENT

Aggregate sentiment score (-1.0 to 1.0) for a collection of texts

Per-group — reads the whole group in one call.

analysishybridspecialist-zooscales-largejson

Syntax

SENTIMENT_AGG({{ texts }})

Arguments

nametypedescription
textsJSON

About

Aggregate sentiment analysis — returns ONE overall sentiment score (-1.0 to 1.0) for an entire collection of texts. Backend: specialist zoo (twitter-roberta-base-sentiment-latest via TEI). All texts in the collection are scored in a single batched GPU call, then averaged. No LLM in the hot path; the context-window problem that plagued the LLM-based version (5000 reviews in one prompt) is gone. Call as: SELECT SENTIMENT_AGG(review) FROM reviews; SELECT category, SENTIMENT_AGG(review) FROM reviews GROUP BY category; RELATED OPERATORS (same root name, different shapes): • semantic_sentiment_scalar (SCALAR) call as SENTIMENT_SCALAR(col) in a SELECT list for a per-row numeric sentiment score (-1.0 to 1.0) • sentiment (DIMENSION) use in GROUP BY to auto-cluster rows into labeled sentiment buckets e.g. GROUP BY sentiment(review)

Examples

Positive reviews should return positive sentiment score

WITH
  test_data AS (
    SELECT
      *
    FROM
      (
        VALUES
          ('I absolutely love this product!'),
          ('Best purchase I ever made'),
          ('Fantastic quality and service'),
          ('Highly recommend to everyone')
      ) AS t (review)
  )
SELECT
  SENTIMENT_AGG (review)
FROM
  test_data

Nearby rabbit holes

same domain
Climb back to The Looking Glass