Review Sentiment Analysis - Positive or Negative, No API Key avatar

Review Sentiment Analysis - Positive or Negative, No API Key

Pricing

from $0.40 / 1,000 texts

Go to Apify Store
Review Sentiment Analysis - Positive or Negative, No API Key

Review Sentiment Analysis - Positive or Negative, No API Key

Score the sentiment of reviews, comments and survey answers in many languages with a model that runs inside the Actor. No API key, no external AI service. Runs straight after a review scraper.

Pricing

from $0.40 / 1,000 texts

Rating

0.0

(0)

Developer

Northbell

Northbell

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

2 days ago

Last modified

Features

Limited permissions

Share

Score the sentiment of reviews, comments and survey answers: positive, neutral or negative, with a score from -1 to 1. The model runs inside the Actor. No OpenAI or other AI key, no account, no external service: your texts never leave the run. Built to run right after a review or comment scraper.

Try it now - the input is already filled in. Press Start. It scores six made-up reviews in English, Spanish and Japanese. In our own local run: all six came back on the expected side (3 positive, 2 negative, and the Spanish "late delivery but it works" review as neutral, score 0.03), in about 4 seconds including loading the model. Cost: 6 texts = $0.003 (plus $0.00005 for the run start).

Speed: a synthetic run of 2,000 English reviews (30 to 130 words each) took 119 seconds on our test PC (about 17 texts per second) and peaked at 745 MB of memory. On Apify, expect the same order of speed, depending on the CPU you get. 2,000 texts cost $1.00.

What you pay

EventPriceWhen
text-scored$0.0005per scored text ($0.50 per 1,000)
apify-actor-start$0.00005once per run
  • You are charged for a batch of texts only after its rows are saved in the dataset. Empty texts, rows without text and texts skipped by "Only new texts" are free.
  • Set "Maximum total charge" on the run as your cap. The Actor checks it before scoring each batch and stops cleanly when the next batch does not fit.

What you get

One dataset row per text:

{ "id": "r-1042", "url": "https://example.com/reviews/1042", "rating": 2,
"status": "ok", "sentiment": "negative", "score": -0.87, "confidence": 0.93, "language": "en" }
  • sentiment: positive, neutral or negative.
  • score: from -1 (very negative) to 1 (very positive).
  • confidence: how much of the model's probability sits on the chosen side (0 to 1). Low values (below about 0.6) mean mixed or unclear text.
  • language: detected language code (en, es, ja...), or null when the text is too short to tell.
  • status: ok, or skipped (empty text, or already scored) with a reason. Skipped rows are free.
  • The fields you list in keepFields are copied from the source row (default url, id, rating), so you can join the results back to the reviews. With plain texts input the row has index instead.
  • The text itself is not in the result unless you turn on includeText. Nothing else of the source row is copied, and the Actor never writes your texts to the log.

The run's OUTPUT record (key-value store) holds the summary: counts of positive, neutral and negative, the average score, and the same per value of groupBy (for example per product or per place):

{ "scored": 2000, "overall": { "count": 2000, "positive": 936, "neutral": 342, "negative": 722, "averageScore": 0.119 },
"groups": { "P0": { "count": 667, "positive": 304, "neutral": 125, "negative": 238, "averageScore": 0.111 } } }

Run it after your review scraper

  1. In Apify Console, open the scraper Actor and go to Integrations.
  2. Add Run Actor (on "Run succeeded") and pick this Actor.
  3. Use an input like this, with the name of the field that holds the review text:
{
"datasetId": "{{resource.defaultDatasetId}}",
"textField": "text",
"keepFields": ["url", "id", "rating"],
"groupBy": "placeName",
"onlyNew": true
}

A dotted path such as review.body reaches into nested fields. Rows without text are skipped, free.

Run it on a schedule with only new reviews

Turn on onlyNew and schedule the run. The Actor keeps a list of what it has scored in a key-value store named review-sentiment-seen in your account: only a short hash of each text (lower-cased), never the text. Texts already scored come back as skipped rows and are not charged. Texts that were not processed (over maxItems, or stopped at a charge limit) are not marked as done, so the next run picks them up. If the store cannot be opened, the run stops before charging anything.

Input

InputDefaultWhat it does
textssix made-up reviewstexts to score, one per line
datasetId, textFieldnone, textread texts from another Actor's dataset (dotted path allowed)
keepFieldsurl, id, ratingfields copied from the source row
groupBynonefield to summarise by in the OUTPUT record (up to 1,000 values)
includeTextoffalso put the text in the result rows
onlyNewoffskip texts scored in an earlier run
maxItems50,000cap on scored texts per run

Texts are cut at 512 tokens (roughly the first 300 to 400 words). Long reviews are scored on their opening.

The model

  • Model: Xenova/bert-base-multilingual-uncased-sentiment, revision fad9b372f770c208d2efaf00d02f2cb3b61ec450, the 8-bit quantized ONNX file (onnx/model_quantized.onnx), run with transformers.js (@huggingface/transformers) on the CPU. It is the ONNX conversion of nlptown/bert-base-multilingual-uncased-sentiment (revision 8f6f4e3a8f70be4b65d3a4a8762b6d781cda240d).
  • Licence: MIT. The model card of the original, nlptown/bert-base-multilingual-uncased-sentiment, states license: mit. The ONNX repository card itself names that model as its base and states no licence of its own.
  • Inside the image: the files are downloaded once when the Actor is built. A run never contacts the model host (remote models are switched off).
  • It predicts 1 to 5 stars. The Actor turns the five probabilities into a score (1 star = -1, 2 = -0.5, 3 = 0, 4 = 0.5, 5 = 1, weighted by probability). Below -0.25 is negative, above 0.25 is positive, in between neutral.
  • Language detection uses tinyld (MIT).

NOTICE

This Actor contains the model nlptown/bert-base-multilingual-uncased-sentiment (MIT licence, NLP Town), converted to ONNX by Xenova, and runs it with transformers.js (Apache-2.0). Language detection: tinyld (MIT). The MIT licence permits use, copying, modification and distribution of the software, provided the copyright notice and permission notice are included; the software is provided "as is", without warranty of any kind.

Languages

The model was fine-tuned on product reviews in English, Dutch, German, French, Italian and Spanish. It is built on multilingual BERT, which knows many more languages, so Portuguese, Japanese and others work but are less reliable than those six. We tested clear positive and negative sentences in English, Spanish and Japanese (all got the expected side). Subtle Japanese text is the weak spot: in an early trial, a mildly negative Japanese review about slow delivery came back positive. Check a sample in your language first.

Limits

  • A model, not a human: check samples. Read 30 to 50 results in your own data before you rely on the numbers. Sarcasm, mixed reviews ("late but works"), very short texts and domain slang are where it goes wrong.
  • Trained on product reviews. Tweets, news, legal text and support tickets may score less well.
  • Scores can move by a few hundredths between runs, because the 8-bit model's arithmetic depends slightly on which texts share a batch. Labels near the +-0.25 lines can flip.
  • Neutral is the 3-star middle: a review that is half good and half bad often lands there.
  • Language detection is a guess on very short texts.
  • Speed is roughly 17 texts per second on our test PC; 100,000 texts is about 1.6 hours. Raise the run timeout for big datasets; the Actor stops cleanly shortly before the time limit.