Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Text Analytics] Expose StringIndextype for all endpoints #17968

Merged
merged 15 commits into from
Jan 16, 2021
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ public partial class EntitiesTaskParameters
/// <summary>
/// StringIndexType
/// </summary>
internal StringIndexType? StringIndexType { get; set; }
public StringIndexType? StringIndexType { get; set; }
}
}

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

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

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

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

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

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

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

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

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

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

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
Expand Up @@ -20,7 +20,7 @@ public partial class PiiTaskParameters
/// <summary>
/// StringIndexType
/// </summary>
internal StringIndexType? StringIndexType { get; set; }
public StringIndexType? StringIndexType { get; set; }
suhas92 marked this conversation as resolved.
Show resolved Hide resolved

/// <summary>
/// PiiTaskParametersDomain
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

using Azure.Core;

namespace Azure.AI.TextAnalytics.Models
namespace Azure.AI.TextAnalytics
{
[CodeGenModel("StringIndexType")]
internal partial struct StringIndexType
public partial struct StringIndexType
{
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using Azure.AI.TextAnalytics.Models;
suhas92 marked this conversation as resolved.
Show resolved Hide resolved

namespace Azure.AI.TextAnalytics
{
/// <summary>
Expand Down Expand Up @@ -40,5 +42,10 @@ internal TextAnalyticsRequestOptions(bool includeStatistics, string modelVersion
/// <a href="https://docs.microsoft.com/azure/cognitive-services/text-analytics/how-tos/text-analytics-how-to-sentiment-analysis#model-versioning"/>.
/// </summary>
public string ModelVersion { get; set; }

/// <summary>
/// StringIndexType
Copy link
Member Author

Choose a reason for hiding this comment

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

Update this.

/// </summary>
public StringIndexType? StringIndexType { get; set; }
Copy link
Member

Choose a reason for hiding this comment

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

So we need to keep a default value for the library, so user doesn't have to think about it.
I think it will be clearer for the user if they can see the default value of this parameter here.
Because it will always have a value, make it non-nullable

Copy link
Member

Choose a reason for hiding this comment

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

We definitely need to work on the name (it could be in another PR) as currently it is hard to understand what it means

Copy link
Member

Choose a reason for hiding this comment

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

could u open an issue for addressing the name?

Copy link
Member

Choose a reason for hiding this comment

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

Could u put the link here so we can have the reference?

}
}
2 changes: 1 addition & 1 deletion sdk/textanalytics/Azure.AI.TextAnalytics/src/autorest.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Run `dotnet build /t:GenerateCode` to generate code.

``` yaml
input-file:
- https://github.com/Azure/azure-rest-api-specs/blob/9b2689fe79302577b843f1cdf40f42330a67de08/specification/cognitiveservices/data-plane/TextAnalytics/preview/v3.1-preview.3/TextAnalytics.json
- https://github.com/Azure/azure-rest-api-specs/blob/a5dcb30f776c3f07e937912a9a163b2ec2bbbef8/specification/cognitiveservices/data-plane/TextAnalytics/preview/v3.1-preview.3/TextAnalytics.json
```

### Make generated models internal by default
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,23 @@ public async Task AnalyzeSentimentBatchConvenienceWithStatisticsTest()
Assert.IsNotNull(results.Statistics.InvalidDocumentCount);
}

[Test]
public async Task AnalyzeSentimentBatchConvenienceWithStringIndexTypeTest()
suhas92 marked this conversation as resolved.
Show resolved Hide resolved
{
TextAnalyticsClient client = GetClient();
var documents = batchConvenienceDocuments;

AnalyzeSentimentResultCollection results = await client.AnalyzeSentimentBatchAsync(documents, options: new AnalyzeSentimentOptions() { StringIndexType = StringIndexType.UnicodeCodePoint });

foreach (AnalyzeSentimentResult docs in results)
{
CheckAnalyzeSentimentProperties(docs.DocumentSentiment);
}

Assert.AreEqual("Positive", results[0].DocumentSentiment.Sentiment.ToString());
Assert.AreEqual("Negative", results[1].DocumentSentiment.Sentiment.ToString());
}

[Test]
public async Task AnalyzeSentimentBatchConvenienceWithStatisticsAndCancellationTest()
{
Expand Down
Loading