Skip to content

Commit a7cfdff

Browse files
maririospaterasMSFT
authored andcommitted
Language API integration (#28535)
1 parent 3cb1c80 commit a7cfdff

File tree

735 files changed

+33029
-12967
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

735 files changed

+33029
-12967
lines changed

eng/.docsettings.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ known_content_issues:
120120
- ['sdk/extensions/Microsoft.Azure.WebJobs.Extensions.Clients/README.md','azure-sdk-tools/issues/404']
121121
- ['sdk/extensions/Microsoft.Extensions.Azure/README.md','azure-sdk-tools/issues/404']
122122
- ['sdk/storage/Azure.Storage.Common/README.md','azure-sdk-tools/issues/404']
123+
- ['sdk/textanalytics/Azure.AI.TextAnalytics.Legacy.Shared/README.md','https://github.com/Azure/azure-sdk-tools/issues/404']
123124
- ['sdk/webpubsub/Azure.Messaging.WebPubSub/README.md', 'azure-sdk-tools/issues/404 - requires different name for auth section']
124125

125126
- ['sdk/anomalydetector/Azure.AI.AnomalyDetector/README.md', '#25936: Needs Examples']
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.28803.308
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.AI.TextAnalytics.Legacy", "src\Azure.AI.TextAnalytics.Legacy.csproj", "{25CE0676-8F2C-497B-8FB5-7DA41A31F6F9}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{25CE0676-8F2C-497B-8FB5-7DA41A31F6F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{25CE0676-8F2C-497B-8FB5-7DA41A31F6F9}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{25CE0676-8F2C-497B-8FB5-7DA41A31F6F9}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{25CE0676-8F2C-497B-8FB5-7DA41A31F6F9}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {F99E1793-076D-4060-A0BD-71ED8FA9050D}
24+
EndGlobalSection
25+
EndGlobal
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Azure Cognitive Services Text Analytics code sharing library
2+
3+
This library is intended to serve as a common location for non-public code for the legacy REST API that is used by the [Azure Cognitive Services Text Analytics client library for .NET](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/textanalytics/Azure.AI.TextAnalytics). The Text Analytics library includes these artifacts by shared links to enable them to be loosely hosted within those projects rather than consumed by direct project or package reference.
4+
5+
## Contributing
6+
7+
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.
8+
9+
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
10+
11+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [[email protected]](mailto:[email protected]) with any additional questions or comments.
12+
13+
Please see our [contributing guide](https://github.com/Azure/azure-sdk-for-net/blob/main/CONTRIBUTING.md) for more information.
14+
15+
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-net%2Fsdk%textanalytics%2FAzure.AI.TextAnalytics.Legacy.Shared%2FREADME.png)
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<AssemblyTitle>Microsoft Azure.AI.TextAnalytics shared code library</AssemblyTitle>
4+
<Version>1.0.0</Version>
5+
<TargetFrameworks>$(RequiredTargetFrameworks)</TargetFrameworks>
6+
<IsShippingLibrary>false</IsShippingLibrary>
7+
<IsTestSupportProject>true</IsTestSupportProject>
8+
<ExcludeRecordingFramework>true</ExcludeRecordingFramework>
9+
<IncludeOperationsSharedSource>true</IncludeOperationsSharedSource>
10+
</PropertyGroup>
11+
12+
<!--
13+
Global Warning Suppressions:
14+
* AZC0012 - Single word class names are too generic for Entity.cs class
15+
-->
16+
<PropertyGroup>
17+
<NoWarn>$(NoWarn);3021;AZC0012</NoWarn>
18+
</PropertyGroup>
19+
20+
<!-- Include Azure.Core shared source needed to compile -->
21+
<ItemGroup>
22+
<Compile Include="$(AzureCoreSharedSources)AzureResourceProviderNamespaceAttribute.cs" LinkBase="Shared/Core" />
23+
<Compile Include="$(AzureCoreSharedSources)ArrayBufferWriter.cs" LinkBase="Shared/Core" />
24+
<Compile Include="$(AzureCoreSharedSources)HashCodeBuilder.cs" LinkBase="Shared/Core" />
25+
<Compile Include="$(AzureCoreSharedSources)PageResponseEnumerator.cs" LinkBase="Shared/Core" />
26+
<Compile Include="$(AzureCoreSharedSources)AzureKeyCredentialPolicy.cs" LinkBase="Shared/Core" />
27+
</ItemGroup>
28+
29+
<ItemGroup>
30+
<PackageReference Include="Azure.Core" />
31+
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" />
32+
<PackageReference Include="System.Text.Json" />
33+
</ItemGroup>
34+
35+
</Project>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
using Azure.Core;
5+
6+
namespace Azure.AI.TextAnalytics.Legacy.Models
7+
{
8+
/// <summary> Predicted sentiment for document (Negative, Neutral, Positive, or Mixed). </summary>
9+
[CodeGenModel("DocumentSentimentValue")]
10+
internal enum DocumentSentimentValue
11+
{
12+
/// <summary> positive. </summary>
13+
Positive,
14+
/// <summary> neutral. </summary>
15+
Neutral,
16+
/// <summary> negative. </summary>
17+
Negative,
18+
/// <summary> mixed. </summary>
19+
Mixed
20+
}
21+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
using System.Collections.Generic;
5+
using Azure.Core;
6+
7+
namespace Azure.AI.TextAnalytics.Legacy
8+
{
9+
/// <summary>
10+
/// JobManifestTasks.
11+
/// </summary>
12+
[CodeGenModel("JobManifestTasks")]
13+
internal partial class JobManifestTasks
14+
{
15+
/// <summary>
16+
/// EntityRecognitionTasks
17+
/// </summary>
18+
internal IList<EntitiesTask> EntityRecognitionTasks { get; set; }
19+
20+
/// <summary>
21+
/// EntityRecognitionPiiTasks
22+
/// </summary>
23+
internal IList<PiiTask> EntityRecognitionPiiTasks { get; set; }
24+
25+
/// <summary>
26+
/// KeyPhraseExtractionTasks
27+
/// </summary>
28+
internal IList<KeyPhrasesTask> KeyPhraseExtractionTasks { get; set; }
29+
30+
/// <summary>
31+
/// EntityLinkingTasks
32+
/// </summary>
33+
internal IList<EntityLinkingTask> EntityLinkingTasks { get; set; }
34+
35+
/// <summary>
36+
/// SentimentAnalysisTasks
37+
/// </summary>
38+
internal IList<SentimentAnalysisTask> SentimentAnalysisTasks { get; set; }
39+
40+
/// <summary>
41+
/// ExtractiveSummarizationTasks
42+
/// </summary>
43+
public IList<ExtractiveSummarizationTask> ExtractiveSummarizationTasks { get; set; }
44+
45+
/// <summary>
46+
/// CustomEntityRecognitionTasks
47+
/// </summary>
48+
internal IList<CustomEntitiesTask> CustomEntityRecognitionTasks { get; set; }
49+
50+
/// <summary>
51+
/// CustomSingleClassificationTasks
52+
/// </summary>
53+
internal IList<CustomSingleClassificationTask> CustomSingleClassificationTasks { get; set; }
54+
55+
/// <summary>
56+
/// CustomMultiClassificationTasks
57+
/// </summary>
58+
internal IList<CustomMultiClassificationTask> CustomMultiClassificationTasks { get; set; }
59+
}
60+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
using Azure.AI.TextAnalytics.Legacy.Models;
5+
6+
namespace Azure.AI.TextAnalytics.Legacy
7+
{
8+
/// <summary>
9+
/// A word or phrase identified as a Personally Identifiable Information
10+
/// that can be categorized as known type in a given taxonomy.
11+
/// The set of categories recognized by the Text Analytics service is described at
12+
/// <see href="https://aka.ms/tanerpii"/>.
13+
/// </summary>
14+
internal readonly struct PiiEntity
15+
{
16+
internal PiiEntity(Entity entity)
17+
{
18+
Category = entity.Category;
19+
Text = entity.Text;
20+
SubCategory = entity.Subcategory;
21+
ConfidenceScore = entity.ConfidenceScore;
22+
Offset = entity.Offset;
23+
Length = entity.Length;
24+
}
25+
26+
/// <summary>
27+
/// Gets the entity text as it appears in the input document.
28+
/// </summary>
29+
public string Text { get; }
30+
31+
/// <summary>
32+
/// Gets the PII entity category inferred by the Text Analytics service's
33+
/// named entity recognition model, such as Financial Account
34+
/// Identification/Social Security Number/Phone Number, etc.
35+
/// The list of available categories is described at
36+
/// <see href="https://aka.ms/tanerpii"/>.
37+
/// </summary>
38+
public PiiEntityLegacyCategory Category { get; }
39+
40+
/// <summary>
41+
/// Gets the sub category of the entity inferred by the Text Analytics service's
42+
/// named entity recognition model. This property may not have a value if
43+
/// a sub category doesn't exist for this entity. The list of available categories and
44+
/// subcategories is described at <see href="https://aka.ms/tanerpii"/>.
45+
/// </summary>
46+
public string SubCategory { get; }
47+
48+
/// <summary>
49+
/// Gets a score between 0 and 1, indicating the confidence that the
50+
/// text substring matches this inferred entity.
51+
/// </summary>
52+
public double ConfidenceScore { get; }
53+
54+
/// <summary>
55+
/// Gets the starting position for the matching text in the input document.
56+
/// </summary>
57+
public int Offset { get; }
58+
59+
/// <summary>
60+
/// Gets the length of the matching text in the input document.
61+
/// </summary>
62+
public int Length { get; }
63+
}
64+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
using System.Diagnostics.CodeAnalysis;
5+
6+
namespace Azure.AI.TextAnalytics.Legacy
7+
{
8+
/// <summary>
9+
/// The different domains of PII entities that users can filter requests by.
10+
/// </summary>
11+
internal enum PiiEntityDomain
12+
{
13+
/// <summary>
14+
/// Don't apply any domain filter. This is the default value.
15+
/// </summary>
16+
None,
17+
/// <summary>
18+
/// Protected Health Information entities.
19+
/// For more information see <see href="https://aka.ms/tanerpii"/>.
20+
/// </summary>
21+
ProtectedHealthInformation
22+
}
23+
24+
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1649:File name should match first type name", Justification = "Small extensions, good to keep here.")]
25+
internal static class PiiEntityDomainExtensions
26+
{
27+
internal static string GetString(this PiiEntityDomain type)
28+
{
29+
return type switch
30+
{
31+
PiiEntityDomain.None => null,
32+
PiiEntityDomain.ProtectedHealthInformation => "phi",
33+
_ => null,
34+
};
35+
}
36+
}
37+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
using System.Collections.Generic;
5+
using Azure.AI.TextAnalytics.Legacy.Models;
6+
using Azure.Core;
7+
8+
namespace Azure.AI.TextAnalytics.Legacy
9+
{
10+
/// <summary>
11+
/// PiiTaskParameters class.
12+
/// </summary>
13+
[CodeGenModel("PiiTaskParameters")]
14+
internal partial class PiiTaskParameters
15+
{
16+
/// <summary> (Optional) describes the PII categories to return. </summary>
17+
public IList<PiiEntityLegacyCategory> PiiCategories { get; set; }
18+
}
19+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
using Azure.Core;
5+
6+
namespace Azure.AI.TextAnalytics.Legacy.Models
7+
{
8+
/// <summary> The predicted Sentiment for the sentence. </summary>
9+
[CodeGenModel("SentenceSentimentValue")]
10+
internal enum SentenceSentimentValue
11+
{
12+
/// <summary> positive. </summary>
13+
Positive,
14+
/// <summary> neutral. </summary>
15+
Neutral,
16+
/// <summary> negative. </summary>
17+
Negative
18+
}
19+
}

0 commit comments

Comments
 (0)