Token classification in NLP
What token classification in NLP does, how it differs from related tasks, when it fits your use, and how its labeled output holds up when copied or shared.
Token classification is a natural language processing task that assigns a label to each token in a piece of text. Named entity recognition, part-of-speech tagging and phrase chunking are the most familiar examples. This review covers what the task changes in your text, when it fits a workflow, and how its output holds up when you copy, share or reuse it.
How token classification differs from related tasks
Three tasks are often confused with it. Tokenization splits text into units and assigns no meaning to them. Sequence or text classification gives one label to a whole sentence or document, such as a sentiment or a topic. Text generation produces new text. Token classification sits between tokenization and sequence classification: it keeps the original units and gives each one its own label.
| Task | What gets labeled | Typical output |
| Tokenization | Nothing; text is only split | A list of tokens |
| Token classification | Each token | One label per token, or labeled spans |
| Sequence (text) classification | The whole text | One label per text |
| Text generation | Not applicable | New text |
Is token classification suitable for your use?
Token classification is a good choice when you need to know where something occurs in a text and not only whether it occurs. Its main benefit is position-level structure: you can locate names, places, product codes, grammatical roles or sensitive details and act on each one. The main tradeoff is that errors also happen at that level. A model can miss an item, mislabel it, or get its boundaries wrong, for example by tagging only part of a multi-word name. Accuracy usually drops on text that differs from the training data, such as a different domain, informal writing or another language.
- It is usually a good fit when:
- You need spans or positions, such as entities to highlight, extract or redact.
- The categories are fuzzy enough that fixed patterns can't capture them reliably, such as person names or organization names.
- Later steps such as search indexing, relation extraction or analytics need structured, per-token information.
- Plain text or a simpler method is usually better when:
- You only need one judgment about the whole text. Sequence classification is simpler and cheaper.
- The targets follow strict formats, such as email addresses or fixed-pattern identifiers. Rule-based matching is more predictable and easier to audit.
- Readers only need the original text. Adding labels brings in complexity without any benefit.
- A missed item has serious consequences, as in redacting personal data. If you use token classification here, plan for human review instead of trusting the model output alone.
What token classification actually changes
Token classification does not change any characters. It does not reverse or mirror text, swap characters for styled Unicode look-alikes, or change how text is presented. The stored text stays exactly as it was, and the task adds a separate layer of labels on top. This matters when you evaluate it as a transformation: meaning and readability of the source are preserved, and any risk is in the accuracy and portability of the labels.
The word 'token' is ambiguous. In everyday descriptions it means a word. Inside modern models it often means a subword piece produced by the model's tokenizer. Some systems work on characters or bytes. When a tool reports token-level results, check which kind of token it means.
Labels often follow a BIO scheme. B marks the beginning of an item, I marks a token inside the same item, and O marks a token outside any item of interest. In the example below, the label set covers only persons (PER) and locations (LOC), so the year is tagged O. A label set that includes dates would tag it differently.
Ada B-PER
Lovelace I-PER
visited O
London B-LOC
in O
1842 O
. O
Subword tokenizers complicate this. A model may split one word into several pieces, so the word-level labels must be aligned with the model's tokens. A common convention is to label the first piece of each word and ignore the remaining pieces during training. Another is to copy the word's label to every piece. The split below is only an illustration. The actual pieces depend on the specific tokenizer's vocabulary.
Word: Lovelace
Pieces: Love | ##lace
Labels: I-PER | (ignored) <- first-piece convention
Labels: I-PER | I-PER <- propagate convention
Character-level details affect the results. A letter followed by a combining accent, or an emoji built from several code points, appears as one visible character but is stored as several code points. If a tokenizer or a span boundary splits such a sequence, the labeled span can cut through what a reader sees as a single character. Unicode normalization (for example, composed versus decomposed accented letters) also changes the number of code points. Positions calculated on one form will therefore not match the other. The example sentences in this article contain only plain ASCII, so they avoid these issues. Real text often contains such characters.
Will the output remain readable and usable after copying or sharing?
The source text remains fully readable because it is never altered. Portability problems come from the labels. Output usually takes one of three forms: tags written inline, a column format with one token and label per line (as above), or a list of spans with character offsets. Span lists are the easiest to reuse in other software. The example below uses zero-based offsets where the end position is excluded, applied to the sentence 'Ada Lovelace visited London in 1842.'
[
{"text": "Ada Lovelace", "label": "PER", "start": 0, "end": 12},
{"text": "London", "label": "LOC", "start": 21, "end": 27}
]
Offsets only work if everyone counts the same way. Some environments count code points, some count UTF-16 code units, and some count bytes. These counts differ for text outside basic Latin, and especially for emoji. Any edit to the source text after labeling, even changing whitespace, makes later offsets wrong. When you share span data, state the counting unit and whether the end position is included, and keep the exact source text with the labels.
Highlighted views in a browser or notebook usually store labels as markup or styling. Pasting such a view into a plain-text destination generally keeps the words and loses the labels. Rich-text destinations may keep or drop the styling depending on how they handle pasted formatting. No specific destination was tested for this review, so check your own target application before you rely on pasted labels.
For accessibility, labels shown only by color are unavailable to readers who cannot tell those colors apart or cannot see them. Show the label name as text next to the highlighted span. Token classification does not reorder characters, so reading order for screen readers is unchanged. How a particular assistive technology announces highlighted spans was not tested here and should be checked in your target environment.
Search and editing are unaffected in the source text, since words stay intact and remain searchable. Labels only become searchable or filterable if the destination stores them as data. Copying them as visual formatting does not do that. Use a plain-text or structured equivalent, such as the column format or a span list, whenever labels need to survive copying, version control, review by someone without the original tool, or processing by other software.
Evidence gaps
No tool-specific evidence was supplied for this review: no accuracy figures, benchmark results, tool comparisons or tested destinations. The guidance above is based on general, verifiable properties of token classification and Unicode text handling. Before you adopt a specific model or tool, test it on a sample of your own text, including names, punctuation, accented letters and emoji, and check how its output behaves in the places where you will paste or load it.