Part-of-Speech Tagging (POS Tagging)

Machine Learning
Type
NLP sequence-labelling task

What does it do?

Part-of-speech tagging assigns a grammatical category label, such as noun, verb or adjective, to every token in a text.

It is a common natural-language-processing task, and its output is typically used as a preliminary step for syntactic analysis and information extraction.

The intuition behind the method

When you read a sentence you instinctively know which words are nouns and which are verbs, and that knowledge shapes how you understand the sentence. A machine has no such instinct, so POS tagging gives it one: for each token in the text the method picks the most likely grammatical category, using the surrounding words as context. Once every word carries a tag, downstream tasks can reason about sentence structure instead of treating text as an undifferentiated bag of words.

History

Statistical approaches to POS tagging began in the 1980s, when developers introduced Markov models and started research on statistical models for the task. Recent research has concentrated on supervised and semi-supervised algorithms and on deep learning algorithms (Learn R for Applied Statistics, Chapter 1).

When to use it

Choose POS tagging when your data is running text, you have a POS model trained for its language, and you need each word's grammatical role before a later step such as parsing, chunking or information extraction. Do not rely on it when no language-matched model exists, because the tags will then be unreliable. Tags alone do not encode relations between words, so if you need those, POS tagging is only an intermediate step. The text should be tokenised before tagging, since the tagger takes tokenised input.

Limitations and considerations

  • Accuracy depends on a model trained for the language of the text; the tagger knows only what that model learned.
  • The tagger reads context from the token sequence it is given, so it inherits every tokenisation decision made upstream.
  • Tags label each word within its sentence and do not by themselves encode phrase or dependency structure; those require later steps.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • Each token receives a category that depends on its neighbours, so a word that can be a noun or a verb is labelled from its context rather than in isolation.
  • The output has a fixed shape, one tag per token, which gives later parsing and extraction steps a predictable input.
  • Tagging is a separate stage, so a tagger for another language can be substituted without changing the downstream steps, provided it uses the same tagset as the steps that consume the tags.

Applications

  • Preparing text for syntactic parsing by labelling each word's grammatical role.
  • Feeding chunking and shallow parsing, which group tagged tokens into phrases.
  • Supporting information extraction, where grammatical category helps identify entities and relations.
  • Exploratory and descriptive analysis of how language is used across a corpus.

How it works

How it works

1

The text is split into tokens, the words and punctuation marks that will each receive a tag. This is a precondition for the tagger rather than part of the tagging decision: the tagger expects tokenised input, and the boundaries set here define the units it labels.

2

A POS model trained for the language of the text assigns each token its most likely grammatical category (noun, verb, adjective and so on), producing one tag per token. Formally, given tokens x_1 … x_n, the model selects the tag sequence y_1 … y_n that best fits them under its learned parameters. Tagsets differ between projects; the Penn Treebank tagset is a widely used example. The model uses the neighbouring tokens as context to resolve words that could belong to more than one category. The model must match the language of the text; without a matching model the tags are unreliable.

3

The resulting sequence of one tag per token is passed to downstream steps such as chunking, syntactic parsing or information extraction. Tagging errors carry into those steps, so their output cannot be more reliable than the tags they receive.

Common pitfalls

  • Tagging text with a model trained on another language, or on a different register, can produce tags that look plausible but are systematically wrong for the new text.
  • Tokenising differently from the way the model was trained, for example splitting punctuation or contractions differently, shifts the positions the model reads and degrades the tags.
  • Ambiguous words are tagged from their context, so errors cluster where the context is thin. Before relying on the tags for parsing or extraction, evaluate the tagger on a manually tagged sample from your own domain and report its per-token error rate together with the sample size.

Frequently asked questions

What does POS tagging actually produce?

It attaches a grammatical category label, such as noun, verb or adjective, to each token in the text, so the output is a tag for every word.

Do I need a large corpus to run it?

You need a POS model trained for the language of your text and text that has already been tokenised. To judge whether the tags are good enough for your domain, check them against a manually tagged sample of your own text.

Why does tokenisation have to come first?

The tagger labels token by token, so the tokens it sees define what gets a tag. If tokenisation is wrong, the boundaries are wrong and the tags will be too.

What happens if the model does not match my language?

Applying a model trained for one language to another produces unreliable tags. POS tagging assumes a model trained for the target language is available.

Related methods

Sources

  1. Ratnaparkhi, A. (1996). A Maximum Entropy Model for Part-Of-Speech Tagging. EMNLP.

    Open publication reference
  2. Manning, C.D. et al. (2014). The Stanford CoreNLP Natural Language Processing Toolkit. ACL.

    Open DOI reference
  3. Learn R for Applied Statistics: With Data Visualizations, Regressions, and Statistics, Chapter 1 (Introduction)