Skip to main content
This guide demonstrates the core text-analysis capabilities available in Azure AI Language Services. It covers language detection, key phrase extraction, sentiment analysis, named entity recognition (NER), entity linking, summarization, and PII detection — with REST-style JSON payload examples and concise Python SDK snippets that illustrate common usage patterns. Use these features to build multilingual, privacy-aware, and searchable applications that extract meaningful information from unstructured text.
Never hard-code secrets (endpoint, keys) in production code. Store credentials in environment variables or a secure secrets store and load them at runtime.
For local testing, put your Azure Language endpoint and key in environment variables (or a .env file) and load them at runtime. The samples below assume you already have those values available.

At-a-glance: capabilities and common SDK methods

For full API reference and details about model versions, see the Azure AI Language Service documentation: https://learn.microsoft.com/azure/cognitive-services/language-service/

Language detection

Detects the language of a text and returns a confidence score. It supports automatic detection across many scripts (Latin, Arabic, Chinese, etc.). You can optionally provide a country hint to influence detection, but it is not required.
A dark-themed slide titled "Language Detection" with three numbered panels that list features: automatic language detection, support for multiple scripts, and returning confidence scores. Each panel includes a small icon and brief explanatory text.
Example request payload (REST-style):
Illustrative response structure:
Python SDK example — detects primary language and prints confidence:

Key phrase extraction

Extracts prominent words and short phrases (topics) from text. This is helpful for search indexing, content tagging, and summarization—best applied to longer passages.
A dark-themed slide titled "Key Phrase Extraction" with three numbered panels. The panels note: 01 Extracts key topics or phrases from text; 02 Works best with longer text passages; 03 Useful for summarization and search optimization.
Request payload example:
Illustrative response:
Python SDK example — extract key phrases from a single long document:

Sentiment analysis

Classifies documents (and sentences) as positive, neutral, negative, or mixed and returns confidence scores. Useful for product feedback, social-media analysis, and customer support automation.
A dark-themed slide titled "Sentiment Analysis" showing four colored boxes labeled Neutral, Positive, Negative, and Mixed. Each box has a short description explaining which sentence sentiments (neutral, positive, negative, or combinations) it represents.
Request example:
Illustrative response structure — shows document sentiment, sentence-level labels, and confidence scores:
Python SDK example — analyze sentiment with confidence scores:

Named entity recognition (NER)

NER extracts entities such as people, organizations, locations, datetimes, addresses, emails, and URLs from text. Use this to populate structured metadata, build knowledge graphs, or enhance search relevance.
A dark presentation slide titled "Named Entity Recognition" displays six turquoise icons labeled Person, Location, DateTime, Organization, Address, and Email & URL. A caption below reads "Identify key entities such as people, places, and dates in a text" with a small "© Copyright KodeKloud" in the corner.
Request example:
Illustrative response:
Python SDK example — recognize and list named entities:

Entity linking

Entity linking (or entity resolution) maps recognized mentions to entries in an external knowledge base (for example, Wikipedia). This disambiguates mentions such as “Paris” (city) vs “Paris” (person) and provides authoritative metadata (IDs and URLs).
A presentation slide titled "Entity Linking" with three numbered panels summarizing benefits: disambiguates similar names, links entities to authoritative sources, and improves search and content categorization.
Request example:
Illustrative response (entity link output):
Python SDK example — resolve mentions to knowledge sources:

Summarization

Summarization creates concise representations of long documents. You can choose:
  • Extractive summarization — select the most important sentences verbatim.
  • Abstractive summarization — generate a rewritten, shorter summary.
Summarization is useful for overviews of documents, slide decks, and long reports. Implementation details vary by SDK version and whether the operation is long-running (poller-based). Consult the Azure docs for the exact method name and behavior in your installed package.
A dark-themed slide titled "Summarization" showing three numbered panels with icons. The panels list: extracting key sentences from documents, supporting extractive and abstractive summarization, and usefulness for document analysis and content summarization.
Input example:
Illustrative extractive summary output:

Personally Identifiable Information (PII) detection and redaction

PII detection identifies sensitive data such as names, phone numbers, emails, and Social Security numbers. After detection you can redact or mask values to help meet privacy and compliance requirements (for example, GDPR or HIPAA).
A presentation slide titled "Personally Identifiable Information Detection" with three numbered feature boxes. It says the system identifies personal details like phone numbers, emails and addresses, redacts sensitive data for privacy compliance, and helps anonymize text.
Request example:
Illustrative redacted output:
Python SDK example — detect PII entities:
For legal or compliance-sensitive scenarios, combine detection with secure redaction and follow organizational privacy controls.

Example: single Flask app that runs multiple analyses

You can combine multiple analyses in a single application, keeping each call focused and handling errors per document. The example below shows how to load credentials, initialize a client, and call several analyzers (language, key phrases, sentiment, NER, entity linking, and PII) from a Flask route. This compact pattern is suitable for demos and small apps — for production, add proper error handling, rate limiting, and secrets management.
The screenshot below shows a simple web demo that runs these analyses and displays results (language, sentiment, key phrases, named/PII entities):
A screenshot of a webpage titled "Azure AI Language Services Demo" showing a text input box, a "Run Analysis" button, and a Results section. The Results list detected language and sentiment (positive), key phrases, and named/PII entities such as "Jane" and a phone number (1234566543).

Best practices

  • Never embed secrets in code. Use environment variables or a secret store.
  • Validate and sanitize inputs (especially if integrating with user-generated content).
  • Use batch processing for high-throughput scenarios and handle rate limits.
  • For compliance, store and handle redacted data according to your organization’s privacy policies.
  • Check model/version and SDK docs as behavior and method names can change over time.
That completes this overview of Azure AI Language Services text-analysis features. Use these tools to extract structure, meaning, and privacy-aware metadata from unstructured text across languages and domains.

Watch Video