DEJAN AI Sentiment Classifier

This is a text sentiment classifier trained by DEJAN AI, small enough to run over thousands of pages on a laptop. Read how we built it, with training data, charts and results: DEJAN releases a free sentiment model. Try it in the public demo.

Score Label
0 very positive
1 positive
2 somewhat positive
3 neutral
4 somewhat negative
5 negative
6 very negative

Feed it one sentence at a time, not a whole page. The model reads up to about 90 words and ignores the rest. To score a page, split it into sentences and score each one. The example below shows how.

What you can use it for

  • Reviews: score your own and competitors' reviews sentence by sentence, and find exactly which product features people praise or complain about.
  • Brand mentions: measure how your brand is talked about in articles, forums, social posts, and AI answers.
  • Content audits: find negative or off-tone sentences on landing pages, product pages, and service pages before users do.
  • Competitor pages: compare how positive your comparison and product pages are against the pages that outrank you.
  • SERP research: see whether the top-ranking content for a query is enthusiastic, balanced, or critical.

It understands the formats you work with: product pages, reviews, comparisons, FAQs, blog posts, press releases, forum threads, tweets, transcripts, and tables.

How accurate is it

Exact score 84%
Exact or one point off 95%

When it misses, it is almost always by one point, for example "negative" instead of "somewhat negative".

image

image

image

Quick start

from transformers import pipeline

clf = pipeline("text-classification", model="dejanai/sentiment-classifier")
clf("Delivery took three weeks and nobody answered my emails.")
# [{'label': 'negative', 'score': 0.88}]

Scoring a whole page

import re
from transformers import pipeline

clf = pipeline("text-classification", model="dejanai/sentiment-classifier")

def sentences(text):
    for line in text.splitlines():
        line = re.sub(r"^\s*(#+|[-*+]|\d+[.)])\s*", "", line).replace("**", "").strip()
        if line:
            yield from (s for s in re.split(r"(?<=[.!?])\s+(?=[A-Z0-9\"'])", line) if s)

page = """# Six months with the X200
The battery is superb. The camera, sadly, is a step backwards.
- Price: $499
- Software updates have been slow."""

parts = list(sentences(page))
for part, result in zip(parts, clf(parts)):
    print(result["label"], "|", part)

Good to know

  • English only.
  • Each sentence is scored on its own, so a sentence like "And yet it works" may be misread without the sentence before it.
  • Trained on about 83,000 sentences written and scored by AI across 26 content types. It has not yet been tested on real-world review datasets.

License

Released under the DEJAN link attribution license. Built on Google's Gemma, so use is also subject to the Gemma Terms of Use.

Downloads last month
-
Safetensors
Model size
0.3B params
Tensor type
BF16
Β·
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for dejanai/sentiment-classifier

Finetuned
(166)
this model

Spaces using dejanai/sentiment-classifier 2