diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language.Tests/ApiKeyServiceClientCredentials.cs b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language.Tests/ApiKeyServiceClientCredentials.cs
new file mode 100644
index 000000000000..2a44f8ff70ad
--- /dev/null
+++ b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language.Tests/ApiKeyServiceClientCredentials.cs
@@ -0,0 +1,43 @@
+namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics
+{
+ using System;
+ using System.Net.Http;
+ using System.Threading;
+ using System.Threading.Tasks;
+ using Microsoft.Rest;
+
+ ///
+ /// Allows authentication to the API using a basic apiKey mechanism
+ ///
+ public class ApiKeyServiceClientCredentials : ServiceClientCredentials
+ {
+ private readonly string subscriptionKey;
+
+ ///
+ /// Creates a new instance of the ApiKeyServiceClientCredentails class
+ ///
+ /// The subscription key to authenticate and authorize as
+ public ApiKeyServiceClientCredentials(string subscriptionKey)
+ {
+ if (string.IsNullOrWhiteSpace(subscriptionKey))
+ throw new ArgumentNullException("subscriptionKey");
+
+ this.subscriptionKey = subscriptionKey;
+ }
+
+ ///
+ /// Add the Basic Authentication Header to each outgoing request
+ ///
+ /// The outgoing request
+ /// A token to cancel the operation
+ public override Task ProcessHttpRequestAsync(HttpRequestMessage request, CancellationToken cancellationToken)
+ {
+ if (request == null)
+ throw new ArgumentNullException("request");
+
+ request.Headers.Add("Ocp-Apim-Subscription-Key", this.subscriptionKey);
+
+ return Task.FromResult(null);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language.Tests/BaseTests.cs b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language.Tests/BaseTests.cs
index fa3d64b5aa7d..9bbb0bef98b8 100644
--- a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language.Tests/BaseTests.cs
+++ b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language.Tests/BaseTests.cs
@@ -1,4 +1,5 @@
using Microsoft.Azure.CognitiveServices.Language.TextAnalytics;
+using Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models;
using System.Net.Http;
namespace Language.Tests
@@ -6,23 +7,14 @@ namespace Language.Tests
public abstract class BaseTests
{
public static bool IsTestTenant = false;
- private static string SubscriptionKey = "";
- private static string Region = null;
-
- static BaseTests()
- {
- // Retrieve the configuration information.
-
- Region = "WestUS";
- }
+ private static string SubscriptionKey = "000";
protected ITextAnalyticsAPI GetClient(DelegatingHandler handler)
{
- ITextAnalyticsAPI client;
- client = new TextAnalyticsAPI(handlers: handler);
- client.SubscriptionKey = SubscriptionKey;
-
- return client;
+ return new TextAnalyticsAPI(new ApiKeyServiceClientCredentials(SubscriptionKey), handlers: handler)
+ {
+ AzureRegion = AzureRegions.Westus
+ };
}
}
}
diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language.Tests/SessionRecords/Language.TextAnalytics.Tests.DetectLanguageTests/DetectLanguage.json b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language.Tests/SessionRecords/Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Tests.DetectLanguageTests/DetectLanguage.json
similarity index 100%
rename from src/SDKs/CognitiveServices/dataPlane/Language/Language/Language.Tests/SessionRecords/Language.TextAnalytics.Tests.DetectLanguageTests/DetectLanguage.json
rename to src/SDKs/CognitiveServices/dataPlane/Language/Language/Language.Tests/SessionRecords/Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Tests.DetectLanguageTests/DetectLanguage.json
diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language.Tests/SessionRecords/Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Tests.EntitiesTests/Entities.json b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language.Tests/SessionRecords/Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Tests.EntitiesTests/Entities.json
new file mode 100644
index 000000000000..6708cf4ff54c
--- /dev/null
+++ b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language.Tests/SessionRecords/Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Tests.EntitiesTests/Entities.json
@@ -0,0 +1,55 @@
+{
+ "Entries": [
+ {
+ "RequestUri": "/text/analytics/v2.0/entities",
+ "EncodedRequestUri": "L3RleHQvYW5hbHl0aWNzL3YyLjAvZW50aXRpZXM=",
+ "RequestMethod": "POST",
+ "RequestBody": "{\r\n \"documents\": [\r\n {\r\n \"language\": \"en\",\r\n \"id\": \"id\",\r\n \"text\": \"Microsoft released Windows 10\"\r\n }\r\n ]\r\n}",
+ "RequestHeaders": {
+ "Content-Type": [
+ "application/json; charset=utf-8"
+ ],
+ "Content-Length": [
+ "123"
+ ],
+ "Ocp-Apim-Subscription-Key": [
+ ""
+ ],
+ "User-Agent": [
+ "FxVersion/4.6.25211.01",
+ "Microsoft.CognitiveServices.Language.TextAnalytics.TextAnalyticsAPI/1.0.0"
+ ]
+ },
+ "ResponseBody": "{ \"documents\": [{\"id\": \"1\", \"entities\": [ { \"name\": \"Windows 10\", \"matches\": [ { \"text\": \"Windows 10\", \"offset\": 19, \"length\": 10 } ], \"wikipediaLanguage\": \"en\", \"wikipediaId\": \"Windows 10\", \"wikipediaUrl\": \"https://en.wikipedia.org/wiki/Windows_10\", \"bingId\": \"5f9fbd03-49c4-39ef-cc95-de83ab897b94\" }, { \"name\": \"Microsoft\", \"matches\": [ { \"text\": \"Microsoft\", \"offset\": 0, \"length\": 9 } ], \"wikipediaLanguage\": \"en\", \"wikipediaId\": \"Microsoft\", \"wikipediaUrl\": \"https://en.wikipedia.org/wiki/Microsoft\", \"bingId\": \"a093e9b9-90f5-a3d5-c4b8-5855e1b01f85\" } ] }\r\n ],\r\n \"errors\": []\r\n}",
+ "ResponseHeaders": {
+ "Content-Type": [
+ "application/json; charset=utf-8"
+ ],
+ "Date": [
+ "Wed, 30 Aug 2017 02:11:17 GMT"
+ ],
+ "Transfer-Encoding": [
+ "chunked"
+ ],
+ "x-ms-transaction-count": [
+ "1"
+ ],
+ "x-aml-ta-request-id": [
+ "460baaca-7f57-42c1-8cc7-8852957d05b9"
+ ],
+ "X-Content-Type-Options": [
+ "nosniff"
+ ],
+ "apim-request-id": [
+ "3f09b1c9-fe3b-46bb-badf-98108c599825"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains; preload"
+ ]
+ },
+ "StatusCode": 200
+ }
+ ],
+ "Names": {},
+ "Variables": {}
+}
\ No newline at end of file
diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language.Tests/SessionRecords/Language.TextAnalytics.Tests.KeyPhrasesTests/KeyPhrases.json b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language.Tests/SessionRecords/Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Tests.KeyPhrasesTests/KeyPhrases.json
similarity index 100%
rename from src/SDKs/CognitiveServices/dataPlane/Language/Language/Language.Tests/SessionRecords/Language.TextAnalytics.Tests.KeyPhrasesTests/KeyPhrases.json
rename to src/SDKs/CognitiveServices/dataPlane/Language/Language/Language.Tests/SessionRecords/Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Tests.KeyPhrasesTests/KeyPhrases.json
diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language.Tests/SessionRecords/Language.TextAnalytics.Tests.SentimentTests/Sentiment.json b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language.Tests/SessionRecords/Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Tests.SentimentTests/Sentiment.json
similarity index 100%
rename from src/SDKs/CognitiveServices/dataPlane/Language/Language/Language.Tests/SessionRecords/Language.TextAnalytics.Tests.SentimentTests/Sentiment.json
rename to src/SDKs/CognitiveServices/dataPlane/Language/Language/Language.Tests/SessionRecords/Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Tests.SentimentTests/Sentiment.json
diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language.Tests/TextAnalytics/DetectLanguageTests.cs b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language.Tests/TextAnalytics/DetectLanguageTests.cs
index 735f2f078d33..de923de69697 100644
--- a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language.Tests/TextAnalytics/DetectLanguageTests.cs
+++ b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language.Tests/TextAnalytics/DetectLanguageTests.cs
@@ -1,23 +1,26 @@
using Language.Tests;
-using Microsoft.Azure.Test.HttpRecorder;
-using Microsoft.Azure.CognitiveServices.Language.TextAnalytics;
+
using Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models;
+using Microsoft.Azure.Test.HttpRecorder;
using Microsoft.Rest.ClientRuntime.Azure.TestFramework;
+
using System.Collections.Generic;
+using System.Threading.Tasks;
+
using Xunit;
-namespace Language.TextAnalytics.Tests
+namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Tests
{
public class DetectLanguageTests : BaseTests
{
[Fact]
- public void DetectLanguage()
+ public async Task DetectLanguage()
{
using (MockContext context = MockContext.Start(this.GetType().FullName))
{
HttpMockServer.Initialize(this.GetType().FullName, "DetectLanguage");
ITextAnalyticsAPI client = GetClient(HttpMockServer.CreateInstance());
- LanguageBatchResult result = client.DetectLanguage(
+ LanguageBatchResult result = await client.DetectLanguageAsync(
new BatchInput(
new List ()
{
diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language.Tests/TextAnalytics/EntitiesTests.cs b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language.Tests/TextAnalytics/EntitiesTests.cs
new file mode 100644
index 000000000000..c9fc4da20d57
--- /dev/null
+++ b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language.Tests/TextAnalytics/EntitiesTests.cs
@@ -0,0 +1,38 @@
+using Language.Tests;
+using Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models;
+using Microsoft.Azure.Test.HttpRecorder;
+using Microsoft.Rest.ClientRuntime.Azure.TestFramework;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Tests
+{
+ public class EntitiesTests : BaseTests
+ {
+ [Fact]
+ public async Task Entities()
+ {
+ using (MockContext context = MockContext.Start(this.GetType().FullName))
+ {
+ HttpMockServer.Initialize(this.GetType().FullName, "Entities");
+ ITextAnalyticsAPI client = GetClient(HttpMockServer.CreateInstance());
+ EntitiesBatchResult result = await client.EntitiesAsync(
+ new MultiLanguageBatchInput(
+ new List()
+ {
+ new MultiLanguageInput()
+ {
+ Id ="id",
+ Text ="Microsoft released Windows 10",
+ Language ="en"
+ }
+ }));
+
+ Assert.Equal("Windows 10", result.Documents[0].Entities[0].Name);
+ Assert.Equal("5f9fbd03-49c4-39ef-cc95-de83ab897b94", result.Documents[0].Entities[0].BingId);
+ context.Stop();
+ }
+ }
+ }
+}
diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language.Tests/TextAnalytics/KeyPhrasesTests.cs b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language.Tests/TextAnalytics/KeyPhrasesTests.cs
index 1b8262c53339..1c948c05c5f4 100644
--- a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language.Tests/TextAnalytics/KeyPhrasesTests.cs
+++ b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language.Tests/TextAnalytics/KeyPhrasesTests.cs
@@ -1,23 +1,26 @@
using Language.Tests;
-using Microsoft.Azure.Test.HttpRecorder;
-using Microsoft.Azure.CognitiveServices.Language.TextAnalytics;
+
using Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models;
+using Microsoft.Azure.Test.HttpRecorder;
using Microsoft.Rest.ClientRuntime.Azure.TestFramework;
+
using System.Collections.Generic;
+using System.Threading.Tasks;
+
using Xunit;
-namespace Language.TextAnalytics.Tests
+namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Tests
{
public class KeyPhrasesTests : BaseTests
{
[Fact]
- public void KeyPhrases()
+ public async Task KeyPhrases()
{
using (MockContext context = MockContext.Start(this.GetType().FullName))
{
HttpMockServer.Initialize(this.GetType().FullName, "KeyPhrases");
ITextAnalyticsAPI client = GetClient(HttpMockServer.CreateInstance());
- KeyPhraseBatchResult result = client.KeyPhrases(
+ KeyPhraseBatchResult result = await client.KeyPhrasesAsync(
new MultiLanguageBatchInput(
new List()
{
diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language.Tests/TextAnalytics/SentimentTests.cs b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language.Tests/TextAnalytics/SentimentTests.cs
index eef53cec1e36..b417373bd29c 100644
--- a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language.Tests/TextAnalytics/SentimentTests.cs
+++ b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language.Tests/TextAnalytics/SentimentTests.cs
@@ -1,23 +1,26 @@
using Language.Tests;
-using Microsoft.Azure.Test.HttpRecorder;
-using Microsoft.Azure.CognitiveServices.Language.TextAnalytics;
+
using Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models;
+using Microsoft.Azure.Test.HttpRecorder;
using Microsoft.Rest.ClientRuntime.Azure.TestFramework;
+
using System.Collections.Generic;
+using System.Threading.Tasks;
+
using Xunit;
-namespace Language.TextAnalytics.Tests
+namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Tests
{
public class SentimentTests : BaseTests
{
[Fact]
- public void Sentiment()
+ public async Task Sentiment()
{
using (MockContext context = MockContext.Start(this.GetType().FullName))
{
HttpMockServer.Initialize(this.GetType().FullName, "Sentiment");
ITextAnalyticsAPI client = GetClient(HttpMockServer.CreateInstance());
- SentimentBatchResult result = client.Sentiment(
+ SentimentBatchResult result = await client.SentimentAsync(
new MultiLanguageBatchInput(
new List()
{
diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/ITextAnalyticsAPI.cs b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/ITextAnalyticsAPI.cs
index 6648940f1b61..67f9edbe15f8 100644
--- a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/ITextAnalyticsAPI.cs
+++ b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/ITextAnalyticsAPI.cs
@@ -1,3 +1,4 @@
+//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
@@ -5,12 +6,10 @@
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
+//
namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics
{
- using Microsoft.Azure;
- using Microsoft.Azure.CognitiveServices;
- using Microsoft.Azure.CognitiveServices.Language;
using Microsoft.Rest;
using Models;
using Newtonsoft.Json;
@@ -45,26 +44,27 @@ public partial interface ITextAnalyticsAPI : System.IDisposable
///
JsonSerializerSettings DeserializationSettings { get; }
- ///
- /// Subscription key in header
- ///
- string SubscriptionKey { get; set; }
-
///
/// Supported Azure regions for Cognitive Services endpoints. Possible
/// values include: 'westus', 'westeurope', 'southeastasia', 'eastus2',
- /// 'westcentralus'
+ /// 'westcentralus', 'westus2', 'eastus', 'southcentralus',
+ /// 'northeurope', 'eastasia', 'australiaeast', 'brazilsouth'
///
AzureRegions AzureRegion { get; set; }
+ ///
+ /// Subscription credentials which uniquely identify client
+ /// subscription.
+ ///
+ ServiceClientCredentials Credentials { get; }
+
///
/// The API returns a list of strings denoting the key talking points
/// in the input text.
///
///
- /// We employ techniques from Microsoft Office's sophisticated Natural
- /// Language Processing toolkit. See the <a
+ /// See the <a
/// href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text
/// Analytics Documentation</a> for details about the languages
/// that are supported by key phrase extraction.
@@ -92,28 +92,21 @@ public partial interface ITextAnalyticsAPI : System.IDisposable
///
/// Collection of documents to analyze.
///
- ///
- /// (Optional. Deprecated) Number of languages to detect. Set to 1 by
- /// default. Irrespective of the value, the language with the highest
- /// score is returned.
- ///
///
/// The headers that will be added to request.
///
///
/// The cancellation token.
///
- Task> DetectLanguageWithHttpMessagesAsync(BatchInput input, int? numberOfLanguagesToDetect = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ Task> DetectLanguageWithHttpMessagesAsync(BatchInput input, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
///
/// The API returns a numeric score between 0 and 1.
///
///
/// Scores close to 1 indicate positive sentiment, while scores close
- /// to 0 indicate negative sentiment. Sentiment score is generated
- /// using classification techniques. The input features to the
- /// classifier include n-grams, features generated from part-of-speech
- /// tags, and word embeddings. See the <a
+ /// to 0 indicate negative sentiment. A score of 0.5 indicates the lack
+ /// of sentiment (e.g. a factoid statement). See the <a
/// href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text
/// Analytics Documentation</a> for details about the languages
/// that are supported by sentiment analysis.
@@ -129,5 +122,27 @@ public partial interface ITextAnalyticsAPI : System.IDisposable
///
Task> SentimentWithHttpMessagesAsync(MultiLanguageBatchInput input, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// The API returns a list of recognized entities in a given document.
+ ///
+ ///
+ /// To get even more information on each recognized entity we recommend
+ /// using the Bing Entity Search API by querying for the recognized
+ /// entities names. See the <a
+ /// href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/text-analytics-supported-languages">Supported
+ /// languages in Text Analytics API</a> for the list of enabled
+ /// languages.
+ ///
+ ///
+ /// Collection of documents to analyze.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ Task> EntitiesWithHttpMessagesAsync(MultiLanguageBatchInput input, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+
}
}
diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/AzureRegions.cs b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/AzureRegions.cs
index 2d2670016792..467a08987334 100644
--- a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/AzureRegions.cs
+++ b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/AzureRegions.cs
@@ -1,3 +1,4 @@
+//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
@@ -5,13 +6,10 @@
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
+//
namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models
{
- using Microsoft.Azure;
- using Microsoft.Azure.CognitiveServices;
- using Microsoft.Azure.CognitiveServices.Language;
- using Microsoft.Azure.CognitiveServices.Language.TextAnalytics;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.Runtime;
@@ -32,12 +30,28 @@ public enum AzureRegions
[EnumMember(Value = "eastus2")]
Eastus2,
[EnumMember(Value = "westcentralus")]
- Westcentralus
+ Westcentralus,
+ [EnumMember(Value = "westus2")]
+ Westus2,
+ [EnumMember(Value = "eastus")]
+ Eastus,
+ [EnumMember(Value = "southcentralus")]
+ Southcentralus,
+ [EnumMember(Value = "northeurope")]
+ Northeurope,
+ [EnumMember(Value = "eastasia")]
+ Eastasia,
+ [EnumMember(Value = "australiaeast")]
+ Australiaeast,
+ [EnumMember(Value = "brazilsouth")]
+ Brazilsouth
}
internal static class AzureRegionsEnumExtension
{
- internal static string ToSerializedValue(this AzureRegions? value) =>
- value == null ? null : ((AzureRegions)value).ToSerializedValue();
+ internal static string ToSerializedValue(this AzureRegions? value)
+ {
+ return value == null ? null : ((AzureRegions)value).ToSerializedValue();
+ }
internal static string ToSerializedValue(this AzureRegions value)
{
@@ -53,6 +67,20 @@ internal static string ToSerializedValue(this AzureRegions value)
return "eastus2";
case AzureRegions.Westcentralus:
return "westcentralus";
+ case AzureRegions.Westus2:
+ return "westus2";
+ case AzureRegions.Eastus:
+ return "eastus";
+ case AzureRegions.Southcentralus:
+ return "southcentralus";
+ case AzureRegions.Northeurope:
+ return "northeurope";
+ case AzureRegions.Eastasia:
+ return "eastasia";
+ case AzureRegions.Australiaeast:
+ return "australiaeast";
+ case AzureRegions.Brazilsouth:
+ return "brazilsouth";
}
return null;
}
@@ -71,6 +99,20 @@ internal static string ToSerializedValue(this AzureRegions value)
return AzureRegions.Eastus2;
case "westcentralus":
return AzureRegions.Westcentralus;
+ case "westus2":
+ return AzureRegions.Westus2;
+ case "eastus":
+ return AzureRegions.Eastus;
+ case "southcentralus":
+ return AzureRegions.Southcentralus;
+ case "northeurope":
+ return AzureRegions.Northeurope;
+ case "eastasia":
+ return AzureRegions.Eastasia;
+ case "australiaeast":
+ return AzureRegions.Australiaeast;
+ case "brazilsouth":
+ return AzureRegions.Brazilsouth;
}
return null;
}
diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/BatchInput.cs b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/BatchInput.cs
index efdc53e3a6be..3b099904d68a 100644
--- a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/BatchInput.cs
+++ b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/BatchInput.cs
@@ -1,3 +1,4 @@
+//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
@@ -5,13 +6,10 @@
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
+//
namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models
{
- using Microsoft.Azure;
- using Microsoft.Azure.CognitiveServices;
- using Microsoft.Azure.CognitiveServices.Language;
- using Microsoft.Azure.CognitiveServices.Language.TextAnalytics;
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
@@ -24,7 +22,7 @@ public partial class BatchInput
///
public BatchInput()
{
- CustomInit();
+ CustomInit();
}
///
diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/DetectedLanguage.cs b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/DetectedLanguage.cs
index 508a75f0de40..245b396c8621 100644
--- a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/DetectedLanguage.cs
+++ b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/DetectedLanguage.cs
@@ -1,3 +1,4 @@
+//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
@@ -5,13 +6,10 @@
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
+//
namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models
{
- using Microsoft.Azure;
- using Microsoft.Azure.CognitiveServices;
- using Microsoft.Azure.CognitiveServices.Language;
- using Microsoft.Azure.CognitiveServices.Language.TextAnalytics;
using Newtonsoft.Json;
using System.Linq;
@@ -22,7 +20,7 @@ public partial class DetectedLanguage
///
public DetectedLanguage()
{
- CustomInit();
+ CustomInit();
}
///
diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/EntitiesBatchResult.cs b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/EntitiesBatchResult.cs
new file mode 100644
index 000000000000..70b135e11f92
--- /dev/null
+++ b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/EntitiesBatchResult.cs
@@ -0,0 +1,54 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models
+{
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+
+ public partial class EntitiesBatchResult
+ {
+ ///
+ /// Initializes a new instance of the EntitiesBatchResult class.
+ ///
+ public EntitiesBatchResult()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the EntitiesBatchResult class.
+ ///
+ public EntitiesBatchResult(IList documents = default(IList), IList errors = default(IList))
+ {
+ Documents = documents;
+ Errors = errors;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ ///
+ [JsonProperty(PropertyName = "documents")]
+ public IList Documents { get; private set; }
+
+ ///
+ ///
+ [JsonProperty(PropertyName = "errors")]
+ public IList Errors { get; private set; }
+
+ }
+}
diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/EntitiesBatchResultItem.cs b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/EntitiesBatchResultItem.cs
new file mode 100644
index 000000000000..9586ad36a830
--- /dev/null
+++ b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/EntitiesBatchResultItem.cs
@@ -0,0 +1,58 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models
+{
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+
+ public partial class EntitiesBatchResultItem
+ {
+ ///
+ /// Initializes a new instance of the EntitiesBatchResultItem class.
+ ///
+ public EntitiesBatchResultItem()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the EntitiesBatchResultItem class.
+ ///
+ /// Unique document identifier.
+ /// Recognized entities in the document.
+ public EntitiesBatchResultItem(string id = default(string), IList entities = default(IList))
+ {
+ Id = id;
+ Entities = entities;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets unique document identifier.
+ ///
+ [JsonProperty(PropertyName = "id")]
+ public string Id { get; private set; }
+
+ ///
+ /// Gets recognized entities in the document.
+ ///
+ [JsonProperty(PropertyName = "entities")]
+ public IList Entities { get; private set; }
+
+ }
+}
diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/EntityRecord.cs b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/EntityRecord.cs
new file mode 100644
index 000000000000..ce2992d5db9b
--- /dev/null
+++ b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/EntityRecord.cs
@@ -0,0 +1,99 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models
+{
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+
+ public partial class EntityRecord
+ {
+ ///
+ /// Initializes a new instance of the EntityRecord class.
+ ///
+ public EntityRecord()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the EntityRecord class.
+ ///
+ /// Entity formal name.
+ /// List of instances this entity appears in the
+ /// text.
+ /// Wikipedia language for which the
+ /// WikipediaId and WikipediaUrl refers to.
+ /// Wikipedia unique identifier of the
+ /// recognized entity.
+ /// URL for the entity's English Wikipedia
+ /// page.
+ /// Bing unique identifier of the recognized
+ /// entity. Use in conjunction with the Bing Entity Search API to fetch
+ /// additional relevant information.
+ public EntityRecord(string name = default(string), IList matches = default(IList), string wikipediaLanguage = default(string), string wikipediaId = default(string), string wikipediaUrl = default(string), string bingId = default(string))
+ {
+ Name = name;
+ Matches = matches;
+ WikipediaLanguage = wikipediaLanguage;
+ WikipediaId = wikipediaId;
+ WikipediaUrl = wikipediaUrl;
+ BingId = bingId;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets entity formal name.
+ ///
+ [JsonProperty(PropertyName = "name")]
+ public string Name { get; set; }
+
+ ///
+ /// Gets list of instances this entity appears in the text.
+ ///
+ [JsonProperty(PropertyName = "matches")]
+ public IList Matches { get; private set; }
+
+ ///
+ /// Gets or sets wikipedia language for which the WikipediaId and
+ /// WikipediaUrl refers to.
+ ///
+ [JsonProperty(PropertyName = "wikipediaLanguage")]
+ public string WikipediaLanguage { get; set; }
+
+ ///
+ /// Gets or sets wikipedia unique identifier of the recognized entity.
+ ///
+ [JsonProperty(PropertyName = "wikipediaId")]
+ public string WikipediaId { get; set; }
+
+ ///
+ /// Gets URL for the entity's English Wikipedia page.
+ ///
+ [JsonProperty(PropertyName = "wikipediaUrl")]
+ public string WikipediaUrl { get; private set; }
+
+ ///
+ /// Gets or sets bing unique identifier of the recognized entity. Use
+ /// in conjunction with the Bing Entity Search API to fetch additional
+ /// relevant information.
+ ///
+ [JsonProperty(PropertyName = "bingId")]
+ public string BingId { get; set; }
+
+ }
+}
diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/ErrorRecord.cs b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/ErrorRecord.cs
index 8c01ef9298e4..4cd76c5c32dd 100644
--- a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/ErrorRecord.cs
+++ b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/ErrorRecord.cs
@@ -1,3 +1,4 @@
+//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
@@ -5,13 +6,10 @@
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
+//
namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models
{
- using Microsoft.Azure;
- using Microsoft.Azure.CognitiveServices;
- using Microsoft.Azure.CognitiveServices.Language;
- using Microsoft.Azure.CognitiveServices.Language.TextAnalytics;
using Newtonsoft.Json;
using System.Linq;
@@ -22,7 +20,7 @@ public partial class ErrorRecord
///
public ErrorRecord()
{
- CustomInit();
+ CustomInit();
}
///
diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/ErrorResponse.cs b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/ErrorResponse.cs
index f8b6d97d1370..a0238b4cd64b 100644
--- a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/ErrorResponse.cs
+++ b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/ErrorResponse.cs
@@ -1,3 +1,4 @@
+//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
@@ -5,13 +6,10 @@
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
+//
namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models
{
- using Microsoft.Azure;
- using Microsoft.Azure.CognitiveServices;
- using Microsoft.Azure.CognitiveServices.Language;
- using Microsoft.Azure.CognitiveServices.Language.TextAnalytics;
using Newtonsoft.Json;
using System.Linq;
@@ -22,7 +20,7 @@ public partial class ErrorResponse
///
public ErrorResponse()
{
- CustomInit();
+ CustomInit();
}
///
diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/ErrorResponseException.cs b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/ErrorResponseException.cs
index 7871ec118743..d88dd6b74f42 100644
--- a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/ErrorResponseException.cs
+++ b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/ErrorResponseException.cs
@@ -1,3 +1,4 @@
+//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
@@ -5,20 +6,17 @@
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
+//
namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models
{
- using Microsoft.Azure;
- using Microsoft.Azure.CognitiveServices;
- using Microsoft.Azure.CognitiveServices.Language;
- using Microsoft.Azure.CognitiveServices.Language.TextAnalytics;
using Microsoft.Rest;
///
/// Exception thrown for an invalid response with ErrorResponse
/// information.
///
- public class ErrorResponseException : RestException
+ public partial class ErrorResponseException : RestException
{
///
/// Gets information about the associated HTTP request.
diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/Input.cs b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/Input.cs
index 37d3e9bfdd2a..a73c34d36d57 100644
--- a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/Input.cs
+++ b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/Input.cs
@@ -1,3 +1,4 @@
+//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
@@ -5,13 +6,10 @@
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
+//
namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models
{
- using Microsoft.Azure;
- using Microsoft.Azure.CognitiveServices;
- using Microsoft.Azure.CognitiveServices.Language;
- using Microsoft.Azure.CognitiveServices.Language.TextAnalytics;
using Newtonsoft.Json;
using System.Linq;
@@ -22,7 +20,7 @@ public partial class Input
///
public Input()
{
- CustomInit();
+ CustomInit();
}
///
diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/InternalError.cs b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/InternalError.cs
index 23b9464e9952..31497f699611 100644
--- a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/InternalError.cs
+++ b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/InternalError.cs
@@ -1,3 +1,4 @@
+//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
@@ -5,13 +6,10 @@
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
+//
namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models
{
- using Microsoft.Azure;
- using Microsoft.Azure.CognitiveServices;
- using Microsoft.Azure.CognitiveServices.Language;
- using Microsoft.Azure.CognitiveServices.Language.TextAnalytics;
using Newtonsoft.Json;
using System.Linq;
@@ -22,7 +20,7 @@ public partial class InternalError
///
public InternalError()
{
- CustomInit();
+ CustomInit();
}
///
diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/KeyPhraseBatchResult.cs b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/KeyPhraseBatchResult.cs
index 36c756de0e02..663f914d9616 100644
--- a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/KeyPhraseBatchResult.cs
+++ b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/KeyPhraseBatchResult.cs
@@ -1,3 +1,4 @@
+//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
@@ -5,13 +6,10 @@
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
+//
namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models
{
- using Microsoft.Azure;
- using Microsoft.Azure.CognitiveServices;
- using Microsoft.Azure.CognitiveServices.Language;
- using Microsoft.Azure.CognitiveServices.Language.TextAnalytics;
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
@@ -24,7 +22,7 @@ public partial class KeyPhraseBatchResult
///
public KeyPhraseBatchResult()
{
- CustomInit();
+ CustomInit();
}
///
diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/KeyPhraseBatchResultItem.cs b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/KeyPhraseBatchResultItem.cs
index 36837bd980c4..4402ee0ff877 100644
--- a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/KeyPhraseBatchResultItem.cs
+++ b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/KeyPhraseBatchResultItem.cs
@@ -1,3 +1,4 @@
+//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
@@ -5,13 +6,10 @@
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
+//
namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models
{
- using Microsoft.Azure;
- using Microsoft.Azure.CognitiveServices;
- using Microsoft.Azure.CognitiveServices.Language;
- using Microsoft.Azure.CognitiveServices.Language.TextAnalytics;
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
@@ -24,7 +22,7 @@ public partial class KeyPhraseBatchResultItem
///
public KeyPhraseBatchResultItem()
{
- CustomInit();
+ CustomInit();
}
///
diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/LanguageBatchResult.cs b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/LanguageBatchResult.cs
index a64349b554a1..e28681181736 100644
--- a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/LanguageBatchResult.cs
+++ b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/LanguageBatchResult.cs
@@ -1,3 +1,4 @@
+//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
@@ -5,13 +6,10 @@
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
+//
namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models
{
- using Microsoft.Azure;
- using Microsoft.Azure.CognitiveServices;
- using Microsoft.Azure.CognitiveServices.Language;
- using Microsoft.Azure.CognitiveServices.Language.TextAnalytics;
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
@@ -24,7 +22,7 @@ public partial class LanguageBatchResult
///
public LanguageBatchResult()
{
- CustomInit();
+ CustomInit();
}
///
diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/LanguageBatchResultItem.cs b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/LanguageBatchResultItem.cs
index c50677ddcc76..47beaf5afe4a 100644
--- a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/LanguageBatchResultItem.cs
+++ b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/LanguageBatchResultItem.cs
@@ -1,3 +1,4 @@
+//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
@@ -5,13 +6,10 @@
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
+//
namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models
{
- using Microsoft.Azure;
- using Microsoft.Azure.CognitiveServices;
- using Microsoft.Azure.CognitiveServices.Language;
- using Microsoft.Azure.CognitiveServices.Language.TextAnalytics;
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
@@ -24,7 +22,7 @@ public partial class LanguageBatchResultItem
///
public LanguageBatchResultItem()
{
- CustomInit();
+ CustomInit();
}
///
diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/MatchRecord.cs b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/MatchRecord.cs
new file mode 100644
index 000000000000..65835ae26620
--- /dev/null
+++ b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/MatchRecord.cs
@@ -0,0 +1,68 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models
+{
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ public partial class MatchRecord
+ {
+ ///
+ /// Initializes a new instance of the MatchRecord class.
+ ///
+ public MatchRecord()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the MatchRecord class.
+ ///
+ /// Entity text as appears in the request.
+ /// Start position (in Unicode characters) for the
+ /// entity match text.
+ /// Length (in Unicode characters) for the entity
+ /// match text.
+ public MatchRecord(string text = default(string), int? offset = default(int?), int? length = default(int?))
+ {
+ Text = text;
+ Offset = offset;
+ Length = length;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets entity text as appears in the request.
+ ///
+ [JsonProperty(PropertyName = "text")]
+ public string Text { get; set; }
+
+ ///
+ /// Gets or sets start position (in Unicode characters) for the entity
+ /// match text.
+ ///
+ [JsonProperty(PropertyName = "offset")]
+ public int? Offset { get; set; }
+
+ ///
+ /// Gets or sets length (in Unicode characters) for the entity match
+ /// text.
+ ///
+ [JsonProperty(PropertyName = "length")]
+ public int? Length { get; set; }
+
+ }
+}
diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/MultiLanguageBatchInput.cs b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/MultiLanguageBatchInput.cs
index 39289ab1bf48..717df86fef80 100644
--- a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/MultiLanguageBatchInput.cs
+++ b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/MultiLanguageBatchInput.cs
@@ -1,3 +1,4 @@
+//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
@@ -5,13 +6,10 @@
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
+//
namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models
{
- using Microsoft.Azure;
- using Microsoft.Azure.CognitiveServices;
- using Microsoft.Azure.CognitiveServices.Language;
- using Microsoft.Azure.CognitiveServices.Language.TextAnalytics;
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
@@ -24,7 +22,7 @@ public partial class MultiLanguageBatchInput
///
public MultiLanguageBatchInput()
{
- CustomInit();
+ CustomInit();
}
///
diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/MultiLanguageInput.cs b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/MultiLanguageInput.cs
index 089f99758605..c1fa451ecece 100644
--- a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/MultiLanguageInput.cs
+++ b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/MultiLanguageInput.cs
@@ -1,3 +1,4 @@
+//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
@@ -5,13 +6,10 @@
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
+//
namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models
{
- using Microsoft.Azure;
- using Microsoft.Azure.CognitiveServices;
- using Microsoft.Azure.CognitiveServices.Language;
- using Microsoft.Azure.CognitiveServices.Language.TextAnalytics;
using Newtonsoft.Json;
using System.Linq;
@@ -22,7 +20,7 @@ public partial class MultiLanguageInput
///
public MultiLanguageInput()
{
- CustomInit();
+ CustomInit();
}
///
diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/SentimentBatchResult.cs b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/SentimentBatchResult.cs
index 3f9343073332..1b66e1cdbd4d 100644
--- a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/SentimentBatchResult.cs
+++ b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/SentimentBatchResult.cs
@@ -1,3 +1,4 @@
+//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
@@ -5,13 +6,10 @@
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
+//
namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models
{
- using Microsoft.Azure;
- using Microsoft.Azure.CognitiveServices;
- using Microsoft.Azure.CognitiveServices.Language;
- using Microsoft.Azure.CognitiveServices.Language.TextAnalytics;
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
@@ -24,7 +22,7 @@ public partial class SentimentBatchResult
///
public SentimentBatchResult()
{
- CustomInit();
+ CustomInit();
}
///
diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/SentimentBatchResultItem.cs b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/SentimentBatchResultItem.cs
index 1591ac293d56..595709a09c33 100644
--- a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/SentimentBatchResultItem.cs
+++ b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/Models/SentimentBatchResultItem.cs
@@ -1,3 +1,4 @@
+//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
@@ -5,13 +6,10 @@
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
+//
namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models
{
- using Microsoft.Azure;
- using Microsoft.Azure.CognitiveServices;
- using Microsoft.Azure.CognitiveServices.Language;
- using Microsoft.Azure.CognitiveServices.Language.TextAnalytics;
using Newtonsoft.Json;
using System.Linq;
@@ -22,7 +20,7 @@ public partial class SentimentBatchResultItem
///
public SentimentBatchResultItem()
{
- CustomInit();
+ CustomInit();
}
///
diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/SdkInfo_TextAnalyticsAPI.cs b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/SdkInfo_TextAnalyticsAPI.cs
new file mode 100644
index 000000000000..5abffc11d7ba
--- /dev/null
+++ b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/SdkInfo_TextAnalyticsAPI.cs
@@ -0,0 +1,30 @@
+
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+
+ internal static partial class SdkInfo
+ {
+ public static IEnumerable> ApiInfo_TextAnalyticsAPI
+ {
+ get
+ {
+ return new Tuple[]
+ {
+ new Tuple("TextAnalyticsAPI", "Detect Language", "v2.0"),
+ new Tuple("TextAnalyticsAPI", "Entities", "v2.0"),
+ new Tuple("TextAnalyticsAPI", "Key Phrases", "v2.0"),
+ new Tuple("TextAnalyticsAPI", "Sentiment", "v2.0"),
+ }.AsEnumerable();
+ }
+ }
+ }
+}
diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/TextAnalyticsAPI.cs b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/TextAnalyticsAPI.cs
index 233bb6d6c8b3..18d31ff6f97f 100644
--- a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/TextAnalyticsAPI.cs
+++ b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/TextAnalyticsAPI.cs
@@ -1,3 +1,4 @@
+//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
@@ -5,12 +6,10 @@
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
+//
namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics
{
- using Microsoft.Azure;
- using Microsoft.Azure.CognitiveServices;
- using Microsoft.Azure.CognitiveServices.Language;
using Microsoft.Rest;
using Microsoft.Rest.Serialization;
using Models;
@@ -49,25 +48,26 @@ public partial class TextAnalyticsAPI : ServiceClient, ITextAn
///
public JsonSerializerSettings DeserializationSettings { get; private set; }
- ///
- /// Subscription key in header
- ///
- public string SubscriptionKey { get; set; }
-
///
/// Supported Azure regions for Cognitive Services endpoints. Possible values
/// include: 'westus', 'westeurope', 'southeastasia', 'eastus2',
- /// 'westcentralus'
+ /// 'westcentralus', 'westus2', 'eastus', 'southcentralus', 'northeurope',
+ /// 'eastasia', 'australiaeast', 'brazilsouth'
///
public AzureRegions AzureRegion { get; set; }
+ ///
+ /// Subscription credentials which uniquely identify client subscription.
+ ///
+ public ServiceClientCredentials Credentials { get; private set; }
+
///
/// Initializes a new instance of the TextAnalyticsAPI class.
///
///
/// Optional. The delegating handlers to add to the http client pipeline.
///
- public TextAnalyticsAPI(params DelegatingHandler[] handlers) : base(handlers)
+ protected TextAnalyticsAPI(params DelegatingHandler[] handlers) : base(handlers)
{
Initialize();
}
@@ -81,11 +81,64 @@ public TextAnalyticsAPI(params DelegatingHandler[] handlers) : base(handlers)
///
/// Optional. The delegating handlers to add to the http client pipeline.
///
- public TextAnalyticsAPI(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers)
+ protected TextAnalyticsAPI(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers)
{
Initialize();
}
+ ///
+ /// Initializes a new instance of the TextAnalyticsAPI class.
+ ///
+ ///
+ /// Required. Subscription credentials which uniquely identify client subscription.
+ ///
+ ///
+ /// Optional. The delegating handlers to add to the http client pipeline.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ public TextAnalyticsAPI(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers)
+ {
+ if (credentials == null)
+ {
+ throw new System.ArgumentNullException("credentials");
+ }
+ Credentials = credentials;
+ if (Credentials != null)
+ {
+ Credentials.InitializeServiceClient(this);
+ }
+ }
+
+ ///
+ /// Initializes a new instance of the TextAnalyticsAPI class.
+ ///
+ ///
+ /// Required. Subscription credentials which uniquely identify client subscription.
+ ///
+ ///
+ /// Optional. The http client handler used to handle http transport.
+ ///
+ ///
+ /// Optional. The delegating handlers to add to the http client pipeline.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ public TextAnalyticsAPI(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers)
+ {
+ if (credentials == null)
+ {
+ throw new System.ArgumentNullException("credentials");
+ }
+ Credentials = credentials;
+ if (Credentials != null)
+ {
+ Credentials.InitializeServiceClient(this);
+ }
+ }
+
///
/// An optional partial-method to perform custom initialization.
///
@@ -128,8 +181,7 @@ private void Initialize()
/// input text.
///
///
- /// We employ techniques from Microsoft Office's sophisticated Natural Language
- /// Processing toolkit. See the <a
+ /// See the <a
/// href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text
/// Analytics Documentation</a> for details about the languages that are
/// supported by key phrase extraction.
@@ -161,10 +213,6 @@ private void Initialize()
///
public async Task> KeyPhrasesWithHttpMessagesAsync(MultiLanguageBatchInput input, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (SubscriptionKey == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "this.SubscriptionKey");
- }
if (input == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "input");
@@ -190,14 +238,6 @@ private void Initialize()
_httpRequest.Method = new HttpMethod("POST");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
- if (SubscriptionKey != null)
- {
- if (_httpRequest.Headers.Contains("Ocp-Apim-Subscription-Key"))
- {
- _httpRequest.Headers.Remove("Ocp-Apim-Subscription-Key");
- }
- _httpRequest.Headers.TryAddWithoutValidation("Ocp-Apim-Subscription-Key", SubscriptionKey);
- }
if (customHeaders != null)
@@ -220,6 +260,12 @@ private void Initialize()
_httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
_httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
}
+ // Set Credentials
+ if (Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
// Send Request
if (_shouldTrace)
{
@@ -302,10 +348,6 @@ private void Initialize()
///
/// Collection of documents to analyze.
///
- ///
- /// (Optional. Deprecated) Number of languages to detect. Set to 1 by default.
- /// Irrespective of the value, the language with the highest score is returned.
- ///
///
/// Headers that will be added to request.
///
@@ -327,12 +369,8 @@ private void Initialize()
///
/// A response object containing the response body and response headers.
///
- public async Task> DetectLanguageWithHttpMessagesAsync(BatchInput input, int? numberOfLanguagesToDetect = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> DetectLanguageWithHttpMessagesAsync(BatchInput input, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (SubscriptionKey == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "this.SubscriptionKey");
- }
if (input == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "input");
@@ -345,7 +383,6 @@ private void Initialize()
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("input", input);
- tracingParameters.Add("numberOfLanguagesToDetect", numberOfLanguagesToDetect);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "DetectLanguage", tracingParameters);
}
@@ -353,29 +390,12 @@ private void Initialize()
var _baseUrl = BaseUri;
var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "v2.0/languages";
_url = _url.Replace("{AzureRegion}", SafeJsonConvert.SerializeObject(AzureRegion, SerializationSettings).Trim('"'));
- List _queryParameters = new List();
- if (numberOfLanguagesToDetect != null)
- {
- _queryParameters.Add(string.Format("numberOfLanguagesToDetect={0}", System.Uri.EscapeDataString(SafeJsonConvert.SerializeObject(numberOfLanguagesToDetect, SerializationSettings).Trim('"'))));
- }
- if (_queryParameters.Count > 0)
- {
- _url += "?" + string.Join("&", _queryParameters);
- }
// Create HTTP transport objects
var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
_httpRequest.Method = new HttpMethod("POST");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
- if (SubscriptionKey != null)
- {
- if (_httpRequest.Headers.Contains("Ocp-Apim-Subscription-Key"))
- {
- _httpRequest.Headers.Remove("Ocp-Apim-Subscription-Key");
- }
- _httpRequest.Headers.TryAddWithoutValidation("Ocp-Apim-Subscription-Key", SubscriptionKey);
- }
if (customHeaders != null)
@@ -398,6 +418,12 @@ private void Initialize()
_httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
_httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
}
+ // Set Credentials
+ if (Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
// Send Request
if (_shouldTrace)
{
@@ -475,10 +501,8 @@ private void Initialize()
///
///
/// Scores close to 1 indicate positive sentiment, while scores close to 0
- /// indicate negative sentiment. Sentiment score is generated using
- /// classification techniques. The input features to the classifier include
- /// n-grams, features generated from part-of-speech tags, and word embeddings.
- /// See the <a
+ /// indicate negative sentiment. A score of 0.5 indicates the lack of sentiment
+ /// (e.g. a factoid statement). See the <a
/// href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text
/// Analytics Documentation</a> for details about the languages that are
/// supported by sentiment analysis.
@@ -509,10 +533,6 @@ private void Initialize()
///
public async Task> SentimentWithHttpMessagesAsync(MultiLanguageBatchInput input, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (SubscriptionKey == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "this.SubscriptionKey");
- }
if (input == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "input");
@@ -538,15 +558,169 @@ private void Initialize()
_httpRequest.Method = new HttpMethod("POST");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
- if (SubscriptionKey != null)
+
+
+ if (customHeaders != null)
{
- if (_httpRequest.Headers.Contains("Ocp-Apim-Subscription-Key"))
+ foreach(var _header in customHeaders)
{
- _httpRequest.Headers.Remove("Ocp-Apim-Subscription-Key");
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
}
- _httpRequest.Headers.TryAddWithoutValidation("Ocp-Apim-Subscription-Key", SubscriptionKey);
}
+ // Serialize Request
+ string _requestContent = null;
+ if(input != null)
+ {
+ _requestContent = SafeJsonConvert.SerializeObject(input, SerializationSettings);
+ _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
+ _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
+ }
+ // Set Credentials
+ if (Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ ErrorResponse _errorBody = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new HttpOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// The API returns a list of recognized entities in a given document.
+ ///
+ ///
+ /// To get even more information on each recognized entity we recommend using
+ /// the Bing Entity Search API by querying for the recognized entities names.
+ /// See the <a
+ /// href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/text-analytics-supported-languages">Supported
+ /// languages in Text Analytics API</a> for the list of enabled
+ /// languages.
+ ///
+ ///
+ /// Collection of documents to analyze.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> EntitiesWithHttpMessagesAsync(MultiLanguageBatchInput input, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (input == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "input");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("input", input);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "Entities", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = BaseUri;
+ var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "v2.0/entities";
+ _url = _url.Replace("{AzureRegion}", SafeJsonConvert.SerializeObject(AzureRegion, SerializationSettings).Trim('"'));
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("POST");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+
if (customHeaders != null)
{
@@ -568,6 +742,12 @@ private void Initialize()
_httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
_httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
}
+ // Set Credentials
+ if (Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
// Send Request
if (_shouldTrace)
{
@@ -612,7 +792,7 @@ private void Initialize()
throw ex;
}
// Create Result
- var _result = new HttpOperationResponse();
+ var _result = new HttpOperationResponse();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
// Deserialize Response
@@ -621,7 +801,7 @@ private void Initialize()
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings);
+ _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings);
}
catch (JsonException ex)
{
diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/TextAnalyticsAPIExtensions.cs b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/TextAnalyticsAPIExtensions.cs
index 539194a4b441..a92827ce751a 100644
--- a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/TextAnalyticsAPIExtensions.cs
+++ b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Generated/TextAnalytics/TextAnalyticsAPIExtensions.cs
@@ -1,3 +1,4 @@
+//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
@@ -5,12 +6,10 @@
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
+//
namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics
{
- using Microsoft.Azure;
- using Microsoft.Azure.CognitiveServices;
- using Microsoft.Azure.CognitiveServices.Language;
using Models;
using System.Threading;
using System.Threading.Tasks;
@@ -25,31 +24,7 @@ public static partial class TextAnalyticsAPIExtensions
/// input text.
///
///
- /// We employ techniques from Microsoft Office's sophisticated Natural Language
- /// Processing toolkit. See the <a
- /// href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text
- /// Analytics Documentation</a> for details about the languages that are
- /// supported by key phrase extraction.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// Collection of documents to analyze. Documents can now contain a language
- /// field to indicate the text language
- ///
- public static KeyPhraseBatchResult KeyPhrases(this ITextAnalyticsAPI operations, MultiLanguageBatchInput input)
- {
- return operations.KeyPhrasesAsync(input).GetAwaiter().GetResult();
- }
-
- ///
- /// The API returns a list of strings denoting the key talking points in the
- /// input text.
- ///
- ///
- /// We employ techniques from Microsoft Office's sophisticated Natural Language
- /// Processing toolkit. See the <a
+ /// See the <a
/// href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text
/// Analytics Documentation</a> for details about the languages that are
/// supported by key phrase extraction.
@@ -85,38 +60,12 @@ public static KeyPhraseBatchResult KeyPhrases(this ITextAnalyticsAPI operations,
///
/// Collection of documents to analyze.
///
- ///
- /// (Optional. Deprecated) Number of languages to detect. Set to 1 by default.
- /// Irrespective of the value, the language with the highest score is returned.
- ///
- public static LanguageBatchResult DetectLanguage(this ITextAnalyticsAPI operations, BatchInput input, int? numberOfLanguagesToDetect = default(int?))
- {
- return operations.DetectLanguageAsync(input, numberOfLanguagesToDetect).GetAwaiter().GetResult();
- }
-
- ///
- /// The API returns the detected language and a numeric score between 0 and 1.
- ///
- ///
- /// Scores close to 1 indicate 100% certainty that the identified language is
- /// true. A total of 120 languages are supported.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// Collection of documents to analyze.
- ///
- ///
- /// (Optional. Deprecated) Number of languages to detect. Set to 1 by default.
- /// Irrespective of the value, the language with the highest score is returned.
- ///
///
/// The cancellation token.
///
- public static async Task DetectLanguageAsync(this ITextAnalyticsAPI operations, BatchInput input, int? numberOfLanguagesToDetect = default(int?), CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task DetectLanguageAsync(this ITextAnalyticsAPI operations, BatchInput input, CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.DetectLanguageWithHttpMessagesAsync(input, numberOfLanguagesToDetect, null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.DetectLanguageWithHttpMessagesAsync(input, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
@@ -127,10 +76,8 @@ public static KeyPhraseBatchResult KeyPhrases(this ITextAnalyticsAPI operations,
///
///
/// Scores close to 1 indicate positive sentiment, while scores close to 0
- /// indicate negative sentiment. Sentiment score is generated using
- /// classification techniques. The input features to the classifier include
- /// n-grams, features generated from part-of-speech tags, and word embeddings.
- /// See the <a
+ /// indicate negative sentiment. A score of 0.5 indicates the lack of sentiment
+ /// (e.g. a factoid statement). See the <a
/// href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text
/// Analytics Documentation</a> for details about the languages that are
/// supported by sentiment analysis.
@@ -141,23 +88,27 @@ public static KeyPhraseBatchResult KeyPhrases(this ITextAnalyticsAPI operations,
///
/// Collection of documents to analyze.
///
- public static SentimentBatchResult Sentiment(this ITextAnalyticsAPI operations, MultiLanguageBatchInput input)
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task SentimentAsync(this ITextAnalyticsAPI operations, MultiLanguageBatchInput input, CancellationToken cancellationToken = default(CancellationToken))
{
- return operations.SentimentAsync(input).GetAwaiter().GetResult();
+ using (var _result = await operations.SentimentWithHttpMessagesAsync(input, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
}
///
- /// The API returns a numeric score between 0 and 1.
+ /// The API returns a list of recognized entities in a given document.
///
///
- /// Scores close to 1 indicate positive sentiment, while scores close to 0
- /// indicate negative sentiment. Sentiment score is generated using
- /// classification techniques. The input features to the classifier include
- /// n-grams, features generated from part-of-speech tags, and word embeddings.
+ /// To get even more information on each recognized entity we recommend using
+ /// the Bing Entity Search API by querying for the recognized entities names.
/// See the <a
- /// href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text
- /// Analytics Documentation</a> for details about the languages that are
- /// supported by sentiment analysis.
+ /// href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/text-analytics-supported-languages">Supported
+ /// languages in Text Analytics API</a> for the list of enabled
+ /// languages.
///
///
/// The operations group for this extension method.
@@ -168,9 +119,9 @@ public static SentimentBatchResult Sentiment(this ITextAnalyticsAPI operations,
///
/// The cancellation token.
///
- public static async Task SentimentAsync(this ITextAnalyticsAPI operations, MultiLanguageBatchInput input, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task EntitiesAsync(this ITextAnalyticsAPI operations, MultiLanguageBatchInput input, CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.SentimentWithHttpMessagesAsync(input, null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.EntitiesWithHttpMessagesAsync(input, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Microsoft.Azure.CognitiveServices.Language.csproj b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Microsoft.Azure.CognitiveServices.Language.csproj
index 52d44f0864cb..ecea6e2c96a2 100644
--- a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Microsoft.Azure.CognitiveServices.Language.csproj
+++ b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Microsoft.Azure.CognitiveServices.Language.csproj
@@ -2,20 +2,29 @@
-
+
Microsoft.Azure.CognitiveServices.Language
This client library provides access to the Microsoft Cognitive Services Language APIs.
- 1.0.0-preview
+ 1.0.1-preview
Microsoft.Azure.CognitiveServices.Language
Microsoft Cognitive Services;Cognitive Services;Cognitive Services SDK;Text Analytics API;Text Analytics;REST HTTP client;netcore451511
- This is a preview release of the Cognitive Services Language SDK. Included with this release is support for Text Analytics API.
+
+ Microsoft.Azure.CognitiveServices.Language.TextAnalytics package.
+
+ Changes in this release:
+ 1. New /entities endpoint support
+ 2. Additional AzureRegions: Westus2, Eastus, Southcentralus, Northeurope, Eastasia, Australiaeast, Brazilsouth
+ ]]>
net452;netstandard1.4
-
+
-
\ No newline at end of file
+
diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Properties/AssemblyInfo.cs b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Properties/AssemblyInfo.cs
index 627baa18fb9a..3155be24a467 100644
--- a/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Properties/AssemblyInfo.cs
+++ b/src/SDKs/CognitiveServices/dataPlane/Language/Language/Language/Properties/AssemblyInfo.cs
@@ -7,8 +7,8 @@
[assembly: AssemblyTitle("Microsoft Azure Cognitive Services Language Client Library")]
[assembly: AssemblyDescription("Provides API functions for consuming Microsoft Azure Cognitive Services Language APIs.")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: AssemblyVersion("1.0.1.0")]
+[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]