Detecting Named Entities and Personal Information in Text
This lesson explains entity detection, or named entity recognition (NER), which finds references to specific things in text, such as people, places, organizations, dates and amounts, and labels each one with a category.
Learning outcomes
After completing this lesson, you will be able to:
- Explain how named entity recognition labels spans of text with categories.
- Distinguish named entity recognition, PII detection and entity linking.
- Describe how applications use the category, offset and confidence of each entity.
How entity detection works
A model reads the text and marks spans that refer to entities, assigning each a category. Azure Language recognizes categories such as Person, Location, Organization, DateTime, Quantity, PhoneNumber, Email, URL, Product, Event and Skill, and returns each entity with its text, category, position (offset and length) and confidence score. In Contoso opened a store in Lisbon on 3 May, the entities are Contoso (Organization), Lisbon (Location) and 3 May (DateTime).
Entity categories
Related techniques
PII detection is entity detection focused on personally identifiable information: names, addresses, phone numbers, email addresses, identity and card numbers. It returns the entities and a redacted copy of the text in which they are masked. Entity linking goes a step further and resolves an entity to a known reference, such as a Wikipedia article, so that Mars the planet and Mars the company are distinguished. Custom NER models can be trained to find domain-specific entities, such as clause types in contracts.
The following diagram applies the three techniques to one sentence.

Text analysis techniques
Working with entity results
Applications use the information returned with each entity, not only its text. The category tells the application what to do with it, for example storing a DateTime as a date. The offset and length identify exactly where the entity appears, which allows the application to highlight it or replace it. The confidence score lets the application ignore uncertain results or send them for review.
For example, a hospital wants to share patient feedback with a research team without revealing who wrote it. PII detection finds the names, phone numbers and dates in each comment and returns a redacted copy, such as My nurse, ********, was very kind on ******. The research team receives only the redacted text, while the meaning of the feedback is kept.
Use the entity results
Entities or PII
A legal firm wants to (a) list the companies and dates mentioned in each contract and (b) remove clients' names and phone numbers from documents before sharing them with a vendor. Which capabilities apply?
Requirement (a) is named entity recognition, returning Organization and DateTime entities. Requirement (b) is PII detection, which returns the redacted text directly. Using general NER for (b) would find names but not reliably every category of personal data, and would not produce the redacted text.
What does entity linking add to entity detection?
Show answer
It resolves an ambiguous entity to a known reference, for example deciding which "Paris" is meant.
Exam Tips
Remember for the exam
- Entity detection finds and categorizes specific things: people, places, organizations, dates, amounts.
- PII detection finds personal data and returns redacted text.
- Entity linking resolves ambiguous entities to a known reference.