AI-103: Text Analysis, PII, Content Safety and Translation with Foundry
Language model text analysis is the work of pulling entities, topics, summaries, sentiment, safety and sensitive-data signals, and translations out of text, either with prompted Foundry models that return structured JSON or with Foundry Tools such as Azure Language, Azure AI Content Safety and Azure Translator. This lesson shows how to choose between a prebuilt tool, a custom model and a prompted model for each task, how to make generated JSON reliable with strict schemas, how to summarize documents larger than a context window, how to detect sentiment, tone, harmful content and PII, how Translator API version 2026-06-06 chooses between NMT, LLM and custom models, and how to customize model output for domain tasks such as compliance summarization.
What you’ll learn
- Choose between prebuilt NER, custom NER and a prompted model with a strict JSON schema for entity extraction, based on categories, labelled data and the need for offsets.
- Write strict structured-output schemas that use enums for fixed taxonomies and null unions for absent values, and diagnose strict-mode validation errors.
- Summarize documents larger than the context window with chunked map-reduce and hierarchical reduction.
- Configure sentiment and tone detection, Content Safety text analysis (severity levels, blocklists) and Azure Language PII detection and redaction.
- Configure Azure Translator 2026-06-06 targets (deploymentName, tone, gender, allowFallback, textType) and choose between adaptive datasets, reference pairs and Custom Translator models.
- Decide when an LLM-powered translation flow beats Translator, and customize model output for domain tasks with instructions, examples, schemas or fine-tuning.
The 10 parts · about 12 min of reading
- Which tool should extract entitiesStart hereChoose by three facts: standard or own categories, whether labelled data exists, and whether exact character offsets are needed.1 min
- How do you get reliable structured JSON from a language model?A strict json_schema guarantees the shape: every field required, additionalProperties false, null unions for missing values.2 min
- How do you summarize a document larger than the context window?Map-reduce: summarize chunks split on natural boundaries, then combine them, in several levels if the summaries overflow.1 min
- When do you use Azure Language sentiment analysis versus a language model?Sentiment analysis and opinion mining are legacy; new builds and labels such as tone or sarcasm need a model with a schema.1 min
- How do you detect safety issues in text with Azure AI Content Safety?text:analyze scores Hate, Sexual, Violence and SelfHarm on a 4- or 8-level scale and checks custom blocklists, no model needed.1 min
- How do you detect and redact sensitive content (PII)?PII detection returns redacted text plus each entity with category, offset and confidence; categories_filter limits what is masked.1 min
- How does Azure Translator text translation work in API version 2026-06-06?Each target picks its system with deploymentName: general NMT by default, an LLM deployment for tone and gender, or a custom model.2 min
- How do you make translations follow your terminology?Adaptive datasets and reference pairs steer LLM translation without training; Custom Translator is the only NMT adaptation.1 min
- When should you build an LLM-powered translation flow instead of using Translator?Prompt a Foundry model when the rule is something Translator parameters cannot express; keep NMT where volume and cost dominate.1 min
- How do you customize model output for domain tasks such as compliance summarization?Layer instructions and few-shot examples, then a strict schema, and fine-tune only when long examples on every call cost too much.1 min
Mind map
How the exam tests this
Expect short scenarios that describe a company's text workload and one or two constraints, then ask what to use, change or configure. The deciding detail is usually a constraint: standard or custom categories, labelled data or none, offsets needed or not, an existing app or a new build that must avoid legacy features, whether a language model is in the path, a private endpoint, NMT-only compliance, a same-day or no-training rule, cost at volume, or a per-string length limit. Several items show short Python or JSON request bodies — TextAnalyticsClient calls, Responses API json_schema definitions, Content Safety analyze requests, Translator targets — and ask which parameter or schema change fixes a stated symptom, so know what each parameter does and what it doesn't. Some items ask you to select two actions that together meet a requirement.
Key takeaways
- Standard entities: prebuilt NER. Own categories with labels, offsets and retraining: custom NER. Own categories, no labels, values only: a prompted model with a strict schema.
- Strict structured outputs need every property in required and additionalProperties false on every object; express optional values as a null union.
- Fixed label lists belong in an enum; instructions and temperature 0 reduce but never prevent off-list values.
- Content larger than the context window is chunked and summarized in levels; truncation, partial input and max_output_tokens all lose coverage.
- Sentiment analysis and opinion mining are legacy Azure Language features for existing apps; tone, sarcasm and new builds use a language model with a schema.
- Content Safety text analysis screens any text: EightSeverityLevels gives 0–7, blocklists catch policy terms, haltOnBlocklistHit (default false) skips further analysis on a hit. Model guardrails see only model traffic.
- PII detection returns redacted text plus each entity's category and confidence score; categories_filter narrows what is masked.
- In Translator 2026-06-06, deploymentName defaults to general NMT; tone and gender need an LLM deployment; allowFallback false makes unsupported pairs fail; LLM translation is unavailable behind a private endpoint.
- referenceTextPairs (up to five) override adaptiveDatasetId; a Custom Translator model is the NMT-only route to your terminology.
- Try instructions and examples first, enforce with a schema, and fine-tune only when long per-call examples are the cost problem.
Part 1: Which tool should extract entities
Choose by three facts: standard or own categories, whether labelled data exists, and whether exact character offsets are needed.
Frequently asked questions
When should I use custom NER instead of prompting a language model to extract entities?
Use custom NER in Azure Language when you have labelled examples of your own entity categories, need the exact character offset of every mention, and want a model you can retrain as categories change. Prompt a Foundry model with a strict JSON schema when you have no labelled data, need results quickly and only need the extracted values, because generated JSON doesn't give dependable offsets.
How do I make a field optional in strict structured outputs?
Keep the field in the required list and give it a union type that includes null, such as ["string", "null"], then tell the model to return null when the source doesn't contain the value. In strict mode every property must be required and every object needs additionalProperties set to false, so removing a field from required makes the schema invalid.
Is Azure Language sentiment analysis still recommended for new apps?
No. Microsoft lists sentiment analysis and opinion mining as legacy Azure Language capabilities, supported for existing implementations but not recommended for new development. Existing apps can keep using them, including adding opinion mining with show_opinion_mining; new builds, and anything needing tone or sarcasm labels, use a language model with an output schema.
Sign up free to mark lessons complete, bookmark topics and track your exam readiness.