Named Entity Recognition

What Is Named Entity Recognition?

Named Entity Recognition, or NER, is an NLP task that finds and labels important named items in text. These named items are called entities.

Entities Can Include
  • People
  • Places
  • Organizations
  • Dates
  • Times
  • Money amounts
  • Products
  • Events
  • Percentages
  • Medical terms

Simple Idea: Text → Find important named items → Label each item by type

Why Named Entity Recognition Matters

NER matters because large amounts of text contain important information. It helps computers extract names, places, dates, companies, products, and other useful details automatically.

NER Is Useful For
  • Search
  • Document analysis
  • Chatbots
  • News analysis
  • Customer support
  • Medical records
  • Legal documents
  • Business intelligence
  • Knowledge graphs
  • Information extraction

Key Idea: NER helps turn unstructured text into structured data.

Entity

An entity is an important named item found in text.

Example

Sentence: Dr. Patel works at Drexel University in Philadelphia.

Dr. Patel — Person

Drexel University — Organization

Philadelphia — Location

The model identifies the text span and assigns an entity type.

Entity Type

An entity type is the category assigned to an entity.

Entity TypeMeaning
PersonNames of people
OrganizationCompanies, schools, agencies, teams
LocationCities, countries, buildings, regions
DateSpecific dates or calendar references
MoneyCurrency amounts
ProductNamed products or services

Text Span

A text span is the exact part of text that is labeled as an entity.

Example

Sentence: Barack Obama was born in Hawaii.

Barack Obama — Person

Hawaii — Location

Key Idea: The model must find where the entity starts and where it ends.

Why Text Span Matters

Text spans matter because many entities contain multiple words.

Example

Sentence: New York City is a major city in the United States.

Correct: New York City = Location / United States = Location

Incorrect: New = Location (incomplete span)

Goal: Identify the full named entity.

NER Example

Example

Text: Microsoft hired Sarah Chen in Seattle last March.

Microsoft — Organization

Sarah Chen — Person

Seattle — Location

last March — Date

NER Output

NER output usually includes the entity text and the entity type.

Example

Text: Amazon announced a new product in Canada.

Amazon — Organization

Canada — Location

Note: "new product" may not be labeled unless the model is trained to recognize product mentions.

Common Entity Types

Common NER Labels
  • PERSON
  • ORG
  • GPE
  • LOC
  • DATE
  • TIME
  • MONEY
  • PRODUCT
  • EVENT
  • PERCENT
  • FACILITY
  • LANGUAGE
  • LAW

Important: Different tools and datasets may use different labels.

PERSON Entities

PERSON entities are names of people.

Examples
  • Marie Curie
  • Serena Williams
  • Dr. Ahmed Khan
  • Taylor Swift
  • Ada Lovelace

Sentence: Marie Curie won Nobel Prizes in Physics and Chemistry.

Marie Curie — PERSON

ORG Entities

ORG entities are organizations, such as companies, schools, agencies, or teams.

Examples
  • Google
  • Drexel University
  • United Nations
  • Toronto Raptors
  • Mayo Clinic

Sentence: Drexel University is located in Philadelphia.

Drexel University — ORG

GPE and LOC Entities

GPE usually means geopolitical entity, while LOC is often used for locations that are not political units.

Examples

GPE: Canada / Toronto / France / Philadelphia / Japan

LOC: Mount Everest / Pacific Ocean / Sahara Desert

Important: Different NER systems may label locations differently.

DATE and TIME Entities

DATE entities refer to dates or calendar expressions. TIME entities refer to specific times.

Example

Sentence: The meeting is on Friday at 2 PM.

Friday — DATE

2 PM — TIME

More DATE Examples: Monday, June 5, 2026, next week

More TIME Examples: noon, midnight, 8:30 AM

MONEY and PERCENT Entities

MONEY entities refer to currency amounts. PERCENT entities refer to percentages.

Example

Sentence: The price increased by 10 percent to $50.

10 percent — PERCENT

$50 — MONEY

More Examples: €100, 1 million CAD, 75%, 0.5%

PRODUCT Entities

PRODUCT entities refer to named products or services.

Examples
  • iPhone
  • PlayStation
  • Microsoft Excel
  • Tesla Model 3
  • ChatGPT

Sentence: She bought an iPhone in Toronto.

iPhone — PRODUCT

Note: Product recognition depends on the model and training data.

EVENT Entities

EVENT entities refer to named events.

Examples
  • Olympics
  • World Cup
  • Super Bowl
  • Black Friday
  • WWDC

Sentence: The Olympics will attract visitors from around the world.

Olympics — EVENT

NER and Information Extraction

Information extraction means pulling useful details from text. NER is one form of information extraction.

Example

Text: John Smith joined Apple in 2024.

John Smith — Person

Apple — Organization

2024 — Date

Use: The structured information can be stored, searched, or analyzed.

NER vs Text Classification

Text classification labels a whole text. NER labels specific parts of the text.

Text Classification

Assigns a label to the whole document

Text: Apple opened a store in Toronto.

Label: Business news

NER

Labels specific named items inside the document

Apple — Organization

Toronto — Location

NER vs Sentiment Analysis

Sentiment analysis detects tone or opinion. NER finds named entities. These tasks can be used together.

Example

Text: I love using Spotify during long walks.

Sentiment Analysis: Positive

NER: Spotify — Product or Organization

Combined Use: Find which entity is mentioned and how the user feels about it.

NER vs Keyword Matching

Keyword matching searches for exact words. NER identifies named entities and their types.

Keyword Matching

Searches for exact word "Toronto"

Returns a word match only

NER

Recognizes Toronto as a location

Gives structure, not just a word match

Rule-Based NER

Rule-based NER uses human-written rules to find entities.

Example Rule

If a word starts with a capital letter and is followed by "Inc.", it may be an organization.

Example: Acme Inc.

Strength: Works well for simple patterns.

Limitation: Rules can be hard to maintain.

Rule-Based NER Example

Example

Text: The meeting is scheduled for June 5 at 3 PM.

Rules: Month name + number = DATE / Number + AM or PM = TIME

June 5 — DATE

3 PM — TIME

Useful For: Dates, times, and formatted text

Machine Learning NER

Machine learning NER learns patterns from labeled examples.

Example

Training Sentence: Apple opened an office in Toronto.

Apple — ORG

Toronto — LOC

Learning: The model sees many labeled examples and learns to predict entities in new text.

Deep Learning NER

Deep learning NER uses neural networks. Modern systems often use transformer models because they can use context effectively.

Context Example

Sentence 1: Apple released a new phone. — Apple: Organization

Sentence 2: She ate an apple after lunch. — apple: Not an organization

Key Idea: Context helps the model decide.

NER and Context

Context is important because the same word can mean different things in different sentences.

Example

Jordan works at the hospital. — Jordan: Person

Jordan is a country in the Middle East. — Jordan: Location

Goal: Use surrounding words to choose the correct label.

Ambiguity in NER

Ambiguity means a word or phrase can have more than one meaning.

Example

Word: Amazon

Possible Meanings: Company / River / Rainforest region

Amazon announced new delivery options. — Organization

The Amazon is home to many species. — Location

NER models must use context.

Multi-Word Entities

Many entities contain multiple words. The model should identify the full span.

Examples
  • New York City
  • University of Ottawa
  • Bank of Canada
  • San Francisco
  • World Health Organization

Incorrect: New = Location

Correct: New York City = Location

Nested Entities

Sometimes entities can appear inside other entities.

Example

University of Toronto

Full Entity: University of Toronto = Organization

Inside It: Toronto = Location

Important: Some NER systems only label the full organization. Advanced systems may support nested entities.

BIO Tagging

BIO tagging is a common way to label tokens for NER. BIO stands for Beginning, Inside, and Outside.

BIO Labels

B — Beginning of an entity

I — Inside an entity

O — Outside an entity

Text: New York City is busy.

New = B-LOC / York = I-LOC / City = I-LOC / is = O / busy = O

BIO Example

Example

Sentence: Sarah works at Google.

Sarah = B-PERSON / works = O / at = O / Google = B-ORG / . = O

Purpose: BIO tagging helps models find entity boundaries.

Training Data for NER

NER models need labeled training data. The labels show which text spans are entities and what type they are.

Example

Text: Dr. Lee works at Toronto General Hospital.

Dr. Lee — PERSON

Toronto General Hospital — ORG

Important: High-quality labels are needed. Incorrect labels can confuse the model.

Annotation

Annotation is the process of labeling data. For NER, annotators mark entity spans and types.

Example

Sentence: Tesla opened a factory in Germany.

Tesla — ORG

Germany — GPE

Challenge: Entity boundaries must be precise.

NER Pipeline

NER is often part of a larger NLP system.

01

Collect text — gather documents, messages, or articles

02

Clean or normalize text if needed — fix formatting and noise

03

Tokenize the text — split into words or subwords

04

Run the NER model — apply the trained classifier

05

Identify entity spans — find where each entity starts and ends

06

Assign entity types — label each span as PERSON, ORG, DATE, etc.

07

Store or display results — save or show the extracted entities

08

Evaluate the results — check precision, recall, and F1

NER for Search

NER can improve search by identifying important details in a query.

Example

Search Query: schools in Philadelphia

Possible Entities: Philadelphia = Location

Use: The search system can use this structure to return better results.

NER for Document Analysis

NER helps analyze long documents by extracting important names, dates, locations, and organizations.

A Legal Document May Mention
  • People
  • Companies
  • Dates
  • Locations
  • Laws
  • Money amounts

NER: Extracts these details into a structured summary.

NER for Chatbots

Chatbots can use NER to understand important details in user messages.

Example

User: Book a flight to Toronto tomorrow.

Toronto — Location

tomorrow — Date

Use: The chatbot can use these entities to complete the task.

NER for Customer Support

Customer support systems can use NER to identify products, dates, order details, or account-related information.

Example

User: My iPhone order from May 12 has not arrived.

iPhone — Product

May 12 — Date

Use: Route the request or search for the right order information.

NER for Healthcare

NER can help extract information from healthcare text, but it requires careful validation and privacy protection.

Healthcare Entities
  • Patient symptoms
  • Medications
  • Conditions
  • Procedures
  • Dates
  • Test names
  • Body parts

Text: The patient was prescribed amoxicillin on Monday.

amoxicillin — Medication  |  Monday — Date

NER for Business

Businesses use NER to analyze documents, emails, reviews, and reports.

Business NER Can Find
  • Company names
  • Product names
  • Competitors
  • Locations
  • Prices
  • Dates
  • Customer names
  • Events

Example: Analyze reviews to see which products are mentioned most often.

NER for News Analysis

NER can help organize news by people, places, organizations, dates, and events.

Example

Article: The Prime Minister met with leaders in Ottawa on Tuesday.

Prime Minister — Person or title, depending on system

Ottawa — Location

Tuesday — Date

Use: Organize and search news content.

NER for Knowledge Graphs

A knowledge graph stores relationships between entities. NER can help identify entities before relationships are extracted.

Example

Text: Marie Curie was born in Warsaw.

Marie Curie — Person

Warsaw — Location

Possible Relationship: Marie Curie was born in Warsaw.

NER: Often the first step in building structured knowledge.

Custom NER

Custom NER means training or adapting a model to recognize entity types specific to a domain.

Coding Education Entity Types
  • Programming languages
  • Frameworks
  • Error messages
  • Lesson topics
  • Libraries
  • Functions

Text: The student asked about React hooks and TypeScript.

React — Framework  |  TypeScript — Programming language

NER Evaluation

NER models need careful evaluation. Common metrics include precision, recall, and F1 score.

Key Metrics

Precision: Of the entities the model found, how many were correct?

Recall: Of the correct entities in the text, how many did the model find?

F1 Score: A balance between precision and recall.

Precision in NER

Precision measures how many predicted entities are correct.

Example

Model predicted: 10 entities

Correct predictions: 8

Precision: 8 out of 10

Meaning: High precision means fewer false positives.

Recall in NER

Recall measures how many true entities the model found.

Example

The text had: 12 correct entities

The model found: 9

Recall: 9 out of 12

Meaning: High recall means fewer missed entities.

F1 Score in NER

F1 score balances precision and recall.

High Precision, Low Recall

The model finds few entities, but most are correct.

High Recall, Low Precision

The model finds many entities, but some are wrong.

Exact Match

NER evaluation often requires the exact entity span and correct entity type.

Example

Correct Entity: New York City

Model Prediction: New York

Problem: The span is incomplete.

NER Evaluation: May count this as incorrect.

Common NER Errors

Common Errors
  • Missing an entity
  • Labeling the wrong text span
  • Choosing the wrong entity type
  • Splitting a multi-word entity incorrectly
  • Labeling normal words as entities
  • Confusing people with organizations
  • Confusing locations with organizations
  • Failing on rare names
  • Failing on domain-specific terms

False Positives

A false positive happens when the model labels something as an entity, but it should not.

Example

Text: I like apple pie.

Incorrect NER: apple = Organization

Problem: The word apple refers to fruit, not the company.

False Negatives

A false negative happens when the model misses a real entity.

Example

Text: The meeting is in Mississauga.

Missed Entity: Mississauga = Location

Problem: The model failed to recognize the location.

Wrong Entity Type

A wrong entity type happens when the model finds the entity but assigns the wrong category.

Example

Text: Amazon announced new jobs.

Incorrect: Amazon = Location

Correct: Amazon = Organization

Reason: Context helps reduce this error.

NER Challenges

NER Challenges
  • Ambiguous words
  • Multi-word entities
  • Rare names
  • New company names
  • Misspellings
  • Informal text
  • Domain-specific vocabulary
  • Different languages
  • Inconsistent capitalization
  • Biased training data

Capitalization Challenge

NER often uses capitalization as a clue, but capitalization is not always reliable.

Example

Apple — Company

apple — Fruit

Problem: Text messages may use lowercase for everything.

Example: i visited toronto last week

Goal: Still recognize toronto as a location.

Domain-Specific Challenge

General NER models may not recognize specialized terms.

Example

Healthcare Text: The patient was prescribed metformin.

General Model: May not label metformin correctly.

Healthcare NER Model: May recognize metformin as a medication.

Key Idea: Specialized domains often need specialized training data.

Privacy Concerns

NER may identify sensitive information. This can be useful, but it also creates privacy risks.

Sensitive Entities
  • Names
  • Addresses
  • Medical conditions
  • Student records
  • Financial details
  • Phone numbers
  • Email addresses

Important: Extracted entities must be handled responsibly.

Bias in NER

NER models can have bias if training data is not representative.

Possible Bias

A model may recognize common names better than less common names.

A model may perform better on some languages, regions, or writing styles than others.

Solution: Test across diverse examples.

NER and Human Review

NER can save time, but it is not perfect. Human review is important when accuracy matters.

High-Impact Areas
  • Healthcare
  • Legal work
  • Finance
  • Education
  • Hiring
  • Safety systems

Key Idea: NER should support humans, not blindly replace careful review.

When to Use NER

NER Is Useful When
  • Text contains important named items
  • You need structured information from text
  • You want to search by people, places, dates, or organizations
  • You need to analyze documents
  • You need to extract details from messages
  • You want to build a knowledge graph
  • You want to improve chatbot understanding

When NER May Not Be Enough

NER May Not Be Enough When
  • You need full sentence meaning
  • You need relationships between entities
  • You need reasoning
  • You need sentiment
  • You need summarization
  • You need factual verification
  • You need to understand intent

Key Idea: NER finds entities, but other NLP tasks may also be needed.

Common Misconceptions

Misconceptions

Misconception: NER understands the whole sentence.

Reality: NER focuses on finding and labeling named entities.

Misconception: NER is always correct.

Reality: NER can miss entities or assign wrong labels.

Misconception: Capitalized words are always entities.

Reality: Some capitalized words are not entities, and some entities may be lowercase.

Misconception: NER and keyword search are the same.

Reality: NER identifies entity types, not just exact word matches.

Common Mistakes

Common Mistakes
  • Treating every capitalized word as an entity
  • Ignoring context
  • Ignoring multi-word entities
  • Not checking entity boundaries
  • Confusing organizations and locations
  • Using a general NER model for specialized domains
  • Ignoring privacy risks
  • Ignoring bias
  • Evaluating only on easy examples
  • Assuming NER extracts relationships automatically

Summary

Key Takeaways
  • Named Entity Recognition, or NER, finds and labels named items in text.
  • Entities can include people, places, organizations, dates, times, money amounts, products, and events.
  • NER identifies both the entity span and the entity type.
  • NER helps turn unstructured text into structured data.
  • NER is useful for search, chatbots, healthcare, business, legal documents, resumes, and news analysis.
  • NER can be rule-based, machine learning-based, or deep learning-based.
  • Context matters because the same word can have different meanings.
  • BIO tagging is a common way to label tokens for NER.
  • NER is evaluated using precision, recall, and F1 score.
  • NER can make mistakes, so human review is important in high-impact areas.

Practice Prompt

Identify the named entities in the sentence below and label each entity type.

Practice

Sentence: Google opened a new office in Toronto on June 5.

Then explain why context matters when deciding whether a word is an organization, location, date, or something else.

Need Help?

Ask the AI if you need help understanding Named Entity Recognition, entities, entity types, text spans, BIO tagging, precision, recall, false positives, false negatives, context, custom NER, or how NER is used in real-world NLP systems.