Tag words: parts of speech and named entities
Label every word with its grammatical role, and find the people, places and organizations in text.
- Tag words with parts of speech and explain why context matters
- Find named entities like people, organizations and places
- Read and decode the BIO tagging scheme
So far each document became one label or one bag of counts. Many tasks instead need a label for every word - this is called sequence labeling. Two classics: part-of-speech (POS) tagging marks each word’s grammatical role, and named entity recognition (NER) finds names of people, organizations, places and dates.
Parts of speech
A few of the common tags (from the widely used Universal Dependencies set):
| Tag | Meaning | Examples |
|---|---|---|
NOUN | thing, person, idea | dog, flight, idea |
VERB | action or state | run, book, is |
ADJ | describes a noun | big, quick, red |
DET | determiner | the, a, this |
The catch: the same word can be different parts of speech. “I want to book a flight” (verb) vs “I read a book” (noun). A tagger has to use the context.
Try it
Be the part-of-speech tagger
Pick a tag, then click the words it belongs to. Watch for words that change role between sentences - like book and runs.
1. Choose a tag
2. Click words to tag them (click again to clear)
Named entities
Named entity recognition finds spans of text that name something: PER (person), ORG (organization), LOC (location), DATE. It powers features like turning “lunch with Ada in Paris on Friday” into a calendar event, and helps news, legal and medical systems pull facts out of documents.
Try it
Spot the entities
Tag the words that are part of a name or date. Leave every other word untagged - those count too. Notice that Apple can be a company or a fruit, and Jordan a person or a country.
1. Choose a tag
2. Click words to tag them (click again to clear)
Tagging spans: the BIO scheme
Entities can be several words long (“Ada Lovelace”, “New York City”). To label spans with one tag per token, NER systems use BIO tags:
B-PER: the Beginning of a person nameI-PER: Inside (continuing) the same nameO: Outside any entity
“Ada Lovelace visited New York” → B-PER I-PER O B-LOC I-LOC.
Key takeaways
Sequence labeling gives every token a label; POS tagging and NER are the classic examples.
Tags depend on context: book the noun vs book the verb, Apple the company vs apple the fruit.
BIO tags turn multi-word entities into one tag per token.
Lesson quiz
6 questions · pass with 5 correct · up to 50 XP
Passing this quiz completes the lesson and keeps your streak going. Questions you miss come back in review sessions later.
Practice: apply NLP with Python
Try each text-processing idea in Python, run it against sample inputs, and use the results to see where the method works or falls short.
Read entities from BIO tags
The first line has space-separated tokens and the second line their BIO tags. Print each entity on its own line as TYPE: words, in the order they appear. A B- tag starts an entity; following I- tags of the same type continue it.
- Person and place
- Organization and date
- No entities
Python runs in a sandboxed browser worker with a 60 second time limit. Its runtime loads from the Pyodide CDN; your code stays in this browser.
Questions about this lesson
Stuck? Ask. Figured something out? Share it. Explaining is one of the best ways to learn.
Loading posts…