Conditional random field · POS tagging

See context change a word’s grammatical role.

Part-of-speech tagging labels words as nouns, verbs, determiners, and more. Enter a sentence, then step through the features and tag-to-tag connections this pre-LLM sequence model scores.

Live browser model

Tag a sentence

Local: your text is not sent anywhere.

Compare context:

The 5.2 MB exported model loads once and is cached by your browser.

Loading the CRF model…

Uses a lightweight demo tokenizer, so complex Universal Dependencies tokenization may differ.

A short introduction

What is a conditional random field?

Observed words and features inform each label; neighboring labels are connected.

A CRF is a discriminative, undirected probabilistic graph model. In a linear-chain CRF, each output label is a node connected to the labels beside it. It extends the idea of logistic regression from one classification to an interconnected sequence of classifications.

That structure makes CRFs useful for sequence labeling: part-of-speech tagging, named entity recognition (NER), and other tasks where nearby labels and observations carry information. This demo combines feature weights with adjacent-tag transition weights, then uses Viterbi decoding to choose the highest-scoring complete path.

About this implementation

Training happens offline in Python. This static page downloads the exported labels, state-feature weights, and transition weights, ports the same feature extraction to JavaScript, and runs first-order Viterbi decoding locally. It does not run sklearn-crfsuite in the browser or substitute a different model.

sklearn-crfsuite docs · python-crfsuite API · CRFsuite source