Text analysis and speech apps: AI-901 study notes and practice questions
What to know about Text analysis and speech apps for the AI-901 exam, from the Implement AI solutions by using Microsoft Foundry domain (58% of the exam guide), then 5 free questions to test it. Part of the AI-901 study guide.
Domain 1 asks what text analysis and speech can do. This topic asks how an app uses them. You find the services in the Foundry portal under Build, then Services, and each service page has a Code tab with a sample.
Text analysis in code
Install the azure-ai-textanalytics and azure-core packages. Create a TextAnalyticsClient with the resource endpoint (it looks like https://<resource>.cognitiveservices.azure.com/) and a credential, usually AzureKeyCredential(key). Storing the endpoint and key in environment variables, not in code, is the safe habit.
In the course lab, the app calls recognize_pii_entities(documents, language="en"). Each result item reports whether it is an error (is_error), the redacted_text, and a list of entities, each with its text, category, confidence score, offset and length. The pattern is the same for other features: send a list of documents, get back one result per document, and check for an error before using it.
Speech in apps
In the portal, an agent with Voice mode enabled can listen and speak using Azure Speech Voice Live. You pick a voice in the configuration pane, allow the microphone, and watch the status change between Listening and Speaking. A captions button shows the transcript, and Call agent shows client code.
Other ways to use Azure Speech are the Speech SDK, the Speech CLI, REST APIs (for example batch transcription) and containers.
How to choose
Scenario
Tool
Redact personal data in text
Azure Language PII detection
Spoken conversation with an agent
Voice mode and Voice Live
Transcribe many audio files
Batch transcription
Read text aloud
Text to speech
Common traps
Wrong credential. Language and Speech samples use a resource key. The agent client uses Microsoft Entra ID.
Ignoring errors. A document in the batch can fail while others succeed, which is why is_error exists.
Mixing up endpoints. The Language endpoint is not the Foundry project endpoint.
D. Wrong: PII detection finds and masks personal details in text. It leaves the comment in its original language, so the team could not read it.
Explanation
The input is written text and the output must be the same text in English, which is Azure Translator. Language detection only identifies the language, and speech translation works on audio. PII detection protects personal details but does not translate.
A grocery chain stores its customer support chat transcripts. Before analysts read them, the developer must print each transcript with card and phone numbers masked.
from azure.ai.textanalytics import TextAnalyticsClient
from azure.core.credentials import AzureKeyCredential
client = TextAnalyticsClient(endpoint=ENDPOINT, credential=AzureKeyCredential(KEY))
result = client.recognize_pii_entities(documents, language="en")
for doc in result:
print(doc.________)
Which attribute of each result should replace the blank?
Choose one answer.
AA. the entities attribute
BB. the redacted_text attribute
CC. the is_error attribute
DD. the confidence_score attribute
Show the answer and explanation
Answer: B
A. Wrong: entities lists each personal item found, with its category and position. It shows what was detected, but the masked text is a separate attribute.
B. Right: Correct. redacted_text holds the document's text with the detected personal information masked. It is the value the team needs to print before analysts read the transcripts. Learn more: What is Azure Language? (opens in a new tab)
C. Wrong: is_error reports whether processing failed for a document. It is a status flag, so printing it would not show a masked transcript.
D. Wrong: confidence_score gives how sure the service is about one detected item. It is a number attached to each entity, not the masked transcript.
Explanation
recognize_pii_entities returns a result for each document. Each result exposes redacted_text with the personal details masked, while entities, error status and confidence values serve other purposes.
A seaside resort receives guest voicemails at its front desk. The manager wants each message converted to text, so staff can search and read the messages during the day.
The voicemails are audio recordings, not typed text. Which Foundry Tool should the resort use to create the text?
Choose one answer.
AA. Azure Translator, which converts written text from one language into another
BB. Azure Speech text-to-speech, which turns written text into spoken audio
CC. Azure Speech speech-to-text, which turns recorded audio into written text
DD. Azure Language sentiment analysis, which rates whether written text is positive, negative or mixed
Show the answer and explanation
Answer: C
A. Wrong: Translator works on text that already exists, so it cannot create text from recordings. It would change the language of messages but not transcribe them.
B. Wrong: Text-to-speech runs in the opposite direction, from text to audio. It would make spoken replies, not written transcripts of guest messages.
D. Wrong: Sentiment analysis needs written text as input and scores its tone. The resort does not yet have the words, so this cannot create the transcripts.
Explanation
The resort has audio and needs text, so speech-to-text is the Foundry Tool to use. Text-to-speech, translation and sentiment analysis each start from written text, which the voicemails are not.
A primary-school reading app is being built on Foundry Tools. It must read each lesson aloud in a natural, child-friendly voice. It must also score how accurately a pupil pronounces each spoken word, so teachers can track progress.
Which two Azure Speech capabilities meet these requirements? (Choose two.)
Choose two answers.
AA. Speech-to-text real-time transcription, which writes down the words a pupil says
BB. Text-to-speech with a neural voice, which reads lesson text aloud naturally
CC. Azure Language key phrase extraction, which lists the main terms in each lesson
DD. Speech translation, which converts a pupil's spoken words into another language
EE. Pronunciation assessment, which scores how accurately each spoken word is said
Show the answer and explanation
Answers: B, E
A. Wrong: Real-time transcription writes down what a pupil says, but it does not judge how well each word is pronounced. Teachers would still lack the score they need.
C. Wrong: Key phrase extraction is a text analysis feature for written text. It does not read lessons aloud or score pronunciation.
D. Wrong: Speech translation changes spoken language into another language. The app needs pronunciation feedback in the same language, so this does not fit.
E. Right: Correct. Pronunciation assessment compares a pupil's spoken words with the expected pronunciation and returns scores. This covers the scoring requirement.
Explanation
Neural text-to-speech handles the reading requirement, and pronunciation assessment handles the scoring requirement. Transcription, translation and key phrase extraction each address a different need.
A concert ticketing company is adding voice and text features to its customer app. Its architects are matching each feature to a Foundry Tool.
Which of these statements about Azure Speech and Azure Language are true?
For each statement, choose Yes if the statement is true. Otherwise, choose No.
AA. Azure Language detects which language a typed customer message is written in.
BB. Azure Language analyzes the sound of a recorded call directly, without converting it to text first.
CC. Azure Speech can identify the language being spoken in a recorded customer call.
Show the answer and explanation
A. Yes. Yes. Language detection is an Azure Language feature that works on text, so it fits typed messages in any language the service supports.
B. No. No. Azure Language works on text. A recorded call must first be converted to text with Azure Speech before Azure Language can analyze its words.
C. Yes. Yes. Language identification is an Azure Speech capability that works on audio, so it can tell which language a caller speaks.
Explanation
Speech handles audio, and Language handles text. Language detection in Azure Language works on typed text, while language identification in Azure Speech works on spoken audio.
Want more on Text analysis and speech apps? The 5 full-length practice sets have 25 more Text analysis and speech apps questions, 225 in all, none of them in the free exam. One payment of $9.99 $6.99, no subscription. Get the practice sets →