Tagging Words With spaCy
Read POS and detailed tags.
Tagging Words With spaCy is a free NLP Academy lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the NLP Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
spaCy Tags for You
You do not have to label words by hand. spaCy reads a sentence and assigns a part of speech to every token automatically. ⚡
Load a Model
First load a trained model. The small English model en_core_web_sm knows how to tag, parse, and recognize entities right away.
import spacy
nlp = spacy.load("en_core_web_sm")Process Your Text
Call nlp() on a string to get a Doc. The Doc holds every token along with the tags spaCy has already worked out for you.
doc = nlp("The cat sleeps quietly")Loop Over Tokens
A Doc is iterable, so you can walk through it token by token. Each token is a rich object carrying its text and grammatical info.
for token in doc:
print(token.text)Read the Coarse Tag
Every token has a pos_ attribute holding its universal tag, such as NOUN or VERB. The trailing underscore gives you the readable string.
for token in doc:
print(token.text, token.pos_)The Fine-Grained Tag
For more detail, read token.tag_. It gives a precise label like VBZ for a present-tense verb, beyond the broad pos_ category.
print(doc[2].text, doc[2].tag_)Explain Any Tag
Forgot what a code means? Call spacy.explain() with a tag and it returns a plain-English description you can read instantly.
print(spacy.explain("VBZ"))Tags Come From Context
spaCy decides each tag from the whole sentence, not a lookup table. That is why book can be tagged NOUN or VERB depending on how you use it.
Filter by Part of Speech
Once tags exist, filtering is easy. Keep only tokens whose pos_ equals VERB to collect every action word in the text.
verbs = [t.text for t in doc if t.pos_ == "VERB"]Tagging Is Fast
spaCy tags thousands of words per second, so you can run it over large documents without waiting. It is built for real production work.
One Model, Many Tasks
The same loaded model also handles parsing and entities. Tagging is just one part of spaCy's full pipeline running on each Doc.
Quick Check
Recall how spaCy exposes part-of-speech labels.
Recap
You loaded a model, processed text, and read both pos_ and tag_ for each token. spaCy turns raw sentences into tagged words in just a few lines. 🎉
Frequently asked questions
Is the “Tagging Words With spaCy” lesson free?
Yes — the full text of “Tagging Words With spaCy” is free to read here on the web, and the NLP Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the NLP Academy course, upgrade to CoddyKit PRO.
What will I learn in “Tagging Words With spaCy”?
Read POS and detailed tags. You practise NLP Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start NLP Academy?
No prior experience is required. NLP Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Tagging Words With spaCy” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this NLP Academy lesson?
Yes. Every NLP Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Nouns, Verbs, and Why Tags Matter
- Tagging Words With spaCy
- Extracting Phrases by Tag Pattern
- Dependency Parsing Basics