Book a free call

What Is Named Entity Recognition, and How Does It Work?

Named entity recognition finds names in text and sorts them into types, such as people, companies, places and dates. It turns raw text into structured data.

Hertiv engineering teamReviewed by a senior engineer
6 min read
What Is Named Entity Recognition, and How Does It Work?
On this page

Short answer

Named entity recognition, or NER, is a natural language processing task that finds names in text and sorts them into types such as people, companies and places. A sentence like 'Hertiv signed a contract with Acme Bank in London on 3 March' returns three entities: Hertiv and Acme Bank as organisations, and London as a place. The result is structured data that software can search, link and count.

What is named entity recognition?

Named entity recognition is a natural language processing task that finds names in a piece of text and labels each one with a type. The types are usually people, organisations, places, dates, times and money amounts, though teams add their own types, such as product names, laws or medical terms. The output is a list of spans, each with its start, its end and its type.

NER turns raw text into structured data. A pile of contracts becomes a table of parties, dates and amounts. A feed of news becomes a list of companies and places mentioned. Once the names are extracted, a system can search them, link them to a database, or count them over time.

NER is not the same as keyword search. A keyword search finds a word wherever it appears, while NER finds a name and says what kind of thing it is. The word 'Apple' is a fruit in one sentence and a company in another, and NER is supposed to tell the difference. For the basic building block behind it, see what tokenization in NLP is.

What types of entities does NER find?

NER systems find a standard set of entity types, and teams add their own when the job needs it. The standard types cover most business text, while custom types cover the terms that matter in one industry.

Entity type Example Common use
Person Maria Chen Finding who is mentioned
Organisation Acme Bank Tracking companies
Place London Mapping locations
Date 3 March 2026 Finding deadlines
Money $40,000 Extracting amounts
Product Model X router Cataloguing items

Custom types are where NER earns its keep in specialist work. A law firm may add case numbers and statutes, a hospital may add drugs and diagnoses, and a bank may add account numbers and product codes. Each new type needs labelled examples before the model can find it.

How does named entity recognition work?

Named entity recognition works by reading a sentence word by word and deciding, for each word, whether it starts an entity, continues one, or is not part of any entity. Modern systems use a language model that has read a large amount of text, so it understands the context around each word, and a small classifier on top that predicts the label for each word.

The model learns from labelled examples: sentences where a person has marked each entity and its type. With enough examples, the model learns the patterns, such as 'capitalised words after a verb like signed are often a company', or 'a number after the word on is often a date'. The context matters more than the word itself, which is why 'Apple' is a company in one sentence and a fruit in another.

Older systems used rules and lists instead of models. A rule might say 'a capitalised word followed by Ltd is a company', and a list might hold known company names. Rules still help for fixed formats, such as invoice numbers, but models handle the messy, varied text that rules miss.

Rule-based, model-based or LLM: which approach?

Teams pick between three approaches to NER: rules, trained models, or large language models. The right choice depends on how much labelled data exists and how much the text varies.

  • Rules and lists. Fast to build and easy to explain. Best for fixed formats, such as dates, invoice numbers and known product codes. Weak on new names and varied writing.
  • Trained models. A model fine-tuned on labelled examples for the team's own entity types. Best when the team has a few hundred labelled examples and the text is consistent. Needs labelled data to start.
  • Large language models. A general model asked to find entities, with a few examples in the prompt. Best for a quick start or rare types. Costs more per document and is harder to control than a small model.

Many teams mix them: rules for the fixed formats, a trained model for the main types, and a large model for the rare cases. For how the two model families compare, see NLP vs LLM.

Example (hypothetical): extracting parties from contracts

Example (hypothetical): a law firm reviews 200 contracts a month. A paralegal reads each one and records the parties, the signing date and the contract value, taking 30 minutes per contract. That is 200 x 30 = 6,000 minutes, or 100 hours a month.

With NER, the firm trains a model on 300 labelled contracts. The model reads each new contract and extracts the parties, the date and the amount. A paralegal checks the output, which takes 6 minutes per contract, so the monthly work becomes 200 x 6 = 1,200 minutes, or 20 hours.

The firm saves 100 - 20 = 80 hours a month, and the check catches the cases the model gets wrong. The saving only holds if the model is right most of the time: if it misses half the parties, the checking takes longer than the original reading. That is why the firm measures accuracy on its own contracts before trusting the output.

What are the common mistakes?

The most common named entity recognition mistakes are training on the wrong text, adding types without examples, and trusting the output without a check.

  • Training on clean text. A model trained on news articles fails on scanned contracts with typos and odd formatting.
  • Too many entity types. Each new type needs labelled examples. Ten types with 20 examples each will all perform badly.
  • Ignoring ambiguous names. The same string can be a person, a place and a company. The model needs context examples for each use.
  • No human check. NER output feeds decisions, so a wrong entity can send a document to the wrong team. Check a sample every week.
  • Skipping the edge cases. Names at the start of a sentence, abbreviations and hyphenated names are the most common failures.

How should a team start with NER?

A team should start with named entity recognition by picking one document type, one or two entity types, and a small set of labelled examples from its own files.

  1. Pick one document type. Choose the document the team reads most, such as contracts, invoices or support tickets.
  2. Pick one or two entity types. Start with the names that drive a decision, such as parties and dates.
  3. Label 200 examples. Mark the entities in 200 real documents from the team's own files.
  4. Train a small model. Use a ready-made NER model and fine-tune it on the labelled set, or use rules for fixed formats.
  5. Measure on fresh documents. Test on documents the model has not seen, and count how many entities it finds and how many it gets wrong.

For teams that need help scoping this work, NLP development services can map the document types and the smallest NER setup that helps.

Key takeaways

  • NER finds names in text and labels each one with a type
  • It turns raw text into structured data that software can search and count
  • Context decides the type: the same word can be a company or a fruit
  • Start with one document type and one or two entity types
  • Measure accuracy on your own documents before trusting the output

Frequently asked questions

What is the difference between NER and keyword search?

Keyword search finds a word wherever it appears, with no idea what the word means. Named entity recognition finds a name and labels its type, such as person, company or place. The word Apple is a fruit in one sentence and a company in another, and NER is supposed to tell the difference from the context.

How much labelled data does NER need?

It depends on the number of entity types and how much the text varies. One or two types in consistent documents can work with a few hundred labelled examples. Many types in varied text need thousands. Start with 200 examples, measure, and add labels where the model fails.

Can NER work on scanned documents?

Yes, but the scan must be turned into text first with OCR, and OCR errors make the job harder. A misread name is hard to label correctly. Teams that work with scans clean the OCR output and label examples from scanned documents, not from clean digital text.

What is the difference between NER and entity linking?

NER finds the names and labels their types. Entity linking goes one step further and connects each name to a record in a database, such as a customer record or a company register. NER says 'Acme Bank is an organisation'; linking says 'this is the Acme Bank with customer number 1042'.

Does NER work in languages other than English?

Yes, but the quality depends on the language and the available models. Some languages have strong ready-made models, while others need a team to label its own examples. Multilingual models help when the team works in several languages, though accuracy varies by language.

How do I measure NER accuracy?

Use precision and recall on a test set the model has not seen. Precision is the share of entities the model found that are correct, and recall is the share of real entities it found. Report both per entity type, since a model can be strong on dates and weak on product names.

Found this useful? Share it.
Hertiv engineering team

Written from projects we build for clients: AI and agent systems in production. Every post is reviewed by a senior engineer before publishing and updated when practice changes.

About HertivHow we work

Planning to pull structured data from your documents?

A senior engineer replies within one business day. Or see our NLP Development service.

Book a free call

Keep reading

All posts

Tell us what you want to build

A senior engineer reads every request and replies within one business day with questions, a rough range, or a call link.

  • NDA on request before any details
  • You own all code, models and IP
  • US, UK and EU time-zone overlap

Your email app should open with your message ready to send. If it does not, write to [email protected].

Prefer email? Write to [email protected]
Estimate costBook a call