Learning Guides
Named Entity Recognition (NER) in NLP: Complete Guide
Quick answer: Learn Named Entity Recognition, how it identifies people, organisations, locations and dates in text, and how to implement it in Python using spaCy.
What is Named Entity Recognition?
Named Entity Recognition, or NER, identifies and classifies named entities in text, such as people, organisations, locations, dates and monetary values, into predefined categories.
Why NER Matters
NER converts unstructured text into structured information that can be searched, filtered and analysed, powering applications like resume parsing, news categorisation, and extracting key facts from legal or medical documents at scale.
NER Using spaCy
import spacy
nlp = spacy.load('en_core_web_sm')
text = "Aniruddha Kalbande founded Fireblaze AI School in Nagpur on 31 October 2017."
doc = nlp(text)
for ent in doc.ents:
print(ent.text, ent.label_)
# Aniruddha Kalbande PERSON
# Fireblaze AI School ORG
# Nagpur GPE
# 31 October 2017 DATE
Common Entity Types
| Label | Meaning |
|---|---|
| PERSON | Names of people |
| ORG | Organisations, companies, institutions |
| GPE | Countries, cities, states (geopolitical entities) |
| DATE | Dates and date ranges |
| MONEY | Monetary values |
Visualising Entities
from spacy import displacy
displacy.render(doc, style='ent', jupyter=True)
How Modern NER Models Actually Work
Modern NER systems typically use neural sequence models trained on large annotated corpora, learning both the words themselves and their surrounding context to decide whether a span of text is an entity and, if so, which category it belongs to.
Training a Custom Entity Type
Pretrained models like spaCy's default one cover common categories, but many real business applications need custom entity types, such as recognising specific course names or product codes. This requires fine-tuning the model on your own labelled examples.
Practical Applications
Automatically extracting company names and people from news articles
Pulling structured fields like candidate name and skills from resumes
Identifying medication names and dosages in clinical notes
Redacting personal information from documents for privacy compliance
Common Interview Questions
What is the difference between NER and POS tagging?
POS tagging assigns a grammatical role, like noun or verb, to every single word. NER identifies specific spans of text, often multiple words, that refer to a named entity like a person or organisation, and classifies that span into an entity category.
Why might a pretrained NER model need fine-tuning for a specific business use case?
General-purpose models are trained on entity categories common in general text, but a specific domain, such as recognising specific product codes or course names, needs its own labelled training examples to recognise those specialised entities reliably.
FAQ
Frequently Asked Questions
What is Named Entity Recognition used for?
It identifies and classifies named entities in text, such as people, organisations, locations and dates, converting unstructured text into structured, searchable information.
What is the difference between NER and POS tagging?
POS tagging assigns a grammatical role to every individual word. NER identifies specific text spans referring to named entities and classifies them into categories like person or organisation.
Can NER recognise custom entity types like product names?
Not out of the box with a general pretrained model. Recognising specialised entities like specific product codes typically requires fine-tuning the model on your own labelled examples.
Keep Reading
Related Articles
Learning Guides
INNER JOIN in SQL with Examples: Complete Beginner's Guide
Learn INNER JOIN in SQL with practical examples, syntax, interview questions, and real-world use cases. A complete beginner-friendly SQL JOI
Learning Guides
OUTER JOIN in SQL: Complete Guide with Examples for Beginners
Master OUTER JOIN in SQL with practical examples and real-world scenarios. Learn LEFT JOIN, RIGHT JOIN, FULL OUTER JOIN, syntax, use cases,
Learning Guides
Multi-Row Functions in SQL: Complete Guide with Examples
Learn multi-row (aggregate) functions in SQL including SUM, AVG, COUNT, MIN, MAX, GROUP BY and HAVING, with practical examples, NULL handlin