Share via


DeidentificationClient.Deidentify Method

Definition

Overloads

Deidentify(RequestContent, RequestContext)

[Protocol Method] De-identify text.

Deidentify(DeidentificationContent, CancellationToken)

De-identify text.

Deidentify(RequestContent, RequestContext)

Source:
DeidentificationClient.cs

[Protocol Method] De-identify text.

public virtual Azure.Response Deidentify (Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member Deidentify : Azure.Core.RequestContent * Azure.RequestContext -> Azure.Response
override this.Deidentify : Azure.Core.RequestContent * Azure.RequestContext -> Azure.Response
Public Overridable Function Deidentify (content As RequestContent, Optional context As RequestContext = Nothing) As Response

Parameters

content
RequestContent

The content to send as the body of the request.

context
RequestContext

The request context, which can override default behaviors of the client pipeline on a per-call basis.

Returns

The response returned from the service.

Exceptions

content is null.

Service returned a non-success status code.

Examples

This sample shows how to call Deidentify and parse the result.

Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
DeidentificationClient client = new DeidentificationClient(endpoint, credential);

using RequestContent content = RequestContent.Create(new
{
    inputText = "<inputText>",
});
Response response = client.Deidentify(content);

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.ToString());

This sample shows how to call Deidentify with all request content and parse the result.

Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
DeidentificationClient client = new DeidentificationClient(endpoint, credential);

using RequestContent content = RequestContent.Create(new
{
    inputText = "<inputText>",
    operation = "Redact",
    dataType = "Plaintext",
    redactionFormat = "<redactionFormat>",
});
Response response = client.Deidentify(content);

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("outputText").ToString());
Console.WriteLine(result.GetProperty("taggerResult").GetProperty("entities")[0].GetProperty("category").ToString());
Console.WriteLine(result.GetProperty("taggerResult").GetProperty("entities")[0].GetProperty("offset").GetProperty("utf8").ToString());
Console.WriteLine(result.GetProperty("taggerResult").GetProperty("entities")[0].GetProperty("offset").GetProperty("utf16").ToString());
Console.WriteLine(result.GetProperty("taggerResult").GetProperty("entities")[0].GetProperty("offset").GetProperty("codePoint").ToString());
Console.WriteLine(result.GetProperty("taggerResult").GetProperty("entities")[0].GetProperty("length").GetProperty("utf8").ToString());
Console.WriteLine(result.GetProperty("taggerResult").GetProperty("entities")[0].GetProperty("length").GetProperty("utf16").ToString());
Console.WriteLine(result.GetProperty("taggerResult").GetProperty("entities")[0].GetProperty("length").GetProperty("codePoint").ToString());
Console.WriteLine(result.GetProperty("taggerResult").GetProperty("entities")[0].GetProperty("text").ToString());
Console.WriteLine(result.GetProperty("taggerResult").GetProperty("entities")[0].GetProperty("confidenceScore").ToString());
Console.WriteLine(result.GetProperty("taggerResult").GetProperty("path").ToString());
Console.WriteLine(result.GetProperty("taggerResult").GetProperty("etag").ToString());

Applies to

Deidentify(DeidentificationContent, CancellationToken)

Source:
DeidentificationClient.cs

De-identify text.

public virtual Azure.Response<Azure.Health.Deidentification.DeidentificationResult> Deidentify (Azure.Health.Deidentification.DeidentificationContent body, System.Threading.CancellationToken cancellationToken = default);
abstract member Deidentify : Azure.Health.Deidentification.DeidentificationContent * System.Threading.CancellationToken -> Azure.Response<Azure.Health.Deidentification.DeidentificationResult>
override this.Deidentify : Azure.Health.Deidentification.DeidentificationContent * System.Threading.CancellationToken -> Azure.Response<Azure.Health.Deidentification.DeidentificationResult>
Public Overridable Function Deidentify (body As DeidentificationContent, Optional cancellationToken As CancellationToken = Nothing) As Response(Of DeidentificationResult)

Parameters

body
DeidentificationContent

Request body for de-identification operation.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

body is null.

Examples

This sample shows how to call Deidentify.

Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
DeidentificationClient client = new DeidentificationClient(endpoint, credential);

DeidentificationContent body = new DeidentificationContent("<inputText>");
Response<DeidentificationResult> response = client.Deidentify(body);

This sample shows how to call Deidentify with all parameters.

Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
DeidentificationClient client = new DeidentificationClient(endpoint, credential);

DeidentificationContent body = new DeidentificationContent("<inputText>")
{
    Operation = OperationType.Redact,
    DataType = DocumentDataType.Plaintext,
    RedactionFormat = "<redactionFormat>",
};
Response<DeidentificationResult> response = client.Deidentify(body);

Remarks

A remote procedure call (RPC) operation.

Applies to