Teach
This lesson introduces text analysis capabilities in Azure AI Foundry and when to use them in real solutions.
Start free lesson
- This is the free lesson for Module 5 (Foundry text and speech).
Text analysis capabilities in Foundry
- Sentiment analysis estimates whether text is positive, neutral, negative, or mixed.
- Key phrase extraction identifies important terms from longer text.
- Language detection predicts the primary language of input text.
- Text classification maps text to labels (for example support category or intent).
- Entity recognition identifies items such as people, organizations, locations, dates, and more.
Prebuilt language models vs custom models
- Use prebuilt models when your use case matches common NLP tasks and you want fast deployment.
- Use custom models when domain language, labels, or extraction targets are specific to your business.
- A common approach is starting prebuilt for baseline value, then moving to custom if quality gaps remain.
Typical REST and SDK call pattern
- Create the Foundry language resource and capture endpoint + key.
- Choose the task endpoint (for example sentiment, entities, or classification).
- Send one or more text documents in request payload.
- Parse per-document results and confidence scores.
- Log outcomes and monitor for drift or misclassification patterns.
Python-style pseudocode (concept)
endpoint = os.getenv("FOUNDRY_LANGUAGE_ENDPOINT")
api_key = os.getenv("FOUNDRY_LANGUAGE_KEY")
documents = [
{"id": "1", "text": "The support engineer resolved my issue quickly."},
{"id": "2", "text": "Delivery was late and the packaging was damaged."},
]
result = analyze_text(
endpoint=endpoint,
api_key=api_key,
task="sentiment",
documents=documents,
)
for doc in result["documents"]:
print(doc["id"], doc["sentiment"], doc["confidenceScores"])
Optional employer-lab checklist (text analysis)
- Test one sample for sentiment, key phrases, and language detection.
- Compare confidence scores across short vs long text inputs.
- Map entity output to a simple downstream workflow (for example ticket routing).
- Document where prebuilt output is sufficient and where custom training may help.
- Confirm secrets are stored outside source code.
Practice
Practice 1
Which Foundry feature is best for identifying positive, neutral, or negative tone in customer reviews?
Practice 2
What is the primary goal of key phrase extraction?
Practice 3
When should you usually start with a prebuilt language model in Foundry?
Practice 4
Which input would entity recognition most likely identify as a person and an organization?
Practice 5
In a typical REST or SDK workflow, which two items are required before sending analysis requests?