What is named entity recognition NER
· Category: AI & Machine Learning
Short answer
Named entity recognition is an NLP task that identifies and classifies proper nouns and other meaningful chunks into predefined categories.
How it works
NER models process tokenized text and assign a label to each token indicating whether it belongs to an entity such as person, organization, location, date, or product. Traditional approaches use handcrafted rules and gazetteers, while modern systems use bidirectional LSTMs or transformers with a token classification head. The BIO tagging scheme marks the beginning, inside, and outside of entities to handle multi-word mentions.
Example
In the sentence "Apple is looking at buying U.K. startup for $1 billion," an NER system tags "Apple" as organization, "U.K." as location, and "$1 billion" as monetary value.
Why it matters
NER underpins information extraction, knowledge graph construction, and semantic search. It helps organizations automatically index documents, detect mentions of competitors, and extract structured data from unstructured text at scale.
Example
import torch
import torch.nn as nn
model = nn.Sequential(
nn.Linear(784, 256),
nn.ReLU(),
nn.Dropout(0.2),
nn.Linear(256, 10)
)
criterion = nn.CrossEntropyLoss()
optimizer = torch.optim.Adam(model.parameters(), lr=1e-3)
This snippet defines a simple neural network with dropout for regularization, a cross-entropy loss, and the Adam optimizer in PyTorch.