Home › Studies › AI-103 › Text & Speech › Text Analysis & Translation

Text Analysis & Translation

Prompted analysis vs Azure Language · NER · sentiment · PII · structured outputs · harm categories · Azure Translator (NMT and LLM) · customizing outputs

By the tools4free.dev team · Last reviewed November 13, 2026

Practice questions for this topic →

Two ways to analyze text in Foundry

The Foundry portal offers two approaches: general-purpose AI models driven by natural language prompts, and purpose-built language tools that return structured, deterministic results for specific tasks.

QuestionGeneral-purpose model (Responses API)Azure Language in Foundry Tools
How is the task defined?A natural language prompt: sentiment, entities, summaries, translation, questions and more, with no configuration or trainingA purpose-built analyzer per task, such as language detection or PII detection
Output consistencyCan vary between calls because the model generates text probabilisticallyStructured, deterministic output from statistical techniques; suited to automated pipelines
Python clientOpenAI client with client.responses.create(...); endpoint ends in /openai/v1/TextAnalyticsClient from azure-ai-textanalytics with AzureKeyCredential
Pick it whenYou need flexible, conversational analysis without a fixed outputYou need a consistent language code, confidence score or redacted text

The SDK methods named in the module: detect_language() takes a list of strings and returns the detected language, its ISO 639-1 code and a confidence score between 0 and 1; recognize_pii_entities() returns the redacted text plus the entities found, each with a category and confidence score.

For agents, Azure Language is also exposed as the Azure Language MCP server (remote in the Foundry Tool Catalog, or local). MCP is an open standard for connecting agents to external tools and data. A Foundry resource already includes access to Language tools, so you don't create a separate Azure Language resource for it.

Azure Language features

TaskFeatureGroupCustomizable?
Detect and redact sensitive information such as PII and PHIPII detectionCoreNo
Detect the language of a textLanguage detectionCoreNo
Extract categories of information without a custom modelPrebuilt NERCoreNo
Extract categories of information with a model specific to your dataCustom NERCoreYes
Extract medical information from clinical documents without a modelText analytics for healthCoreNo
Extract main topics and important phrasesKey phrase extractionLegacyNo
Sentiment and opinions in textSentiment analysis and opinion miningLegacyNo
Summarize long text or conversationsSummarizationLegacyNo
Disambiguate entities and link to WikipediaEntity linkingLegacyNo
Classify documents into your own classesCustom text classificationLegacyYes

Core capabilities are recommended for new development. Legacy capabilities are supported for existing implementations. Sentiment analysis and opinion mining and Summarization both retire from Azure Language on March 31, 2029; the page says to migrate existing workloads and direct all new projects to Microsoft Foundry.

Summarization

Sentiment, PII and safety detection

Sentiment and opinions

PII detection feature types

Feature typeInputProcessing
Text PIIRaw text strings: apps, prompts, logs, ticketsSynchronous detection and redaction
Conversation PIITurn-based chat or transcript dataAsynchronous, job-based; transcript-aware
Document-based PIINative files (.pdf, .docx, .txt)Asynchronous, storage-based; keeps document structure and returns JSON metadata

PII detection runs as-is: there is no customization of the model used on your data. The anonymization (synthetic replacement) feature is in preview.

Harm categories and guardrails

Structured JSON outputs

Structured outputs make a model follow a JSON Schema you supply in the call. The older JSON mode guaranteed valid JSON but couldn't ensure the schema was followed.

APIWhere the schema goesPython helper
Chat Completionsresponse_formatclient.beta.chat.completions.parse(..., response_format=Model); result in message.parsed
Responsestext.formatresponses.parse(..., text_format=Model); result in output_parsed

Translation with Azure Translator

Azure Translator in Foundry Tools is a cloud-based neural machine translation service. The latest generally available text translation version is 2026-06-06; it has breaking changes compared with v3.0, so validate before you migrate.

NMTLLM
Choice in 2026-06-06Standard neural machine translationAn LLM deployment (for example GPT-5.1); requires a Microsoft Foundry resource
BillingSource-text charactersProcessed input and output tokens
Array limit per Translate call1,000 elements of up to 50,00050 elements of up to 5,000
Extra controls-Tone (formal, informal, neutral) and gender-specific output; up to five reference translations or an adaptive dataset index ID
NeedFeature
Translate batch and complex files, keeping format; needs Blob storageDocument translation (asynchronous)
Translate one file, no Blob storage neededDocument translation (synchronous)
Adapt supported LLMs with 5 to 10,000 prealigned segment pairs (each up to 500 characters)Adaptive custom translation
Build custom models for domain terminology and styleCustom Translator
Dynamic dictionary and preventing translation of chosen textText translation v3 features

Customizing model output for domain tasks

Compliance summarization and domain extraction are not described on a dedicated Learn page. Build them from the pieces above: a system message that fixes role, scope and tone, a JSON Schema for the fields, and few-shot examples; use Custom NER when you need a trained model for your own entity categories.

CLI and PowerShell

TaskAzure CLIPowerShell
Install the Azure Language Python SDKpip install azure-ai-textanalytics-
Create the Language clientclient = TextAnalyticsClient(endpoint=endpoint, credential=AzureKeyCredential(key))-
Detect the language of a textresult = client.detect_language([text])[0]-
Redact PII in a textresult = client.recognize_pii_entities([text])[0]-
Prompt a deployed model (Responses API)message = client.responses.create( model=deployment_name, input="", )-
Structured output with Chat Completionscompletion = client.beta.chat.completions.parse( model="MODEL_DEPLOYMENT_NAME", # replace with the model deployment name of your gpt-4o 2024-08-06 deployment messages=[ {"role": "system", "content": "Extract the event information."}, {"role": "user", "content": "Alice and Bob are going to a science fair on Friday."}, ], response_format=CalendarEvent, )-
Structured output with Responsesresponse = openai.responses.parse( model="gpt-5-mini", input="Extract the event information from: Alice and Bob are going to a science fair on Friday.", text_format=CalendarEvent, )-

Exam Tips

Tick each tip once you can answer it without looking.

“Same prompt must give a consistent language code and confidence score in a pipeline” → Azure Language SDK (detect_language), not a prompted model. Trap: Prompted models generate text probabilistically, so wording and format can vary between calls.

“Analyze sentiment, extract entities and summarize with no training or configuration” → Deploy a general-purpose model and prompt it (Responses API). Trap: Custom NER and custom text classification need training on your data.

“Python package for Azure Language text analysis” → azure-ai-textanalytics, client TextAnalyticsClient. Trap: openai is the package for the Responses API, and azure-cognitiveservices-speech is for speech.

“Agent needs deterministic language detection or PII redaction as a tool” → Add the Azure Language MCP server to the agent. Trap: A separate Language resource isn't needed: a Foundry resource already includes Language tools.

“Extract entity categories without building a model” → Prebuilt NER. Trap: Custom NER is the one that trains a model on your own data and categories.

“Extract entity categories specific to your domain's data” → Custom NER (customizable). Trap: Prebuilt NER and PII detection are preconfigured; their models can't be changed.

“Redact PII from chat or call transcripts with turn context” → Conversation PII (asynchronous, job-based). Trap: Text PII is synchronous and for raw strings; Document-based PII is for native files.

“Redact PII in .pdf and .docx files and keep document structure” → Document-based PII (asynchronous). Trap: Text PII takes string payloads, not native files.

“Summary made of sentences copied from the source, with rank scores” → Extractive summarization. Trap: Abstractive summarization writes new sentences that aren't copied.

“Plan for Language sentiment or summarization in a new project” → Both retire March 31, 2029: direct all new projects to Microsoft Foundry. Trap: They are legacy capabilities, supported for existing implementations only.

“Four harm categories in Content Safety guardrails” → Hate, sexual, violence, self-harm. Trap: Prompt attacks and protected material are separate risks, not core harm categories.

“Blocking level that blocks only high-severity content” → Low (least restrictive). Trap: High blocks low, medium and high; safe content is never blocked at any level.

“Model output must match a JSON Schema, Chat Completions call” → response_format with a schema (strict: true). Trap: JSON mode only guarantees valid JSON, not adherence to your schema.

“Same, but with the Responses API” → Schema under text.format; Python responses.parse(text_format=Model), read output_parsed. Trap: response_format is the Chat Completions parameter.

“Structured outputs schema rules” → All fields required (emulate optional with a null union), additionalProperties: false, up to 100 properties and five nesting levels. Trap: The root object can't be anyOf.

“Translate with tone control and reference translations” → Translator 2026-06-06 with an LLM deployment (needs a Foundry resource). Trap: NMT is billed per source-text character, and tone variants are listed for LLM-based translation; v3.0 has a different request and response schema.

“Translate batches of files and keep layout; storage needed” → Asynchronous document translation (Azure Blob storage). Trap: Synchronous document translation handles a single file with no Blob storage.

“Steer tone, role and scope of a chat model for a domain task” → System message with role, audience and tone, and scope; test and iterate. Trap: Few-shot examples only condition the current call; they don't change the model permanently.

Sources

Checked against Microsoft Learn on November 13, 2026.

← Text & Speech overviewSpeech Solutions →