nlptown/bert-base-multilingual-uncased-sentiment
Xenova/bert-base-multilingual-uncased-sentiment
text-classification
1. Live 5-Star Multilingual Review Desk
Pick a product review preset in English, German, French, Dutch, Spanish, or Italian, drop or upload a text file, paste (Ctrl/Cmd+V), or type any review below:
.txt, .md, .csv, or .json file here, or press
Ctrl/Cmd+V anywhere outside editable fields. Inference runs locally in a Web Worker.
5-Star Probability Distribution & Raw Logits
Raw logits [1★ .. 5★]: –
See Inside · 105,879-Vocab Uncased mBERT WordPiece
do_lower_case: true and tokenize_chinese_chars: true share one subword table across languages.
2. Why 5-Star Ordinal Sentiment Matters
Binary sentiment models collapse lukewarm praise, mixed reviews, and furious defects into two buckets.
nlptown/bert-base-multilingual-uncased-sentiment preserves a 5-point ordinal head
({"0":"1 star","1":"2 stars","2":"3 stars","3":"4 stars","4":"5 stars"}), letting apps compute
both the top star class and the continuous expected rating E[S] = Σ k·P(k) across six languages
with zero server round-trips.
| Language | FLORES-200 | Fine-Tune Reviews | Exact Star Acc | Off-by-1 Acc |
|---|
import { pipeline } from "https://cdn.jsdelivr.net/npm/@huggingface/transformers@3.7.5";
const classifier = await pipeline(
"text-classification",
"Xenova/bert-base-multilingual-uncased-sentiment",
{ device: "wasm", dtype: "q8" }
);
const scores = await classifier("Great espresso grinder, quiet and solid!", { top_k: 5 });
Show the code · worker.js — classify() (171.16 MB total WASM q8 worker)
Show the code · nlptown-core.mjs — normalizeStarScores()
3. Model Card, Biases & References
- Upstream model card: nlptown/bert-base-multilingual-uncased-sentiment (MIT; 629k product reviews across EN, NL, DE, FR, IT, ES; 93–95% off-by-1 accuracy).
-
ONNX build for Transformers.js:
Xenova/bert-base-multilingual-uncased-sentiment
(
onnx/model_quantized.onnx168.59 MB + tokenizer/configs = 171.16 MB total). - Base architecture: google-bert/bert-base-multilingual-uncased · Paper: Devlin et al. (2018), BERT.