This chapter covers Named Entity Recognition (NER), a core capability of Azure AI Language under the Natural Language Processing (NLP) workload. In the AI-900 exam, NER falls under objective 4.2: 'Describe features of natural language processing workloads on Azure.' Approximately 10-15% of exam questions touch NLP topics, with NER being one of the most frequently tested features. You will be expected to understand what NER does, its common use cases, how to call it via the Azure AI Language service, and how to interpret its output. This chapter provides the depth needed to answer scenario-based and definitional questions confidently.
Jump to a section
Imagine you're a paralegal tasked with extracting key information from a stack of 500 legal contracts. Each contract is a plain text document. Your job is to go through every sentence and highlight specific items: person names (lawyers, judges), organizations (companies, courts), locations (cities, states), dates (filing deadlines, contract dates), and monetary values (settlements, fees). You don't need to understand the full legal argument—you just need to tag each occurrence of these predefined categories with a colored highlighter. This is exactly what Named Entity Recognition (NER) does. In Azure AI Language, NER is a prebuilt model that scans text and identifies entities like Person, Organization, Location, DateTime, and Quantity. The model is trained on millions of documents and uses a combination of pattern matching and machine learning. For example, when it sees "Microsoft" it recognizes it as an Organization; when it sees "$1.2 billion" it tags it as a Money entity. The output is a structured JSON that lists each entity, its category, subcategory (if any), and its exact offset in the original text. Just as you would highlight a name in yellow and a date in blue, the NER model assigns a type to each entity. The process is deterministic for well-known patterns (like dates) but probabilistic for ambiguous names (like "Washington" could be a location or a person). The model uses context—surrounding words—to disambiguate. This analogy mirrors the mechanism: input text → tokenization → entity recognition via CRF or transformer models → output structured data with categories and confidence scores.
What is Named Entity Recognition (NER)?
Named Entity Recognition (NER) is a natural language processing (NLP) technique that identifies and classifies named entities in unstructured text into predefined categories. In Azure AI Language, NER is a prebuilt model that can recognize entities across multiple categories, including Person, Organization, Location, DateTime, Quantity, Event, Product, and more. The service is part of the Azure AI Language (formerly Text Analytics) API, which is a managed cognitive service. NER is used to extract structured information from unstructured text, enabling downstream tasks like information retrieval, knowledge graph construction, and content summarization.
How NER Works Internally
Azure AI Language's NER model uses a combination of deep learning (transformer-based models) and pattern matching. The process involves several steps:
Text Preprocessing: The input text is tokenized into words, punctuation, and other linguistic units. The text is also normalized (e.g., lowercasing) and sentence boundaries are detected.
Contextual Encoding: The tokenized text is passed through a transformer model (similar to BERT) that generates contextual embeddings for each token. These embeddings capture the meaning of each word in its surrounding context, which is critical for disambiguating entities that have multiple meanings (e.g., "Apple" as a company vs. fruit).
Entity Tagging: A conditional random field (CRF) or linear classifier layer on top of the transformer assigns a label to each token. The labels follow the BIO (Begin, Inside, Outside) scheme. For example, for the entity "New York City", the token "New" is labeled B-Location, "York" is I-Location, and "City" is I-Location. Tokens that are not part of any entity are labeled O (Outside).
4. Entity Extraction: The tagged tokens are grouped into complete entities. For each entity, the model outputs: - Text: The exact string as it appears in the input. - Category: The entity type (e.g., Person, Organization). - Subcategory: A more specific type (e.g., for Location, subcategories include City, State, Country). - Confidence Score: A value between 0 and 1 indicating the model's confidence in the prediction. - Offset: The character position in the original text where the entity begins and ends.
Key Components and Defaults
- Categories: The prebuilt NER model supports over 20 entity categories. The most common ones tested on the exam are:
- Person: Names of people.
- Organization: Companies, institutions, agencies.
- Location: Geographic places.
- DateTime: Dates, times, durations.
- Quantity: Numbers, percentages, currency.
- Event: Historical events, holidays.
- Product: Products, services.
- Skill: Skills or abilities.
- Subcategories: Many categories have subcategories. For example, Location includes City, State, Country, Continent, etc. The exam may ask you to identify which subcategory an entity belongs to.
- Confidence Score: The model returns a confidence score for each entity. Scores above 0.5 are generally considered reliable, but thresholds can be adjusted in custom implementations.
- API Version: The current stable API version for Azure AI Language is 2023-04-01. The NER endpoint is typically https://<your-resource-name>.cognitiveservices.azure.com/language/:analyze-text?api-version=2023-04-01.
- Request Format: The API expects a JSON body with a kind field set to EntityRecognition and an analysisInput containing the documents. Each document has an id and text. Example request:
{
"kind": "EntityRecognition",
"parameters": {
"modelVersion": "latest"
},
"analysisInput": {
"documents": [
{
"id": "1",
"text": "Microsoft was founded by Bill Gates and Paul Allen on April 4, 1975."
}
]
}
}Response Format: The response includes a documents array with each document's entities array. Each entity has text, category, subcategory, confidenceScore, and offset. Example response:
{
"documents": [
{
"id": "1",
"entities": [
{
"text": "Microsoft",
"category": "Organization",
"subcategory": null,
"offset": 0,
"length": 9,
"confidenceScore": 0.99
},
{
"text": "Bill Gates",
"category": "Person",
"subcategory": null,
"offset": 25,
"length": 10,
"confidenceScore": 0.98
},
{
"text": "Paul Allen",
"category": "Person",
"subcategory": null,
"offset": 35,
"length": 10,
"confidenceScore": 0.98
},
{
"text": "April 4, 1975",
"category": "DateTime",
"subcategory": "Date",
"offset": 50,
"length": 14,
"confidenceScore": 1.0
}
],
"warnings": []
}
],
"errors": []
}Configuration and Verification Commands
To use NER, you need an Azure AI Language resource. You can create one via the Azure portal, Azure CLI, or ARM template. The endpoint and key are used to authenticate requests. The exam does not require you to memorize CLI commands, but you should know that you can test NER using:
Azure Language Studio: A web-based UI that allows you to try NER without writing code. You can paste text and see the entities highlighted.
REST API: Direct HTTP calls as shown above.
SDKs: Available in C#, Python, Java, and JavaScript. Example Python snippet:
from azure.ai.textanalytics import TextAnalyticsClient
from azure.core.credentials import AzureKeyCredential
endpoint = "https://<your-resource-name>.cognitiveservices.azure.com/"
key = "<your-key>"
text_analytics_client = TextAnalyticsClient(endpoint=endpoint, credential=AzureKeyCredential(key))
documents = ["Microsoft was founded by Bill Gates and Paul Allen on April 4, 1975."]
response = text_analytics_client.recognize_entities(documents)
for doc in response:
for entity in doc.entities:
print("Entity: {}".format(entity.text))
print("Category: {}".format(entity.category))
print("Confidence Score: {}".format(entity.confidence_score))
print()Interaction with Related Technologies
NER is often used in conjunction with other Azure AI Language features: - Key Phrase Extraction: Extracts important phrases, which can include entities but is broader. - Sentiment Analysis: Determines sentiment of text, which can be applied to sentences containing entities. - Language Detection: Identifies the language of text, which is necessary for NER to work correctly (the model is language-specific). - PII Detection: A specialized form of NER that identifies personally identifiable information like phone numbers, email addresses, and social security numbers.
On the exam, you may be asked to differentiate between NER and PII detection. NER extracts general entities (Person, Organization), while PII detection specifically targets sensitive personal data. PII detection also redacts the text by replacing entities with their category labels (e.g., "[Person]").
Edge Cases and Limitations
Ambiguity: Words like "Washington" can be a person, a state, or a city. The model uses context but may still be wrong. Confidence scores help flag low-confidence predictions.
Domain-specific entities: The prebuilt model may not recognize specialized terms (e.g., medical terms). For such cases, you can use Custom NER (part of Azure AI Language) to train your own model.
Language support: The prebuilt NER model supports multiple languages, but the entity coverage varies. English has the broadest coverage. Check the Azure documentation for the latest list.
Text length limits: The API accepts documents up to 5,120 characters per document. Longer texts must be split into multiple documents.
Performance and Scale
Azure AI Language NER is designed for high throughput. You can send up to 1,000 documents per request (batch). Each document is processed independently. The service scales automatically based on the pricing tier (Free, Standard S). The Free tier allows up to 5,000 text records per month. For production, use the Standard tier with pay-as-you-go pricing.
Prepare Input Text
The input text is a string of natural language, up to 5,120 characters per document. The text can be in any supported language (e.g., English, Spanish, French). The API expects a JSON document with an 'id' field (unique identifier) and 'text' field. For batch processing, you can include up to 1,000 documents in a single request. The text is not preprocessed by the user—the model handles tokenization and normalization internally.
Send Request to API
The client sends an HTTP POST request to the Azure AI Language endpoint with the JSON body. The request must include a valid subscription key in the 'Ocp-Apim-Subscription-Key' header. The API version (e.g., '2023-04-01') is specified in the query string. The request kind is 'EntityRecognition'. The service authenticates the key and routes the request to the appropriate processing node.
Tokenization and Sentence Splitting
The service tokenizes the text into words, punctuation, and other tokens. It also splits the text into sentences using a sentence boundary detection model. This step is crucial because NER operates on a per-sentence basis. The tokenizer handles contractions, hyphenated words, and special characters. For example, 'I'm' is split into 'I' and ''m'. The sentence boundaries are used to provide context for entity disambiguation.
Contextual Embedding Generation
Each token is converted into a contextual embedding using a transformer neural network. The embedding captures the meaning of the token in its surrounding context (e.g., the words before and after). This allows the model to distinguish between different meanings of the same word. For example, 'Apple' in 'Apple released a new iPhone' is encoded differently from 'Apple' in 'I ate an apple'. The embeddings are high-dimensional vectors (e.g., 768 dimensions for BERT-base).
Entity Tagging with CRF
A Conditional Random Field (CRF) layer takes the embeddings and assigns a BIO label to each token. The CRF considers the sequence of labels to ensure consistency (e.g., an I-label must follow a B-label of the same type). The model outputs a probability distribution over labels for each token. The final label is the one with the highest probability. The CRF also enforces that entity boundaries are valid (e.g., no I-Location without a preceding B-Location).
Post-processing and Output
The tagged tokens are grouped into entity spans. For each span, the model extracts the original text, category, subcategory, confidence score, and offset. The confidence score is the product of the token-level probabilities or the average. Entities with low confidence (typically below 0.5) may be excluded. The output is returned as a JSON response. The client can then parse the entities and use them in downstream applications.
Enterprise Scenario 1: Legal Document Review
A large law firm processes thousands of contracts annually. They use Azure AI Language NER to automatically extract parties (Person, Organization), dates, and monetary amounts from each contract. The extracted entities are fed into a database for search and analysis. For example, they can quickly find all contracts where 'Microsoft' is a party or where the contract value exceeds $1 million. The NER model is called via a Python script that reads PDFs, converts them to text, and sends batches of 1,000 documents to the API. The firm uses the Standard tier and processes about 50,000 documents per month. One common issue is that the model sometimes misidentifies a person's name as an organization (e.g., 'Johnson & Johnson' as Organization is correct, but 'Johnson' alone might be tagged as Person). To mitigate this, they use confidence score thresholds—only entities with confidence > 0.8 are accepted. They also run a secondary validation step using a custom NER model trained on legal terminology.
Enterprise Scenario 2: Customer Support Ticket Routing
A global e-commerce company receives millions of customer support tickets daily. They use NER to extract product names, locations, and order numbers from ticket text. This information is used to automatically route tickets to the appropriate department. For example, a ticket mentioning 'laptop' and 'New York' is routed to the hardware support team for the Northeast region. The NER API is integrated into their ticketing system via a serverless function that processes each ticket upon creation. The function calls the API with the ticket text and uses the extracted entities to populate routing fields. Performance is critical—they need sub-second response times. Azure AI Language typically responds in under 200ms for short texts. If the API is throttled (due to rate limits), the function retries with exponential backoff. One challenge is that product names often contain numbers (e.g., 'iPhone 14'), which the model may tag as Quantity instead of Product. They address this by using Custom NER to train a model on their product catalog.
Enterprise Scenario 3: News Aggregation and Knowledge Graph
A media monitoring company aggregates news articles from thousands of sources. They use NER to extract entities like persons, organizations, and locations to build a knowledge graph of relationships. For each article, they extract entities and then link them to a knowledge base (e.g., Wikidata) using entity linking (another Azure AI Language feature). This enables queries like 'Find all articles where Elon Musk mentions Tesla.' They process millions of articles per day using a distributed pipeline. The pipeline splits large articles into chunks (under 5,120 characters) and sends them in parallel to the API. They use the batch API to maximize throughput. One common error is that the model may miss entities in noisy text (e.g., HTML artifacts). They preprocess text to remove tags and normalize whitespace. They also use language detection to route text to the correct language model. Misconfiguration of the API key or endpoint is a frequent source of errors—they use Azure Key Vault to store secrets securely.
AI-900 Exam Focus on NER
The AI-900 exam tests your understanding of NER under objective 4.2: 'Describe features of natural language processing workloads on Azure.' Specifically, you need to:
Identify the purpose of NER: extracting entities like people, places, dates, and organizations from text.
Differentiate NER from other NLP features like sentiment analysis, key phrase extraction, and language detection.
Recognize the output format: entities with categories, subcategories, and confidence scores.
Know common use cases: information extraction, content categorization, and automated data entry.
Understand that NER is a prebuilt model in Azure AI Language, and that custom NER is available for domain-specific needs.
Common Wrong Answers
Confusing NER with Key Phrase Extraction: Key phrase extraction returns multi-word phrases that summarize the main topics, not specific entity categories. A common trap question asks: 'Which Azure AI Language feature extracts person names and dates?' The wrong answer is 'Key Phrase Extraction' because candidates think phrases include names. But NER is the correct answer—it specifically extracts named entities with predefined categories.
Thinking NER returns sentiment: Some candidates assume that NER includes sentiment analysis because both are part of Azure AI Language. However, NER does not provide sentiment. Sentiment analysis is a separate feature. A question might list a scenario where a company wants to extract product names from reviews. The correct feature is NER, not sentiment analysis.
Believing NER requires training: The prebuilt NER model requires no training—it works out of the box. Candidates may think they need to provide labeled data, which is only needed for Custom NER. The exam tests this distinction: 'Which NER capability can be used without providing training data?' Answer: Prebuilt NER.
Misidentifying entity categories: The exam may show a sample output and ask which entity category is incorrect. For example, if the output tags '2023' as 'Number' instead of 'DateTime', the candidate might think it's correct. Numbers are Quantity, not DateTime. The subcategory 'Date' is under DateTime, not Quantity.
Specific Numbers and Terms
Maximum characters per document: 5,120.
Maximum documents per batch: 1,000.
Confidence score range: 0 to 1.
Common categories: Person, Organization, Location, DateTime, Quantity.
API version: 2023-04-01 (may be updated; always check the latest).
Pricing tiers: Free (F0) and Standard (S).
Edge Cases and Exceptions
Ambiguous entities: The model uses context but may still be wrong. Confidence scores indicate reliability.
Multi-word entities: e.g., 'New York City' is a single Location entity. The model must correctly identify the boundaries.
Entities spanning sentences: The model works per sentence, so an entity that spans two sentences (e.g., 'Mr. Smith' in one sentence and 'he' in the next) is not resolved. Coreference resolution is not part of NER.
Language support: Not all categories are available in all languages. For example, the 'Skill' category is only available in English.
How to Eliminate Wrong Answers
If the question asks about extracting specific types like 'Person' or 'Organization', the answer is NER, not key phrase extraction or sentiment.
If the question mentions 'confidence score', it's NER or PII detection (both return scores).
If the question involves redacting sensitive data, it's PII detection, not NER.
If the question requires training a model, it's Custom NER, not prebuilt NER.
NER extracts predefined named entities (Person, Organization, Location, DateTime, Quantity) from unstructured text.
The output includes entity text, category, subcategory, confidence score (0-1), and character offset.
Prebuilt NER requires no training; Custom NER is available for domain-specific needs.
Maximum document length is 5,120 characters; maximum batch size is 1,000 documents.
NER is part of Azure AI Language (Text Analytics) and can be accessed via REST API or SDKs.
NER is different from Key Phrase Extraction (returns phrases without categories) and PII Detection (focuses on sensitive data).
The model uses contextual embeddings and CRF for sequence labeling.
Ambiguous entities may have lower confidence scores; use thresholds to filter.
NER supports multiple languages, but coverage varies.
Common exam scenario: extracting entities from customer reviews, legal documents, or news articles.
These come up on the exam all the time. Here's how to tell them apart.
Named Entity Recognition (NER)
Extracts general entities: Person, Organization, Location, DateTime, Quantity, etc.
Does not redact or mask entities; returns the original text.
Used for information extraction, content categorization, and knowledge graph building.
Confidence score indicates likelihood of correct category.
Prebuilt model covers over 20 categories.
PII Detection
Extracts sensitive personal data: PhoneNumber, Email, SSN, CreditCard, etc.
Can redact (mask) entities by replacing them with category labels (e.g., '[Person]').
Used for compliance, data privacy, and security applications.
Confidence score indicates likelihood of correct identification.
Prebuilt model covers over 30 categories of PII.
Mistake
NER and Key Phrase Extraction are the same thing.
Correct
NER extracts specific named entities (Person, Organization, etc.) with predefined categories. Key Phrase Extraction returns multi-word phrases that represent the main topics of the text, without category labels. They serve different purposes and have different outputs.
Mistake
NER requires you to provide a list of entity names to recognize.
Correct
The prebuilt NER model in Azure AI Language does not require any custom input. It recognizes entities based on a general-purpose model trained on large corpora. Custom NER is only needed for domain-specific entities.
Mistake
NER can identify any type of entity, including email addresses and phone numbers.
Correct
NER identifies general categories like Person, Organization, Location, etc. For sensitive personal data like email addresses, phone numbers, and social security numbers, you should use the PII (Personally Identifiable Information) detection feature, which is a specialized NER variant.
Mistake
The NER model always returns a confidence score of 1.0 for correct entities.
Correct
Confidence scores range from 0 to 1 and reflect the model's certainty. Even correct entities may have scores less than 1.0, especially for ambiguous or rare entities. Scores above 0.5 are generally reliable, but the threshold can be adjusted.
Mistake
NER works only on English text.
Correct
Azure AI Language NER supports multiple languages, including Spanish, French, German, Chinese, and many others. The entity coverage varies by language, with English having the broadest coverage. Always check the documentation for the latest language support.
Reveal each answer, then mark whether you got it right. Score 60%+ to unlock the next chapter.
NER (Named Entity Recognition) extracts general entities like Person, Organization, Location, and DateTime. PII (Personally Identifiable Information) detection is a specialized form of NER that identifies sensitive data such as phone numbers, email addresses, social security numbers, and credit card numbers. Additionally, PII detection can redact the text by replacing entities with their category labels (e.g., '[Person]'), while NER does not redact. Both return confidence scores. On the exam, if a scenario involves extracting 'names of people and companies,' use NER. If it involves 'removing sensitive information like phone numbers,' use PII detection.
Yes, Azure AI Language provides a prebuilt NER model that works out of the box—no training required. You simply send text to the API and receive entity predictions. If you need to recognize domain-specific entities (e.g., medical terms or product codes), you can use Custom NER, which requires you to provide labeled training data. The exam focuses on the prebuilt model, so expect questions about its capabilities and limitations.
The prebuilt NER model supports over 20 categories, including Person, Organization, Location, DateTime, Quantity, Event, Product, Skill, and more. Each category may have subcategories. For example, Location includes City, State, Country, Continent, etc. On the exam, you may be asked to identify which category an entity belongs to based on a sample output. The most commonly tested categories are Person, Organization, Location, DateTime, and Quantity.
You call the Azure AI Language REST API endpoint: `https://<your-resource-name>.cognitiveservices.azure.com/language/:analyze-text?api-version=2023-04-01`. You send a POST request with a JSON body containing 'kind': 'EntityRecognition' and an 'analysisInput' with documents. Each document has an 'id' and 'text'. You authenticate using a subscription key in the 'Ocp-Apim-Subscription-Key' header. You can also use the SDKs (Python, C#, etc.) for easier integration. On the exam, you won't need to write code, but you should understand the request/response structure.
Each document can be up to 5,120 characters. If your text is longer, you must split it into multiple documents. You can send up to 1,000 documents in a single batch request. These limits apply to the prebuilt NER model. Always check the latest documentation as limits may change. The exam may test these numbers, so remember 5,120 characters and 1,000 documents per batch.
The NER model uses contextual embeddings to disambiguate entities. For 'Washington,' the model looks at surrounding words to determine if it refers to a person (e.g., 'George Washington'), a state (e.g., 'Washington state'), or a city (e.g., 'Washington, D.C.'). The model outputs a confidence score that reflects its certainty. If the context is insufficient, the score may be lower. The exam may test that the model uses context to resolve ambiguity.
No, the prebuilt NER model does not extract email addresses or phone numbers as standard entities. For that, you should use the PII detection feature, which is specifically designed to identify such sensitive data. NER focuses on general categories like Person, Organization, etc. On the exam, if a question asks about extracting 'phone numbers from text,' the correct answer is PII detection, not NER.
You've just covered Named Entity Recognition (NER) — now see how well it sticks with free AI-900 practice questions. Full explanations included, no account needed.
Done with this chapter?