Skip to content
Catalog

cn8/text-sentiment

Send a piece of text and get its sentiment back: a label (positive, negative or

Learn more about Sentiment Analysis
Text NLPsyncInstant previewtextanalysisnlp

Try it

Texts to analyzeOne text per line — each line gets its own verdict.

Result

Results show up here

The sample input is ready — just hit Run.

Overview

Send a piece of text and get its sentiment back: a label (positive, negative or neutral), a confidence score, a continuous polarity from -1 to +1, a 1–5 star rating, and the detected language. Responses are synchronous — one request, one result. Ideal for scoring reviews, comments, support messages and survey answers.

Key capabilities

Sentiment label + confidence

Each text is classified as positive, negative or neutral, with a confidence score from 0 to 1.

Polarity score

A continuous value from -1 (very negative) to +1 (very positive) for finer-grained ranking.

1–5 star rating

A familiar star rating ("1 stars" … "5 stars") derived from the polarity — handy for review dashboards.

Automatic language detection

The detected language is returned with every result, so you don't need a separate detection step.

When to use it

Review & rating analysis

Score customer reviews and map them to stars for dashboards and alerts.

Social listening

Track positive and negative trends across mentions, comments and posts.

Support triage

Surface negative messages in support queues so they're answered first.

Input & output

input

A single text to analyze (sent as a one-element texts array).

JSON body

output

One result with label, confidence score, polarity, star rating, is_positive and detected language.

JSON

Guides & tips

How it works

  • Your text is classified as positive, negative or neutral by a sentiment model.
  • Polarity is a continuous reading from -1 to +1; the star rating maps that polarity to a familiar 1–5 scale.
  • The response also reports the language it detected, so you can branch on it without a separate call.

Tips

  • Use the field name texts (an array), and send one text per request.
  • To analyze many texts, call the endpoint once per text and collect the results.
  • For finer-grained emotions (joy, anger, …) see Emotion Detection; for your own custom labels see Zero-Shot Classification.

Specs

Latency
Typically 0.5–2 seconds
Async
false
Rate Limit
Per API key
Max Input
A few thousand characters per text

Schema

Request body

textsrequiredarray<string>

The text to analyze, as a one-element array. Send one text per request.

Response

results[].labelstring

Sentiment label: positive, negative or neutral.

results[].scorenumber

Confidence of the label, from 0 to 1.

results[].starsstring

1–5 star rating as a string, e.g. "5 stars".

results[].is_positiveboolean

True when the label is positive — a convenience flag.

results[].polaritynumber

Continuous polarity from -1 (very negative) to +1 (very positive).

results[].languagestring

Detected language of the text (ISO 639-1).

Pricing

Billed per request.

ServiceUnitPrice
Sentiment Analysisitem$0.002/request

FAQ

Related models