When we decided to create a sentiment analyser, the request came from people who needed to grasp the tone of reviews or customer messages quickly, without relying on external services. Privacy was the main objective: we wanted every evaluation to stay on the user’s machine.
From idea to prototype
We started by studying public datasets with sentences labelled as positive, neutral, or negative. We didn’t aim to publish an academic paper: the goal was a lightweight, pre-trained model that could be loaded easily in the browser. TensorFlow.js was the natural choice because it lets us exploit the GPU without any installation.
To reduce mistakes caused by language differences, we built a small text-cleaning pipeline (removing duplicated emojis, normalising special characters, handling uppercase letters). Only after that does the text reach the model, which returns the probability for each tone.
How the app works today
In the Text Classifier you can focus solely on sentiment or also retrieve the primary language of the message. Everything happens locally: the browser downloads the model the first time and then reuses it, so subsequent analyses are almost immediate.
When you submit text, the interface shows:
- a qualitative label (positive, neutral, negative) based on the highest probability;
- a score from 0 to 1 to help you evaluate how confident the prediction is;
- a bar chart that compares the three values.
These pieces of information are designed for quick operational decisions: reply to a complaint, highlight enthusiastic testimonials, sort tickets by urgency.
Limits to keep in mind
Despite our attention to detail, a general-purpose model cannot capture every nuance. Ironic expressions or cultural references may be interpreted the wrong way. Very short texts (for example “ok”) provide little context and can end up classified as neutral.
The model was trained on multilingual data but favours Italian and English: for languages that are less represented in the dataset, the confidence tends to drop. In highly regulated scenarios (finance, healthcare) we still recommend a human validation before relying on the predictions.
Lastly, we rely on public JavaScript libraries executed locally on your computer or smartphone, with all the consequences that entails in terms of computing power.
Where we want to go next
We are already testing three improvements:
- Fine-tuning on custom data: allow companies to upload their own examples to train a language profile aligned with the brand.
- Recognition of specific emotions: go beyond the simple positive/negative split to distinguish anger, joy, or frustration.
- Workflow integration: export results to CRMs and help desks via webhooks or CSV files.
As long as the model remains lightweight and transparent about its limits, we believe it is a useful tool for anyone who wants a first snapshot of sentiment without depending on external platforms. The key is to use it as an ally, not as the only judge.