← All models

token-classification · text · WASM · ~113 MB

Part-of-speech tagging — name every word's job

Where NER asks which words are names, part-of-speech tagging asks a different question of every word: what is its grammatical role? Noun, verb, adjective, preposition, pronoun… This model reads a sentence and hands back one grammatical tag per token — the scaffolding under grammar, readability and keyword extraction. Type below and watch each word colour by its part of speech, then look inside at the raw tags. All on your device.

Honest note on language: this runs Xenova/french-camembert-postag-model, a French POS tagger — at build time no English or universal POS tagger shipped a transformers.js/ONNX build, but this French CamemBERT does and runs in the browser today. So the examples are in French, with an English gloss. The capability — one grammatical tag per word — is exactly the same in any language.

At a glance

ModelXenova/french-camembert-postag-model (ONNX of gilf/french-camembert-postag-model)
Task / pipelinetoken-classification
Labels30 French TreeBank (FTB) tags — NC, NPP, V, ADJ, DET, P, CLS… — folded here into 11 universal groups
ArchitectureCamemBERT (RoBERTa-based, SentencePiece, ~110M params) fine-tuned for POS
LanguageFrench (see the note above — the closest working ONNX POS tagger)
Quantizationq8 (8-bit) ONNX
BackendWebAssembly (runs anywhere; no WebGPU needed)
Download~113 MB, cached after first load
LicenseMIT
Web APIsWebAssembly, Web Workers — all Baseline widely available

Run it

Type or paste a French sentence. Each word is coloured by its part of speech a moment after you stop typing; hover a word for its FTB tag and confidence.

“The old black cat sleeps quietly on the living-room sofa.”

See inside — raw tags & sentence structure

The model doesn't see whole words — it tags each SentencePiece sub-token independently (the ▁, shown here as ·, marks where a new word begins). We take the word-initial tag as the word's part of speech and merge the pieces. Below are the raw per-token FTB tags and confidences straight from the model, plus a structure view: the sentence's grammatical rhythm as a coloured ribbon, and how the parts of speech are distributed.

Raw sub-token tags

Structure

Why it matters

POS tags are the grammatical skeleton a lot of language tooling stands on. Once you know each word's role, you can pull the right words out, measure how text reads, or transform it by rule — and doing it in the browser means the text never leaves the device.

Use cases

Basics

Tag any French sentence and see every word colour-coded by its part of speech, with the confidence.

Practical

Extract keywords by POS and profile a text's style — content-word ratio, adjective and verb density.

Wild

Mad-Libs: blank out every word of a chosen part of speech, then fill the gaps for a silly new sentence.

Multi-model

POS picks which words to hide; CamemBERT fill-mask reimagines them into a fresh, grammatical sentence.

How the API works

Token classification is one pipeline call:

import { pipeline } from "@huggingface/transformers";

const pos = await pipeline("token-classification", "Xenova/french-camembert-postag-model");
const out = await pos("Le chat noir dort.");
// → [{ entity: "DET", word: "▁Le",  score: 0.99, index: 1 },
//    { entity: "NC",  word: "▁chat", score: 0.99, index: 2 },
//    { entity: "ADJ", word: "▁noir", score: 0.98, index: 3 },
//    { entity: "V",   word: "▁dort", score: 0.97, index: 4 },
//    { entity: "PONCT", word: "▁.",  score: 0.99, index: 5 }]

The pipeline returns one FTB-tagged row per SentencePiece sub-token — with a ▁ marking each word start but no character offsets. We merge sub-word pieces into whole words (taking the word-initial tag), map each word back to its span in the original text so highlights land exactly, and fold the 30 FTB tags into 11 universal groups for the colour legend. It all runs in a Web Worker so typing stays smooth.

References