Module 9.1 so far prepared surface text: corpus, cleaning, tokenization, and morphological normalization. Part-of-speech (POS) tagging is the first major linguistic annotation layer—assigning grammatical categories to tokens.
POS tags power better lemmatization, feature engineering, and are prerequisites for NER quality analysis and dependency parsing.
Learning Objectives
By the end of this lesson, students should be able to:
- Define POS tagging and list common Universal Dependencies (UD) coarse tags.
- Explain ambiguity (book as noun vs verb) and why context models matter.
- Tag text with spaCy and NLTK; read
pos_vs fine-grainedtag_. - Use POS filters for information extraction (e.g., extract nouns/adjectives).
- Describe evaluation with accuracy / token-level F1 on tagged corpora.
- Know when neural end-to-end models hide POS versus when explicit tags still help.
POS tagging assigns each token a part-of-speech label (noun, verb, adjective, …) according to its role in context. Systems may use coarse Universal POS tags or fine-grained tagsets (e.g., Penn Treebank).
Common Coarse Tags (UD)
| Tag | Meaning | Examples |
|---|---|---|
| NOUN | Common noun | cat, algorithm |
| PROPN | Proper noun | London, CUDA |
| VERB | Verb | run, classify |
| ADJ | Adjective | fast, neural |
| ADV | Adverb | quickly, very |
| ADP | Adposition | in, on, of |
| DET | Determiner | the, a |
| PRON | Pronoun | it, they |
| PUNCT | Punctuation | . , ! |
Tagging in Practice
Ambiguity and Models
Rule / lexicon
- Fast baselines.
- Fail on unknown words.
- Weak on ambiguity.
Statistical taggers
- HMM, perceptron (NLTK).
- Learn from treebanks.
- Strong classical default.
Neural taggers
- spaCy’s CNN/transformer.
- Contextual embeddings.
- State of the art accuracy.
Why Explicit POS Still Helps
- Debuggable linguistic features.
- Guides lemmatization & chunking.
- Useful constraints for pattern IE.
Limitations
- Errors cascade to parsers.
- Domain shift (social media, code).
- End-to-end LLMs may not expose tags.
“POS tags are unique per word type.” Tags are assigned per token occurrence in context. The type book can be VERB or NOUN in the same document.
Knowledge Check
- Short Answer: What does POS tagging assign? Answer: A grammatical category label to each token in context.
- True/False: The word type book always receives the same POS tag. Answer: False—it depends on context.
- Multiple Choice: UD tag PROPN means: (a) pronoun, (b) proper noun, (c) preposition. Answer: (b).
- Short Answer: Difference between spaCy
pos_andtag_? Answer:pos_is coarse Universal POS;tag_is fine-grained (e.g., Penn). - True/False: POS tagging should run on stop-word-stripped text only. Answer: False—function words are part of the syntax.
- Multiple Choice: NLTK
pos_tagcommonly returns: (a) UD only, (b) Penn Treebank-style tags, (c) dependency arcs. Answer: (b). - Short Answer: Give one engineering use of POS filters. Answer: Extract nouns/adjectives for keywords, or constrain pattern-based IE.
- True/False: Domain shift can degrade tagger accuracy. Answer: True.
- Multiple Choice: POS errors most directly hurt: (a) JPEG compression, (b) lemmatization and parsing, (c) SGD momentum. Answer: (b).
- Short Answer: Which lecture finds spans like people and organizations? Answer: Named Entity Recognition (NER).
Key Takeaways
- POS tagging labels tokens with grammatical categories in context.
- Ambiguity requires contextual models, not per-word dictionaries alone.
- spaCy and NLTK provide production-ready taggers for pipelines.
- Tags support lemmatization, IE patterns, and parsing.
- Next, Named Entity Recognition (NER) labels real-world entity spans.
Hands-on idea: Ask students to find five POS ambiguities in tech support tickets and check spaCy’s decisions.
Discussion prompt: For an LLM app, when would you still run an explicit POS tagger instead of prompting?
Recap: POS tags expose grammar per token and unlock cleaner linguistic pipelines. Continue with Named Entity Recognition (NER).