Emotion detection in short text
Identifies the strongest emotion in a short comment or message, choosing from 27 emotions and neutral.
Example
Context
- source
- A comment on an online forum
Input
Just wanted to say thank you to whoever recommended the night nurses at St Aldric's in my last thread. They looked after my dad all week and kept me updated every evening. I honestly couldn't have got through it without you all.
- Answer (JSON)
- value gratitude, confidence 0.934
- Top options
- gratitude 0.934
- caring 0.021
- approval 0.012
A forum post thanking the people who recommended the nurses who looked after the writer's father reads as gratitude.
import os import jeff with jeff.Jeff.remote("https://api.jeffhub.ai", token=os.environ["JEFF_API_KEY"], timeout_s=30) as client: decide = client.function("jeff.language.emotion.emotion", context={ "source": "A comment on an online forum", }) decision = decide("Just wanted to say thank you to whoever recommended the night nurses at St Aldric's in my last thread. They looked after my dad all week and kept me updated every evening. I honestly couldn't have got through it without you all.") print(decision.value, decision.confidence)
More examples
Passed the driving testanswer joy · confidence 0.414
Context
- source
- A comment on an online forum
Input
I finally passed my driving test on the fourth try. I can't stop grinning!
- Answer (JSON)
- value joy, confidence 0.414
- Top options
- joy 0.414
- amusement 0.189
- excitement 0.103
Passing the driving test at the fourth try reads as
joy.import os import jeff with jeff.Jeff.remote("https://api.jeffhub.ai", token=os.environ["JEFF_API_KEY"], timeout_s=30) as client: decide = client.function("jeff.language.emotion.emotion", context={ "source": "A comment on an online forum", }) decision = decide("I finally passed my driving test on the fourth try. I can't stop grinning!") print(decision.value, decision.confidence)
Delivery cancelled for the third timeanswer anger · confidence 0.673
Context
- source
- A comment on an online forum
Input
Third time this month they've cancelled my delivery without telling me. I took another day off work for nothing. I'm absolutely furious.
- Answer (JSON)
- value anger, confidence 0.673
- Top options
- anger 0.673
- annoyance 0.168
- disappointment 0.081
A delivery cancelled for the third time, and a day off wasted, reads as
anger.import os import jeff with jeff.Jeff.remote("https://api.jeffhub.ai", token=os.environ["JEFF_API_KEY"], timeout_s=30) as client: decide = client.function("jeff.language.emotion.emotion", context={ "source": "A comment on an online forum", }) decision = decide("Third time this month they've cancelled my delivery without telling me. I took another day off work for nothing. I'm absolutely furious.") print(decision.value, decision.confidence)
Job interview tomorrowanswer nervousness · confidence 0.483
Context
- source
- A comment on an online forum
Input
My first proper job interview is tomorrow morning and I can't sleep. My hands are shaking just thinking about it.
- Answer (JSON)
- value nervousness, confidence 0.483
- Top options
- nervousness 0.483
- neutral 0.144
- fear 0.07
Shaking hands and no sleep before a first job interview read as
nervousness.import os import jeff with jeff.Jeff.remote("https://api.jeffhub.ai", token=os.environ["JEFF_API_KEY"], timeout_s=30) as client: decide = client.function("jeff.language.emotion.emotion", context={ "source": "A comment on an online forum", }) decision = decide("My first proper job interview is tomorrow morning and I can't sleep. My hands are shaking just thinking about it.") print(decision.value, decision.confidence)
Cat versus the robot hooveranswer amusement · confidence 0.754
Context
- source
- A comment on an online forum
Input
My cat just rode the robot hoover across the kitchen like it was a tiny bus. I laughed so hard I cried.
- Answer (JSON)
- value amusement, confidence 0.754
- Top options
- amusement 0.754
- joy 0.103
- sadness 0.053
A cat riding the robot hoover, and laughing until crying, reads as
amusement.import os import jeff with jeff.Jeff.remote("https://api.jeffhub.ai", token=os.environ["JEFF_API_KEY"], timeout_s=30) as client: decide = client.function("jeff.language.emotion.emotion", context={ "source": "A comment on an online forum", }) decision = decide("My cat just rode the robot hoover across the kitchen like it was a tiny bus. I laughed so hard I cried.") print(decision.value, decision.confidence)
Use when
- You need more detail than positive or negative sentiment, such as gratitude, confusion or disappointment.
- Your input consists of short, informal English comments or messages.
Avoid when
- Your texts are long, formal or in another language.
- You need a clinical or safety assessment, such as self-harm risk; this adapter only identifies emotions.
Context and input
| Field | Kind | Description |
|---|---|---|
comment | input | The comment or message to read. |
source | context | One short phrase on where the text comes from. In training this was always "Reddit comment ([NAME] and [RELIGION] replace removed names)". |
Functions
| Key | Interface | Instructions | Labels |
|---|---|---|---|
| emotion | classify | Which emotion does the comment express most? Choose the emotion that is strongest in the comment, or neutral if it expresses no particular emotion. | admiration, amusement, anger, annoyance, approval, caring, confusion, curiosity, desire, disappointment, disapproval, disgust, embarrassment, excitement, fear, gratitude, grief, joy, love, nervousness, neutral, optimism, pride, realization, relief, remorse, sadness, surprise |
How it was measured
Test accuracy: the share of test rows whose top answer was right.
- 59.8% on the test split of GoEmotions, a public benchmark of 27 emotions and neutral (5,408 rows). public benchmark
When confident
From the calibration set: at or above the threshold confidence, how often the answer is right, and how often the adapter is that confident. Below it, escalate.
| Function | Right when confident | Confident on | Threshold | Calibration rows |
|---|---|---|---|---|
| emotion | 90.1% | 15.1% | 0.85 | 1,000 |
Base: Jeff v1.4. Adapter trained: 25 October 2026.
Base
jeff-base v1.4
Call it
jeff.language.emotion.emotion, with placeholders for its input and context.
import os import jeff with jeff.Jeff.remote("https://api.jeffhub.ai", token=os.environ["JEFF_API_KEY"], timeout_s=30) as client: decide = client.function("jeff.language.emotion.emotion", context={ "source": "<source>", }) decision = decide("<comment>") print(decision.value, decision.confidence)
Download
Weights: mstrasser/jeff-adapter-emotion (v1.4)
Licence: Apache-2.0