token-classification ยท text ยท WASM ยท ~110 MB
Named-entity recognition reads a sentence and labels each span: who (PersonPER), what organization (OrgORG), where (LocationLOC), and other proper nouns (MiscMISC). Type below and watch the entities light up โ then look inside at the per-token tags. All on your device.
| Model | Xenova/bert-base-NER (ONNX build of dslim/bert-base-NER) |
|---|---|
| Task / pipeline | token-classification |
| Labels | BIO tags over 4 classes: PER, ORG, LOC, MISC (CoNLL-2003) |
| Architecture | BERT-base cased (12 layers, 108M params) fine-tuned for NER |
| Quantization | q8 (8-bit) ONNX |
| Backend | WebAssembly (runs anywhere; no WebGPU needed) |
| Download | ~110 MB, cached after first load |
| License | MIT |
| Web APIs | WebAssembly, Web Workers โ all Baseline widely available |
Type or paste text. Entities are highlighted inline a moment after you stop typing; hover a highlight for its confidence.
The model doesn't see "Angela Merkel" as one thing โ it tags each WordPiece token
independently: B-PER (begin person), I-PER (inside person), and so on.
We then stitch consecutive B-/I- runs into whole entities. Below are the raw tags and
confidences straight from the model โ including the occasional wobble (watch a stray
I-ORG on a preposition), which is exactly why the confidence matters.
NER turns free text into structured data โ the names and places a downstream system can actually act on. Doing it in the browser means you can index, redact, or link entities without a single byte of the source text leaving the device.
Type text and see people, orgs and places highlighted inline with confidences.
Redact PII on-device, and extract entities into a structured, grouped list.
Build a co-occurrence graph โ who and what appear together across a paragraph.
Link entity mentions across sentences by meaning with MiniLM embeddings.
Token classification is one pipeline call:
import { pipeline } from "@huggingface/transformers";
const ner = await pipeline("token-classification", "Xenova/bert-base-NER");
const out = await ner("Tim Cook runs Apple in California");
// โ [{ entity: "B-PER", word: "Tim", score: 0.999, index: 1 },
// { entity: "I-PER", word: "Cook", score: 0.999, index: 2 },
// { entity: "B-ORG", word: "Apple", score: 0.998, index: 4 },
// { entity: "B-LOC", word: "California", score: 0.994, index: 6 }]
The pipeline returns one BIO-tagged row per WordPiece token, but no character offsets. We map each
token back to its span in the original text (a cursor-walk) so highlights land exactly, then merge
B-/I- runs (and ## sub-word pieces) into whole entities with a pooled
confidence. It all runs in a Web Worker so typing stays smooth.