πŸ”’ Guided

Pre-launch preview. Authorised access only.

Incorrect code

Guided by A Guide to Cloud
Explore AB-900 AI-901
Guided AI-901 Domain 2
Domain 2 β€” Module 6 of 15 40%
17 of 26 overall

AI-901 Study Guide

Domain 1: AI Concepts and Capabilities

  • What is AI? Your First 10 Minutes Free
  • Responsible AI: The Six Principles Free
  • How Generative AI Actually Works Free
  • Choosing the Right AI Model Free
  • Deploying AI Models: Options & Settings
  • AI Workloads at a Glance
  • Text Analysis: Keywords, Entities & Sentiment
  • Speech: Recognition & Synthesis
  • Computer Vision: Seeing the World
  • Image Generation: Creating with AI
  • Information Extraction: From Chaos to Structure

Domain 2: Implement AI Solutions Using Foundry

  • Prompting Fundamentals: System & User Prompts
  • Microsoft Foundry: Your AI Command Center Free
  • Building a Chat App with the Foundry SDK
  • Agents in Foundry: Create & Test
  • Building an Agent Client App
  • Building a Text Analysis App
  • Multimodal: Responding to Speech
  • Azure Speech in Foundry Tools
  • Visual Prompts: Images as Input
  • Generating Images with AI
  • Building a Vision App
  • Content Understanding: Documents & Forms
  • Multimodal Extraction: Images, Audio & Video
  • Building an Extraction App
  • Exam Prep: Putting It All Together

AI-901 Study Guide

Domain 1: AI Concepts and Capabilities

  • What is AI? Your First 10 Minutes Free
  • Responsible AI: The Six Principles Free
  • How Generative AI Actually Works Free
  • Choosing the Right AI Model Free
  • Deploying AI Models: Options & Settings
  • AI Workloads at a Glance
  • Text Analysis: Keywords, Entities & Sentiment
  • Speech: Recognition & Synthesis
  • Computer Vision: Seeing the World
  • Image Generation: Creating with AI
  • Information Extraction: From Chaos to Structure

Domain 2: Implement AI Solutions Using Foundry

  • Prompting Fundamentals: System & User Prompts
  • Microsoft Foundry: Your AI Command Center Free
  • Building a Chat App with the Foundry SDK
  • Agents in Foundry: Create & Test
  • Building an Agent Client App
  • Building a Text Analysis App
  • Multimodal: Responding to Speech
  • Azure Speech in Foundry Tools
  • Visual Prompts: Images as Input
  • Generating Images with AI
  • Building a Vision App
  • Content Understanding: Documents & Forms
  • Multimodal Extraction: Images, Audio & Video
  • Building an Extraction App
  • Exam Prep: Putting It All Together
Domain 2: Implement AI Solutions Using Foundry Premium ⏱ ~14 min read

Building a Text Analysis App

Put text analysis into practice. Build a lightweight Python app that extracts sentiment, entities, and key phrases from text using Azure AI Language in Foundry.

Building with text analysis

β˜• Simple explanation

You learned what text analysis can do in Module 7. Now you’ll build an app that actually does it.

Imagine DataFlow Corp’s support team receives thousands of customer emails. Your app will automatically: detect the sentiment (happy or frustrated?), extract key phrases (what’s it about?), and identify entities (which customer? which product?). All in a few lines of Python.

Azure AI Language (part of Foundry Tools) provides REST APIs and SDK support for text analysis tasks including sentiment analysis, entity recognition, key phrase extraction, and language detection. You can also use multimodal models like GPT-4o for text analysis through the chat completions API.

Two approaches to text analysis

Two ways to build text analysis apps
FeatureAzure AI Language (Foundry Tools)GPT-4o (Chat Completions)
How it worksDedicated NLP API with specific endpoints for each taskSend text to GPT-4o with instructions to analyse it
Output formatStructured JSON with scores and labelsNatural language response (flexible format)
Best forHigh-volume processing, consistent structured outputFlexible analysis, combined with other tasks
CostLower per-transaction for dedicated tasksHigher per-token but more versatile
SDKazure-ai-textanalyticsazure-ai-projects / openai

Approach 1: Azure AI Language SDK

Sentiment analysis

from azure.ai.textanalytics import TextAnalyticsClient
from azure.core.credentials import AzureKeyCredential

client = TextAnalyticsClient(
    endpoint="https://your-language-resource.cognitiveservices.azure.com/",
    credential=AzureKeyCredential("your-key")
)

documents = [
    "The product is amazing! Best purchase I've ever made.",
    "Delivery was late and the packaging was damaged.",
    "I received my order on Tuesday."
]

result = client.analyze_sentiment(documents)
for doc in result:
    print(f"Sentiment: {doc.sentiment}, Scores: pos={doc.confidence_scores.positive:.2f}, neg={doc.confidence_scores.negative:.2f}")

Key phrase extraction

result = client.extract_key_phrases(documents)
for doc in result:
    print(f"Key phrases: {', '.join(doc.key_phrases)}")

Entity recognition

result = client.recognize_entities(documents)
for doc in result:
    for entity in doc.entities:
        print(f"  {entity.text} ({entity.category})")

Approach 2: Using GPT-4o for text analysis

response = chat.complete(
    model="gpt4o-deployment",
    messages=[
        {"role": "system", "content": "Analyse the following text. Return JSON with: sentiment (positive/negative/neutral), key_phrases (list), entities (list with name and type)."},
        {"role": "user", "content": "Dr. Sarah Chen from MediSpark reviewed the order placed on April 15th for $4,500 worth of medical supplies. She was very pleased with the quality."}
    ],
    temperature=0
)
πŸ’‘ When to use which approach

Use Azure AI Language when:

  • Processing large batches of text (thousands of documents)
  • You need consistent, structured JSON output
  • Cost per transaction matters
  • You need specific NLP features like opinion mining or PII detection

Use GPT-4o when:

  • You need flexible analysis combined with other tasks
  • The analysis requires understanding complex context
  • You want natural language explanations alongside the analysis
  • You’re already using GPT-4o for other features in the same app

🎬 Video walkthrough

🎬 Video coming soon

Building a Text Analysis App β€” AI-901 Module 17

Building a Text Analysis App β€” AI-901 Module 17

~14 min

Flashcards

Question

What Python package provides the Azure AI Language text analysis SDK?

Click or press Enter to reveal answer

Answer

azure-ai-textanalytics β€” provides TextAnalyticsClient with methods for sentiment analysis, entity recognition, key phrase extraction, and language detection.

Click to flip back

Question

What are the two approaches to building text analysis in Azure?

Click or press Enter to reveal answer

Answer

1) Azure AI Language SDK (dedicated NLP API, structured output, lower cost per transaction), or 2) GPT-4o via chat completions (flexible, natural language analysis, combined with other tasks).

Click to flip back

Question

What does the analyze_sentiment method return?

Click or press Enter to reveal answer

Answer

For each document: the overall sentiment (positive, negative, neutral, mixed) and confidence scores for each category (e.g., positive: 0.95, negative: 0.03, neutral: 0.02).

Click to flip back

Knowledge Check

Knowledge Check

DataFlow Corp processes 50,000 customer emails daily and needs to tag each with sentiment (positive/negative/neutral) in a consistent JSON format. Which approach is most appropriate?

Knowledge Check

MediSpark wants their app to read patient feedback, determine sentiment, extract the doctor's name and clinic location, and generate a personalised response. Which approach makes most sense?


Next up: Multimodal: Responding to Speech β€” using AI to respond to spoken prompts.

← Previous

Building an Agent Client App

Next β†’

Multimodal: Responding to Speech

Guided

I learn, I simplify, I share.

A Guide to Cloud YouTube Feedback

© 2026 Sutheesh. All rights reserved.

Guided is an independent study resource and is not affiliated with, endorsed by, or officially connected to Microsoft. Microsoft, Azure, and related trademarks are property of Microsoft Corporation. Always verify information against Microsoft Learn.