Emotion ยท by Hoverfly

Know how a message
feels, on the device.

Find the emotions in an English message, several at once: joy, gratitude, anger, sadness, nervousness and 23 more, plus an overall mood. 6 MB, 0.3 ms per message, no network.

Get started View source

Free up to 10k monthly active devices ยท No API key ยท On Maven Central ยท Android, iOS, desktop, web

emotion.detect(message)
Finally got the job!! Thank you so much for helping me ๐Ÿ™
๐Ÿ™gratitude99%
๐Ÿ˜ŠMood: positive ยท never left the phone
Live demo

Try the real model, right here

This is the actual Emotion library, compiled to WebAssembly and running in your browser. Type any English message and see the feelings behind it. Your text never leaves this page.

Loading the model (~7 MB)โ€ฆ
Updates as you type
Why Emotion

Feelings, not just positive or negative

Sentiment tells you a message is negative. Emotion tells you it is nervous, or disappointed, or angry, so your app can answer the right way.

28 emotions, several at once

The 27 GoEmotions emotions plus neutral, each with a score and its own tuned threshold. "Got the job, thank you!!" is joy and gratitude.

Mood and basic emotions

Every result also has a mood (positive, negative, ambiguous, neutral) and Ekman's six basic emotions, for apps that need a simpler answer.

No dependencies

Pure Kotlin inference. There is no ONNX Runtime, TFLite, ML Kit or native code, and it runs on Android (minSdk 21), iOS, macOS, JVM desktop, JavaScript and WebAssembly, from Kotlin or Java.

Private by design

Diaries, chats and reviews are personal. Emotion reads them on the device; nothing is sent anywhere to be analysed.

~3ms
Per message
on an Android emulator
~6MB
On-device
model + tokenizer
28
Emotions
plus mood and 6 basic
0
Dependencies
no native code
On device

Type a message, see how it feels

Real output from the sample app on an Android emulator. These are not mockups.

Gratitude

Gratitude

Good news and a thank-you

Annoyance

Annoyance

A frustrated customer, not a question

Sadness

Sadness

Missing someone

Neutral

Neutral

Just information

Same library on every platform

The Kotlin Multiplatform sample app, built from the published artifacts, gives the same result on Android, iOS, desktop and the web.

Emotion sample on Android

Android

Finally got the job!! โ†’ Positive ยท gratitude 99%

Emotion sample on iOS

iOS

Finally got the job!! โ†’ Positive ยท gratitude 99%

Emotion sample on Desktop (JVM)

Desktop (JVM)

Finally got the job!! โ†’ Positive ยท gratitude 99%

Emotion sample on Web (Wasm)

Web (Wasm)

Finally got the job!! โ†’ Positive ยท gratitude 99%

Install

Add it to your build

One line in your Gradle file, from Maven Central. Works in commonMain for Android, iOS, macOS, JVM desktop, JavaScript and WebAssembly. No API key, no account.

Maven Central live
// build.gradle.kts: commonMain, or any platform source set
dependencies {
    implementation("io.github.rajumark:emotion:2.0.0")
}

// Gradle picks the right artifact per platform:
// emotion-android ยท emotion-jvm ยท emotion-iosarm64 ยท emotion-iossimulatorarm64
// emotion-macosarm64 ยท emotion-js ยท emotion-wasm-js
Build with a prompt
Add Emotion from rajumark to this Kotlin Multiplatform or Android project.

What it does: on-device emotion detection for English. It finds the emotions in a message (27 GoEmotions emotions such as joy, gratitude, anger, sadness, nervousness, plus neutral; several at once) and an overall mood. ~6 MB, no dependencies, no network.

Install (Maven Central, no extra repository):
  build.gradle.kts (commonMain or any source set): implementation("io.github.rajumark:emotion:2.0.0")
  Platforms: Android, iOS, macOS, JVM desktop, JavaScript, WebAssembly

Usage:
  val emotion = Emotion()          // off the main thread, keep one instance
  val r = emotion.detect(message)
  r.emotions                              // [joy 0.83, gratitude 0.78]  (label + score, best first)
  r.top                                   // Label.JOY
  r.mood                                  // Mood.POSITIVE

Repo: https://github.com/rajumark/emotion#readme
Add the dependency, then follow the README for the exact API and current version.
Usage

One call per message

Load once and reuse the instance. detect() is thread-safe.

Kotlin
val emotion = Emotion()

val r = emotion.detect("Finally got the job!! Thank you so much for helping me ๐Ÿ™")
r.emotions   // [gratitude 0.99]
r.top        // Label.GRATITUDE
r.mood       // Mood.POSITIVE
r.basic[0]   // joy 1.00

emotion.close()
Java
try (Emotion emotion = new Emotion()) {
    Result r = emotion.detect("I miss my grandma so much today");
    if (r.getMood() == Mood.NEGATIVE) {
        // offer a kinder reply, a helpline, or a softer UI
    }
}
Use cases

Where Emotion fits

Anywhere people write how they feel, and your app should notice.

Support & reviews

Send angry or disappointed customers to a human first, and thank the happy ones.

"The app keeps crashing and nobody reโ€ฆ" โ†’ disappointment ยท negative

Journaling & wellbeing

Tag diary entries with their feelings and show mood over the week, without the text ever leaving the phone.

"Long day, but the walk by the lake mโ€ฆ" โ†’ gratitude, joy ยท positive

Chat & keyboards

Suggest the right emoji, sticker or reply for how the other person feels.

"OMG we won the match!!! ๐ŸŽ‰" โ†’ joy, excitement ยท positive

Companions & assistants

Let a chatbot or game character react to fear, sadness or excitement before it answers.

"I'm scared about the surgery tomorrow" โ†’ fear ยท negative
App ideas

20 apps you could build with Emotion

Real problems Emotion solves today. Pick one and ship it.

Mood journal ยท Tag each diary entry with its emotions and chart the week.

Support triage ยท Put angry and disappointed tickets at the top of the queue.

Review insights ยท See which reviews are joy, which are annoyance, and why.

Emoji suggestions ยท Suggest emojis that match the feeling, not only the words.

Smart replies ยท Offer "congrats!" for joy and "I'm sorry" for sadness.

Empathetic chatbots ยท Give the bot the user's mood before it answers.

Wellbeing check-ins ยท Notice nervousness or sadness and suggest a break.

Tone check before send ยท Warn "this sounds angry" before an email or message goes out.

Mood music ยท Pick a playlist from how the user's last messages feel.

Reactive game characters ยท NPCs that answer the player's excitement or fear.

Survey analytics ยท Turn free-text answers into emotion counts, on the device.

Shopping feedback ยท Spot disappointment in order feedback and follow up.

Learning apps ยท Notice confusion in a student's question and explain again.

Photo captions ยท Pick stickers and filters that match the caption's mood.

Writing coach ยท Show writers which emotion each paragraph carries.

Community health ยท Watch how a group chat feels over time, without reading it on a server.

Voice notes ยท Run it on the transcript and tag each note with its mood.

Gratitude tracker ยท Collect the thank-you messages a user got this month.

Story readers ยท Change colours or music as a story's mood changes.

Team pulse ยท Anonymous mood from stand-up notes, computed on each phone.

Quality

Honest numbers

107 fresh everyday messages written by hand after training, never used to build, tune or pick any model, and the GoEmotions test set (5,427 Reddit comments, several raters each). Every model gets its own per-emotion thresholds, tuned the same way on the validation set.

EmotionRoBERTa-base GoEmotionsMiniLM GoEmotionsModernBERT-large GoEmotions
Fresh everyday messages: top emotion right38.3%35.5%33.6%33.6%
Fresh everyday messages: mood right46.7%40.2%43.0%35.5%
Fresh everyday messages: basic emotions, macro-F10.4580.4820.4100.476
GoEmotions test: top emotion right61.0%63.6%60.6%66.2%
GoEmotions test: macro-F1, 28 emotions0.4750.5220.5100.538
GoEmotions test: mood right70.3%73.7%72.5%75.4%
Size6.4 MB499 MB121 MB1583 MB
Latency, one message, 1 CPU thread (laptop)~0.3 ms~17 ms~2.6 ms~60 ms

RoBERTa-base is a widely used GoEmotions model; ModernBERT-large is the large model Emotion learned from. On GoEmotions' own Reddit comments the larger models are ahead (macro-F1 0.475 vs 0.522 for RoBERTa-base). On everyday messages, where the emotion is often implied rather than named, Emotion is ahead, while being 78ร— smaller and 60ร— faster than RoBERTa-base. Where it falls short: sarcasm ("oh great, it's raining on my day off"), subtle approval and disapproval, and a few plain messages with times in them read as excitement.

Reference

API at a glance

MemberDescription
Emotion()Loads the bundled model. Implements AutoCloseable.
detect(text)Returns a Result. Thread-safe. A blank text is neutral.
Result.emotionsThe emotions that pass their thresholds, best first, as Score(label, score). Never empty.
Result.top, Result.moodThe most likely Label, and the overall Mood.
Result.all, Result.basicAll 28 scores; the 7 basic emotions as BasicScore(emotion, score).
LabelADMIRATION AMUSEMENT ANGER ANNOYANCE APPROVAL CARING CONFUSION CURIOSITY DESIRE DISAPPOINTMENT DISAPPROVAL DISGUST EMBARRASSMENT EXCITEMENT FEAR GRATITUDE GRIEF JOY LOVE NERVOUSNESS OPTIMISM PRIDE REALIZATION RELIEF REMORSE SADNESS SURPRISE NEUTRAL; each has a mood.
Mood, BasicEmotionPOSITIVE NEGATIVE AMBIGUOUS NEUTRAL; ANGER DISGUST FEAR JOY SADNESS SURPRISE NEUTRAL
Pricing & license

Free until you're big.

No API key, no sign-up, no license file. Add Emotion to your project and ship. It stays free until your product passes 10,000 monthly active devices, and there's never a limit on how often each device runs it.

Commercial
Let's talk

For products above 10,000 monthly active devices on any platform.

  • One license per product, per model
  • Pricing that fits your scale
  • Direct support from the people who built it
  • Early access to model updates
Custom models
Built for you

A small, fast on-device model trained for your language, domain or task.

  • Privacy filters, moderation, classification, replies and more
  • Tuned on your use case and your users' languages
  • Shipped as a plain Kotlin library, like Emotion
  • Private: your model runs on your users' devices

How devices are counted

A monthly active device is a phone, tablet or other device that runs Emotion at least once in a calendar month.

The 10,000 limit applies separately to each product, each platform (Android, iOS, webโ€ฆ) and each Hoverfly model. Crossed it? You have 30 days to get a commercial license.

What the license does not allow

  • Selling or redistributing Emotion or its model on its own, or inside another SDK
  • Extracting, modifying or fine-tuning the model weights
  • Using the model or its outputs to train or distill another model
  • Reverse engineering the model or its file format
  • Offering it as a hosted API for others

Questions about licensing? Email raju348636@gmail.com or call / WhatsApp +91 63533 21951. Full terms: Hoverfly Community License.

FAQ

Questions

What is Emotion?

A Kotlin Multiplatform library (Android, iOS, macOS, JVM desktop, JavaScript, WebAssembly) that reads an English message and tells you which emotions it carries, out of 27 plus neutral, with a score for each, an overall mood and Ekman's six basic emotions.

Which languages does it support?

English only, including informal chat English, slang and emojis. Other languages and Hinglish are not supported.

Why can a message have several emotions?

Because people write that way: "Finally got the job, thank you so much!" is joy and gratitude. Each emotion has its own threshold, so emotions lists every one that is clearly there, best first.

How accurate is it?

Emotions are subjective, and many messages carry several at once, so no model is close to perfect. On fresh everyday messages, where the emotion is often implied ("waiting outside the principal's office"), Emotion names the top emotion right 38% of the time, ahead of every model we compared, including models 20 to 250 times larger (RoBERTa-base: 36%). On clear, explicit messages it is right far more often. See Quality.

How fast is it?

About 0.3 ms per message on one laptop CPU thread, and a few milliseconds on a phone. Load it once, off the main thread, and reuse it.

How was it trained?

On GoEmotions (Google, Apache 2.0), XED English and BRIGHTER English (CC BY 4.0), and on about a million everyday English sentences labelled by a large GoEmotions model that Emotion learned from.

Does it run on device?

Yes. Inference runs entirely on the device in plain Kotlin. It makes no server calls, needs no network permission and sends no telemetry.

Is the Kotlin port exact?

Token ids and every score match the reference implementation on all 184 test vectors, both on the JVM and on an Android device.

How much does Emotion cost?

Nothing for products with up to 10,000 monthly active devices per platform, including commercial apps. There is no API key or account, and no limit on how often it runs. Above that, a commercial license is needed; see Pricing.

Can you build a model for my app?

Yes. Hoverfly trains custom on-device models for your language, domain or task and ships them as a small library like this one. Email raju348636@gmail.com or call / WhatsApp +91 63533 21951.

A note from the creator

Built by a developer, for developers.

Every model here started as a problem I hit in my own apps. I made them small, private and free to start, so you can spend your time on the part your users will love.

Raju ShingadiyaAndroid developer ยท creator of Hoverfly
Meet the maker
The Hoverfly family

Emotion is one of eight.

Eight small on-device models, one job each. Same install, same free tier, and the same promise: nothing leaves the device.

MojiEmoji suggestionsThe right emoji for any message, in 22 languages. BeaconLanguage detectionLanguage and script of any text, Hinglish included. CommaPunctuationTurns voice-typed text into readable sentences. ComebackSmart repliesThree tap-to-send replies for every message.
EmotionEmotion detection28 emotions and an overall mood, per message.You're here
GatekeeperToxicity detectionCatches abuse and threats in Indian chat. HideoutPersonal info hidingHides phones, UPI, Aadhaar and more. ChalkDoodle recognitionGuesses 345 things from pen strokes, live.
View all models Hoverfly home