P

Named Entity Recognition: Definition and Examples

Named Entity Recognition (NER) is a natural language processing technique that automatically identifies and classifies named entities (people, places, organizations, dates, etc.) in a text.

Full definition

Named Entity Recognition (NER) is a fundamental subtask of natural language processing (NLP). It involves detecting mentions of real-world entities in raw text and categorizing them into predefined classes such as person names, organizations, geographical locations, dates, monetary amounts, or products.

This technology historically relied on rule-based and dictionary-based approaches, but modern methods predominantly use deep learning models, especially Transformer architectures like BERT or GPT. These models can understand the context surrounding each word to determine whether it is an entity and, if so, of which type.

In the context of prompt engineering, NER is particularly useful for structuring unstructured data. One can ask an LLM to extract named entities from a text, classify them by category, or use them as a basis for more complex tasks such as building knowledge graphs or targeted sentiment analysis.

NER has concrete applications in many fields: media monitoring (identifying actors mentioned in articles), legal analysis (extracting stakeholders from contracts), healthcare (spotting drug names and pathologies), and customer service (detecting products or services mentioned in complaints).

Etymology

The term 'Named Entity' was introduced at the sixth Message Understanding Conference (MUC) in 1996, organized by DARPA. The concept arose from the need to evaluate information extraction systems on standardized tasks. 'Named' refers to proper nouns and referring expressions, while 'Recognition' denotes the automatic process of detection and classification.

Concrete examples

Extracting entities from a news article

Analyze the following text and extract all named entities, classifying them by category (Person, Organization, Location, Date, Amount):

"Emmanuel Macron met with the CEO of TotalEnergies at the Élysée on March 12, 2026 to discuss an investment of 2 billion euros in renewable energy."

Respond in a structured table format.

Anonymization of sensitive documents

Identify all named entities of type Person and Organization in this document, then replace them with anonymous identifiers (PERSON_1, ORGANIZATION_1, etc.) while maintaining reference consistency throughout the text.

Building a knowledge graph from texts

From this corpus of texts, extract all named entities and the relationships between them. For each identified relationship, indicate: source entity, relationship type, target entity. Format the result in JSON suitable for a knowledge graph.

Practical usage

In prompt engineering, NER is primarily used to ask an LLM to extract and structure precise information from raw text. Results can be refined by specifying the desired entity categories, the expected output format (JSON, table, list), and by providing examples to guide the model via few-shot prompting. This technique is particularly powerful for automating document analysis, information monitoring, and data preparation.

Related concepts

Natural Language Processing (NLP)TokenizationPart-of-Speech TaggingInformation Extraction

FAQ

What is the difference between NER and keyword extraction?
Keyword extraction identifies the most important or frequent terms in a text, whether they are entities or not. NER, on the other hand, focuses specifically on real-world named entities (people, places, organizations) and classifies them into semantic categories. A keyword can be a verb or adjective, while a named entity is always a reference to an identifiable object or concept.
Are LLMs like ChatGPT or Claude good at NER?
Yes, large language models are very effective for NER, especially in zero-shot or few-shot modes. They often outperform specialized NER models on new domains due to their broad general knowledge. However, for use cases requiring massive processing or very specific categories, dedicated models like spaCy or fine-tuned BERT models may be more cost-effective and faster.
How can I improve NER accuracy in my prompts?
To improve accuracy, explicitly define the entity categories you are looking for, provide 2-3 annotated examples in your prompt (few-shot), specify the desired output format, and add instructions for ambiguous cases. For instance, indicate whether acronyms should be resolved or whether nested entities (a person who is a member of an organization) should be handled separately.

See also

How to use this prompt

  1. Copy the prompt with the button above.
  2. Paste it into ChatGPT, Claude or your favorite AI assistant.
  3. Replace the bracketed variables with your details, then refine the result.

About Prompt Guide

Prompt Guide is a free library of 2500+ ready-to-use prompts for ChatGPT, Claude and other AIs, with guides to learn prompting and tools to build and optimize your own prompts.

More definitions

Get new prompts every week

Join our newsletter.