QuestionQ112

Implement information extraction solutions

You have a Python application that redacts sensitive information before sending prompt text to a language model. The application contains the following code:

Question Image

For each of the following statements, select Yes if the statement is true. Otherwise, select No.

Yes or No
StatementsYesNo
For sample_text, audit will include entity records for Contact and SSN.
For sample_text, text_for_model will include john.doe@contoso.com and 859-98-0987.
For sample_text, text_for_model will contain entity type masks for John Doe and 312-555-1234.
Explanation

The piiCategories parameter in the Azure AI Language PII detection request limits which entity categories are detected and returned by the service — here only "Person" and "PhoneNumber". Entities outside those categories, such as Social Security Numbers or email addresses, are not detected at all, so they never appear in doc["entities"] (meaning audit won't include SSN records, and 'Contact' isn't a PII entity to begin with) and they are never redacted in redactedText (so the email and SSN remain visible in text_for_model). Conversely, detected entities within the specified categories — the person name 'John Doe' and phone number '312-555-1234' — are redacted according to the entityMask redactionPolicy, which replaces the entity text with a token denoting its entity type (e.g., [PERSON_1], [PHONENUMBER_1]) in the redactedText output.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!