NLP Lesson 14 – NER Basics | Dataplexa

Named Entity Recognition (NER) Basics

When humans read a sentence, we can instantly recognize names of people, places, organizations, dates, and amounts.

Computers do not naturally understand these meanings. Named Entity Recognition (NER) helps machines identify and classify important real-world entities in text.

In this lesson, you will learn what NER is, why it is crucial in NLP systems, how it relates to POS tagging, and how to perform NER using Python.


What Is Named Entity Recognition (NER)?

Named Entity Recognition is the task of detecting and classifying named entities in text into predefined categories.

These entities represent real-world objects.

Example Sentence:

“Apple was founded by Steve Jobs in California in 1976.”

Entity Type
AppleOrganization
Steve JobsPerson
CaliforniaLocation
1976Date

Why Is NER Important in NLP?

NER helps machines extract meaningful information from unstructured text.

It is a key component in many real-world systems.

  • Search engines (finding relevant information)
  • Chatbots and virtual assistants
  • News article analysis
  • Resume parsing
  • Medical and legal text analysis

Without NER, text remains just a sequence of words.


Common Entity Types in NER

Different datasets and libraries may use different labels, but these are the most common entity categories.

Entity Type Description Example
PERSONPeople namesElon Musk
ORGOrganizationsGoogle
GPEGeopolitical entitiesIndia, USA
LOCLocationsHimalayas
DATEDates2024
MONEYMonetary values$500

NER vs POS Tagging

POS tagging and NER are related but different tasks.

Aspect POS Tagging NER
Focus Grammar role Real-world meaning
Example NN, VB, JJ PERSON, ORG
Purpose Sentence structure Information extraction

NER often uses POS tagging internally as supporting information.


NER Using SpaCy (Practical Demo)

Now we will perform Named Entity Recognition using SpaCy, one of the most popular NLP libraries.

Where to run this code:

  • Google Colab (recommended)
  • Jupyter Notebook
  • VS Code with Python

If SpaCy is not installed, run:

pip install spacy
python -m spacy download en_core_web_sm
Python Example: Named Entity Recognition
import spacy

nlp = spacy.load("en_core_web_sm")

text = "Google was founded by Larry Page and Sergey Brin in California in 1998."

doc = nlp(text)

for ent in doc.ents:
    print(ent.text, ent.label_)

Output:

Output
Google ORG
Larry Page PERSON
Sergey Brin PERSON
California GPE
1998 DATE

How to Understand This Output

Each entity consists of:

  • Entity text: the actual word(s)
  • Entity label: the category assigned

This structured output allows machines to store, search, and reason about real-world data.


Real-Life Applications of NER

  • Extracting names from resumes
  • Finding locations in news articles
  • Financial data extraction
  • Medical report analysis
  • Legal document processing

NER converts unstructured text into structured data.


NER in Competitive Exams

Exams usually ask:

  • Definition of NER
  • Examples of entity types
  • Difference between POS and NER

Clear definitions + examples are enough to score marks.


Assignment / Homework

Practice Environment:

  • Google Colab
  • Jupyter Notebook

Tasks:

  • Apply NER on a news paragraph
  • Count how many PERSON and ORG entities appear
  • Compare results on cleaned vs uncleaned text
  • Try NER on your own resume text

Practice Questions

Q1. What does NER identify?

Real-world entities such as names, places, and organizations.

Q2. Is NER the same as POS tagging?

No. POS identifies grammar, NER identifies real-world entities.

Quick Quiz

Q1. Which entity type represents locations?

GPE or LOC.

Q2. Which library is commonly used for NER?

SpaCy.

Quick Recap

  • NER identifies real-world entities
  • Works after cleaning, tokenization, POS
  • Converts text into structured information
  • Used in search, chatbots, analytics
  • Foundation for advanced NLP systems