Loading
0xA0Lesson 11 of 15

Tag words: parts of speech and named entities

Label every word with its grammatical role, and find the people, places and organizations in text.

25 min 6-question quiz 1 code exercise
By the end of this lesson you can
  • 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):

TagMeaningExamples
NOUNthing, person, ideadog, flight, idea
VERBaction or staterun, book, is
ADJdescribes a nounbig, quick, red
DETdeterminerthe, 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.

Sentence 1 of 3Tags right 0/0

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.

Sentence 1 of 3Tags right 0/0

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 name
  • I-PER: Inside (continuing) the same name
  • O: 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.

Exercise 1

Read entities from BIO tags

+25 XP

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
main.py
Loading editor…

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…

Did you like the lesson? 😆👍
Consider a donation to support our work: