Skip to main content
NLP Basics Tutorial
CHAPTER 10 Beginner

Named Entity Recognition (NER)

Updated: May 14, 2026
25 min read

# CHAPTER 10

Named Entity Recognition (NER)

1. Introduction

While POS Tagging tells the computer that a word is a "Noun," that is often not specific enough for real-world business applications. A company scanning a news article doesn't just want to find all the Nouns; it wants to find the names of People, Organizations, and Locations. This advanced extraction process is called Named Entity Recognition (NER). In this chapter, we will explore how AI extracts structured information from unstructured text.

2. Learning Objectives

By the end of this chapter, you will be able to:
  • Define Named Entity Recognition (NER).
  • Identify common entity categories (PER, ORG, LOC, DATE).
  • Understand how NER relies on context and POS tagging.
  • Recognize the immense business value of Information Extraction.

3. Beginner-Friendly Explanation

Imagine a lawyer is handed a 500-page unformatted legal document and is told, "Highlight every time a Person's name is mentioned in yellow, every Company in blue, and every Date in green." It would take the lawyer hours to read and highlight the text. Named Entity Recognition (NER) is an AI highlighter. It scans massive blocks of text and automatically categorizes specific nouns into pre-defined categories. It transforms a messy block of text into a neat, organized spreadsheet of Who, What, Where, and When.

4. Common NER Categories

NER models output specific tags for the entities they find. The most common standard tags are:
  • PER (Person): "Elon Musk", "Abraham Lincoln"
  • ORG (Organization): "Apple Inc.", "United Nations"
  • LOC (Location): "New York", "Mount Everest", "Germany"
  • DATE / TIME: "January 1st, 2024", "next Tuesday"
  • MONEY: "$500", "twenty pounds"

5. How Does NER Work?

NER uses complex Deep Learning models that rely heavily on context (surrounding words). Consider the word "Apple":
  1. 1. "I ate a delicious *Apple*." (The AI sees "ate" and "delicious". It tags Apple as just a regular noun, NO entity tag).
  1. 2. "*Apple* announced record profits." (The AI sees "announced" and "profits". It tags Apple as an ORG).
The model doesn't just look for capital letters; it understands the semantic relationship between the words.

6. Real-World Applications of NER

NER is arguably the most lucrative, widely-used NLP technique in the corporate world.
  • Resume Parsing: When you upload your PDF resume to a job site, NER scans it, finds the ORG (your previous employer), the DATE (how long you worked there), and auto-fills the web form for you.
  • News Aggregation: Financial algorithms scan thousands of news articles a second. If NER detects the ORG "Tesla" in the same sentence as the word "Bankrupt", it automatically triggers a stock sell-off.
  • Customer Support: When a user emails "My flight from Boston to London is delayed," NER extracts the LOC tags ("Boston", "London") and routes the ticket to the European flight department.

7. Information Extraction (IE)

NER is the foundation of Information Extraction. By combining POS Tagging and NER, we can extract relationships. *Example Text:* "Tim Cook is the CEO of Apple." *Extraction:* Subject (PER: Tim Cook) -> Relationship (CEO) -> Object (ORG: Apple). We just converted a messy English sentence into a clean database entry!

8. Python Examples

The absolute best library for NER in Python is spaCy. It is an industry-grade, lightning-fast NLP framework.
python
12345678910111213141516171819
import spacy

# Load the pre-trained English NLP model
nlp = spacy.load("en_core_web_sm")

text = "Mark Zuckerberg, the CEO of Meta, traveled to Paris on Tuesday."

# Run the text through the spaCy pipeline
document = nlp(text)

# Iterate through the detected entities
for entity in document.ents:
    print(f"Word: {entity.text} | Tag: {entity.label_}")

# Output:
# Word: Mark Zuckerberg | Tag: PERSON
# Word: Meta            | Tag: ORG
# Word: Paris           | Tag: GPE (Geopolitical Entity / Location)
# Word: Tuesday         | Tag: DATE

9. Mini Project

Act as the NER Model: Read the following sentence: "Google's headquarters is located in Mountain View, and they spent $5 Billion on research in 2023." Extract and label the four Named Entities in that sentence. *(Answer: Google [ORG], Mountain View [LOC/GPE], $5 Billion [MONEY], 2023 [DATE])*

10. Best Practices

  • Custom Training: A standard NER model won't recognize specialized medical terms. If you are working in healthcare, you must "fine-tune" the NER model by training it on medical textbooks so it learns to extract DISEASE and MEDICATION entities.

11. Common Mistakes

  • Relying on Capitalization Rules: Some beginners try to build NER using Python by just extracting every word that starts with a capital letter. This fails instantly. Words at the beginning of sentences are capitalized, and words in informal tweets are often fully lowercase.

12. Exercises

  1. 1. Explain how a news website could use NER to automatically generate "Tag" links at the bottom of an article.

13. Coding Challenges

Challenge 1: Write pseudocode for an automated redacting system that uses NER to hide sensitive personal information in public legal documents.
text
123456789
document = "John Doe owes $500 to the bank in Chicago."
entities = extract_ner(document)

For entity in entities:
    If entity.tag == "PERSON" or entity.tag == "LOC":
        Replace entity.word with "[REDACTED]" in document
        
Print document
// Output: "[REDACTED] owes $500 to the bank in [REDACTED]."

14. MCQs with Answers

Question 1

What is the primary purpose of Named Entity Recognition (NER)?

Question 2

How would an accurate NER model tag the word "Microsoft" in the sentence "Microsoft released a new software update today"?

15. Interview Questions

  • Q: Describe how Named Entity Recognition differs from standard Parts of Speech (POS) tagging.
  • Q: Give an example of a business process that can be completely automated using NER.

16. FAQs

Q: Can NER detect entirely new companies that were invented yesterday? A: Yes! Because Deep Learning models use the context of the sentence (e.g., "The new startup, Zyxtron, raised millions..."), the AI knows "Zyxtron" is an ORG based on the grammar, even if it has never seen that word before.

17. Summary

In Chapter 10, we explored Named Entity Recognition (NER), the AI highlighter. By extracting specific entities like Persons, Organizations, and Locations, NER allows developers to turn massive, unreadable documents into organized, actionable databases. It is the fundamental technology behind resume parsing, automated redaction, and intelligent news aggregation.

18. Next Chapter Recommendation

We know *what* the text is about, but *how does the writer feel* about it? Proceed to Chapter 11: Sentiment Analysis Basics to learn how AI detects human emotion.

Finish this Chapter

Save your progress on your learning path and prepare for coding interview challenges.

Discussion

Join the discussion

Log in or create a free account to participate.

Sort: ·