Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sdk/textanalytics/Azure.AI.TextAnalytics/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- Added value `None` to enum `PiiEntityDomainType` to allow user to specify no domain.
- Added property `ActionName` to all `xxActions` input types so user can specify a name per action. If not provided, service will generate a name.
- Added property `ActionName` to all `xxActionResult` output types that displays the name of each action.
- The parameter `CategoriesFilter` in `RecognizePiiEntitiesActions` has been enabled for `StartAnalyzeActions` methods.

### Breaking changes
- Renamed `StartAnalyzeBatchActions` to `StartAnalyzeActions`.
Expand Down
1 change: 0 additions & 1 deletion sdk/textanalytics/Azure.AI.TextAnalytics/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,6 @@ This functionality allows running multiple actions in one or more documents. Act

### Known Issues
- `StartAnalyzeHealthcareEntities` is in gated preview and can not be used with AAD credentials. For more information, see [the Text Analytics for Health documentation](https://docs.microsoft.com/azure/cognitive-services/text-analytics/how-tos/text-analytics-for-health?tabs=ner#request-access-to-the-public-preview).
- The parameter `CategoriesFilter` in `RecognizePiiEntitiesOptions` is currently not working when used in `StartAnalyzeBatchActions`. [19237](https://github.com/Azure/azure-sdk-for-net/issues/19237).
- At time of this SDK release, the `ModelVersion` option to `StartAnalyzeHealthcareEntities` is ignored by the service. The service always processes the operation using the `latest` model.

## Troubleshooting
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System.Collections.Generic;
using Azure.Core;

namespace Azure.AI.TextAnalytics.Models
Expand All @@ -9,5 +10,9 @@ namespace Azure.AI.TextAnalytics.Models
/// PiiTaskParameters class.
/// </summary>
[CodeGenModel("PiiTaskParameters")]
internal partial class PiiTaskParameters { }
internal partial class PiiTaskParameters
{
/// <summary> (Optional) describes the PII categories to return. </summary>
public IList<PiiEntityCategory> PiiCategories { get; set; }
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is an internal type that I am making settable so it is easier to use

}
}
4 changes: 2 additions & 2 deletions sdk/textanalytics/Azure.AI.TextAnalytics/src/Transforms.cs
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,8 @@ internal static PiiTask ConvertToPiiTask(RecognizePiiEntitiesAction action)
Domain = action.DomainFilter.GetString() ?? (PiiTaskParametersDomain?)null,
ModelVersion = action.ModelVersion,
StringIndexType = Constants.DefaultStringIndexType,
LoggingOptOut = action.DisableServiceLogs
// Categories are not enabled because of https://github.com/Azure/azure-sdk-for-net/issues/19237
LoggingOptOut = action.DisableServiceLogs,
PiiCategories = action.CategoriesFilter
},
TaskName = action.ActionName
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,42 @@ public async Task AnalyzeOperationWithPHIDomain()
Assert.AreEqual(2, piiDocumentsResults[0].Entities.Count);
}

[RecordedTest]
public async Task AnalyzeOperationWithPiiCategories()
{
TextAnalyticsClient client = GetClient();

var documents = new List<string>
{
"A developer with SSN 859-98-0987 whose phone number is 800-102-1100 is building tools with our APIs. They work at Microsoft.",
};

TextAnalyticsActions batchActions = new TextAnalyticsActions()
{
RecognizePiiEntitiesActions = new List<RecognizePiiEntitiesAction>() { new RecognizePiiEntitiesAction() { CategoriesFilter = { PiiEntityCategory.USSocialSecurityNumber } } },
};

AnalyzeActionsOperation operation = await client.StartAnalyzeActionsAsync(documents, batchActions, "en");

await operation.WaitForCompletionAsync();

//Take the first page
AnalyzeActionsResult resultCollection = operation.Value.ToEnumerableAsync().Result.FirstOrDefault();

IReadOnlyCollection<RecognizePiiEntitiesActionResult> piiActionsResults = resultCollection.RecognizePiiEntitiesResults;

Assert.IsNotNull(piiActionsResults);

RecognizePiiEntitiesResultCollection piiDocumentsResults = piiActionsResults.FirstOrDefault().DocumentsResults;
Assert.AreEqual(1, piiDocumentsResults.Count);

Assert.IsNotEmpty(piiDocumentsResults[0].Entities.RedactedText);

Assert.IsFalse(piiDocumentsResults[0].HasError);
Assert.AreEqual(1, piiDocumentsResults[0].Entities.Count);
Assert.AreEqual(PiiEntityCategory.USSocialSecurityNumber, piiDocumentsResults[0].Entities.FirstOrDefault().Category);
}

[RecordedTest]
public async Task AnalyzeOperationWithStatisticsTest()
{
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading