Learn how to implement Azure AI Language Service to detect and redact Personally Identifiable Information (PII) in Python applications. Protect sensitive data effortlessly!
Table of Contents
Question
Your organization, Nutex Inc., is developing a customer support chat application that allows customers to communicate with support agents. To protect sensitive information, you want to implement the Azure AI Language service in your application to detect and redact Personally Identifiable Information (PII) from customer messages. The service should automatically detect PII information, such as names, credit card numbers, and social security numbers, within the chat messages.
You are using Python to implement this functionality. The following code is partially completed. What is the correct function call to use to detect PII in the text?
from azure.ai.textanalytics import TextAnalyticsClient from azure.core.credentials import AzureKeyCredential endpoint = "myendpoint" key = "<your-key>" client = TextAnalyticsClient(endpoint=endpoint, credential=AzureKeyCredential(key)) documents = [ "My name is Wendy Callahan and my credit card number is 3388-1234-5678-9012." ] # Insert the appropriate function call to find any PII information response = client.MISSING(documents) for entity in response[0].entities: print(f"Entity: {entity.text}, Category: {entity.category}, Confidence Score: {entity.confidence_score}")
A. recognize_pii_entities
B. Analyze
C. PiiEntityRecognition
D. RecognizePiiEntities
Answer
A. recognize_pii_entities
Explanation
The recognize_pii_entities function in Python is specifically designed to detect Personally Identifiable Information (PII) in text using the Azure AI Language service. It analyzes the text to identify sensitive information such as names, credit card numbers, and social security numbers. This function is part of the Python SDK for Azure AI Language and is the correct method for the given task.
The Analyze function would not be used in the given scenario. The Analyze function can also be used to analyze text for PII, but it is used in JavaScript code, not Python.
The PiiEntityRecognition function would not be used in the given scenario. This function call is used in JSON code when making REST API requests to the Azure AI Language service. It serves the same purpose of detecting PII but is not used in Python code. It is more relevant for REST API-based implementations.
The RecognizePiiEntities function would not be used in the given scenario. This function is used in C# code to detect PII with the Azure AI Language service. It serves the same purpose as recognize_pii_entities in Python but is specific to the C# programming language.
Microsoft Azure AI Engineer Associate AI-102 certification exam practice question and answer (Q&A) dump with detail explanation and reference available free, helpful to pass the Microsoft Azure AI Engineer Associate AI-102 exam and earn Microsoft Azure AI Engineer Associate AI-102 certification.