diff --git a/sdk/cognitiveservices/Language.TextAnalytics/src/Customizations/TextAnalytics/Models/EntitiesResult.cs b/sdk/cognitiveservices/Language.TextAnalytics/src/Customizations/TextAnalytics/Models/EntitiesResult.cs
new file mode 100644
index 0000000000000..5ffd74aa211ea
--- /dev/null
+++ b/sdk/cognitiveservices/Language.TextAnalytics/src/Customizations/TextAnalytics/Models/EntitiesResult.cs
@@ -0,0 +1,62 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+
+namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models
+{
+ using System.Collections.Generic;
+ using Newtonsoft.Json;
+
+ public partial class EntitiesResult
+ {
+ ///
+ /// Initializes a new instance of the EntitiesResult class.
+ ///
+ public EntitiesResult()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the EntitiesResult class.
+ ///
+ /// Recognized entities in the document.
+ /// Error or Warning related to the document.
+ /// (Optional) if showStats=true was specified
+ /// in the request this field will contain information about the
+ /// request payload.
+ public EntitiesResult(IList entities = default(IList), string errorMessage = default(string), RequestStatistics statistics = default(RequestStatistics))
+ {
+ Entities = entities;
+ ErrorMessage = errorMessage;
+ Statistics = statistics;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets recognized entities in the document.
+ ///
+ [JsonProperty(PropertyName = "entities")]
+ public IList Entities { get; private set; }
+
+ ///
+ /// Gets error or warning for the request.
+ ///
+ [JsonProperty(PropertyName = "ErrorMessage")]
+ public string ErrorMessage { get; private set; }
+
+ ///
+ /// Gets (Optional) if showStats=true was specified in the request this
+ /// field will contain information about the request payload.
+ ///
+ [JsonProperty(PropertyName = "statistics")]
+ public RequestStatistics Statistics { get; set; }
+ }
+}
diff --git a/sdk/cognitiveservices/Language.TextAnalytics/src/Customizations/TextAnalytics/Models/KeyPhraseResult.cs b/sdk/cognitiveservices/Language.TextAnalytics/src/Customizations/TextAnalytics/Models/KeyPhraseResult.cs
new file mode 100644
index 0000000000000..bfcdb61c83f47
--- /dev/null
+++ b/sdk/cognitiveservices/Language.TextAnalytics/src/Customizations/TextAnalytics/Models/KeyPhraseResult.cs
@@ -0,0 +1,67 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+
+namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models
+{
+ using System.Collections.Generic;
+ using Newtonsoft.Json;
+
+ public partial class KeyPhraseResult
+ {
+ ///
+ /// Initializes a new instance of the KeyPhraseResult class.
+ ///
+ public KeyPhraseResult()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the KeyPhraseResult class.
+ ///
+ /// A list of representative words or phrases.
+ /// The number of key phrases returned is proportional to the number of
+ /// words in the input document.
+ /// Error or Warning related to the document.
+ /// (Optional) if showStats=true was specified
+ /// in the request this field will contain information about the
+ /// request payload.
+ public KeyPhraseResult(IList keyPhrases = default(IList), string errorMessage = default(string), RequestStatistics statistics = default(RequestStatistics))
+ {
+ KeyPhrases = keyPhrases;
+ ErrorMessage = errorMessage;
+ Statistics = statistics;
+ CustomInit();
+ }
+
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets a list of representative words or phrases. The number of key
+ /// phrases returned is proportional to the number of words in the
+ /// input document.
+ ///
+ [JsonProperty(PropertyName = "keyPhrases")]
+ public IList KeyPhrases { get; private set; }
+
+ ///
+ /// Gets error or warning for the request.
+ ///
+ [JsonProperty(PropertyName = "ErrorMessage")]
+ public string ErrorMessage { get; private set; }
+
+ ///
+ /// Gets (Optional) if showStats=true was specified in the request this
+ /// field will contain information about the request payload.
+ ///
+ [JsonProperty(PropertyName = "statistics")]
+ public RequestStatistics Statistics { get; set; }
+ }
+}
diff --git a/sdk/cognitiveservices/Language.TextAnalytics/src/Customizations/TextAnalytics/Models/LanguageInput.cs b/sdk/cognitiveservices/Language.TextAnalytics/src/Customizations/TextAnalytics/Models/LanguageInput.cs
index f6b0d8ecdf722..2b8fe0e134ed6 100644
--- a/sdk/cognitiveservices/Language.TextAnalytics/src/Customizations/TextAnalytics/Models/LanguageInput.cs
+++ b/sdk/cognitiveservices/Language.TextAnalytics/src/Customizations/TextAnalytics/Models/LanguageInput.cs
@@ -7,7 +7,6 @@
namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models
{
using Newtonsoft.Json;
- using System.Linq;
public partial class LanguageInput
{
diff --git a/sdk/cognitiveservices/Language.TextAnalytics/src/Customizations/TextAnalytics/Models/LanguageResult.cs b/sdk/cognitiveservices/Language.TextAnalytics/src/Customizations/TextAnalytics/Models/LanguageResult.cs
new file mode 100644
index 0000000000000..fe5198aa5e491
--- /dev/null
+++ b/sdk/cognitiveservices/Language.TextAnalytics/src/Customizations/TextAnalytics/Models/LanguageResult.cs
@@ -0,0 +1,63 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+
+namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models
+{
+ using Newtonsoft.Json;
+ using System.Collections.Generic;
+
+ public partial class LanguageResult
+ {
+ ///
+ /// Initializes a new instance of the LanguageResult class.
+ ///
+ public LanguageResult()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the LanguageResult class.
+ ///
+ /// A list of extracted languages.
+ /// Error or Warning related to the document.
+ /// (Optional) if showStats=true was specified
+ /// in the request this field will contain information about the
+ /// request payload.
+ public LanguageResult(IList detectedLanguages = default(IList), string errorMessage = default(string), RequestStatistics statistics = default(RequestStatistics))
+ {
+ DetectedLanguages = detectedLanguages;
+ ErrorMessage = errorMessage;
+ Statistics = statistics;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets a list of extracted languages.
+ ///
+ [JsonProperty(PropertyName = "detectedLanguages")]
+ public IList DetectedLanguages { get; set; }
+
+ ///
+ /// Gets error or warning for the request.
+ ///
+ [JsonProperty(PropertyName = "ErrorMessage")]
+ public string ErrorMessage { get; private set; }
+
+ ///
+ /// Gets (Optional) if showStats=true was specified in the request this
+ /// field will contain information about the request payload.
+ ///
+ [JsonProperty(PropertyName = "statistics")]
+ public RequestStatistics Statistics { get; private set; }
+
+ }
+}
diff --git a/sdk/cognitiveservices/Language.TextAnalytics/src/Customizations/TextAnalytics/Models/SentimentResult.cs b/sdk/cognitiveservices/Language.TextAnalytics/src/Customizations/TextAnalytics/Models/SentimentResult.cs
new file mode 100644
index 0000000000000..8ae4328df0ccb
--- /dev/null
+++ b/sdk/cognitiveservices/Language.TextAnalytics/src/Customizations/TextAnalytics/Models/SentimentResult.cs
@@ -0,0 +1,67 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+
+namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models
+{
+ using Newtonsoft.Json;
+
+ public partial class SentimentResult
+ {
+ ///
+ /// Initializes a new instance of the SentimentResult class.
+ ///
+ public SentimentResult()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the SentimentResult class.
+ ///
+ /// A decimal number between 0 and 1 denoting the
+ /// sentiment of the document. A score above 0.7 usually refers to a
+ /// positive document while a score below 0.3 normally has a negative
+ /// connotation. Mid values refer to neutral text.
+ /// Error or Warning related to the document.
+ /// (Optional) if showStats=true was specified
+ /// in the request this field will contain information about the
+ /// request payload.
+ public SentimentResult(double? score = default(double?), string errorMessage = default(string), RequestStatistics statistics = default(RequestStatistics))
+ {
+ Score = score;
+ ErrorMessage = errorMessage;
+ Statistics = statistics;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets a decimal number between 0 and 1 denoting the
+ /// sentiment of the document. A score above 0.7 usually refers to a
+ /// positive document while a score below 0.3 normally has a negative
+ /// connotation. Mid values refer to neutral text.
+ ///
+ [JsonProperty(PropertyName = "score")]
+ public double? Score { get; set; }
+
+ ///
+ /// Gets error or warning for the request.
+ ///
+ [JsonProperty(PropertyName = "ErrorMessage")]
+ public string ErrorMessage { get; private set; }
+
+ ///
+ /// Gets (Optional) if showStats=true was specified in the request this
+ /// field will contain information about the request payload.
+ ///
+ [JsonProperty(PropertyName = "statistics")]
+ public RequestStatistics Statistics { get; set; }
+ }
+}
diff --git a/sdk/cognitiveservices/Language.TextAnalytics/src/Customizations/TextAnalytics/TextAnalyticsClientExtensions.cs b/sdk/cognitiveservices/Language.TextAnalytics/src/Customizations/TextAnalytics/TextAnalyticsClientExtensions.cs
index a41b70ba79b67..60412e9fe7458 100644
--- a/sdk/cognitiveservices/Language.TextAnalytics/src/Customizations/TextAnalytics/TextAnalyticsClientExtensions.cs
+++ b/sdk/cognitiveservices/Language.TextAnalytics/src/Customizations/TextAnalytics/TextAnalyticsClientExtensions.cs
@@ -7,6 +7,7 @@
namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics
{
using Models;
+ using System.Collections;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
@@ -163,7 +164,7 @@ public static async Task SentimentBatchAsync(this ITextAna
///
/// The cancellation token.
///
- public static async Task DetectLanguageAsync(
+ public static async Task DetectLanguageAsync(
this ITextAnalyticsClient operations,
string inputText = default,
string countryHint = "en",
@@ -173,7 +174,11 @@ public static async Task DetectLanguageAsync(
var languageBatchInput = new LanguageBatchInput(new List { new LanguageInput("1", inputText, countryHint) });
using (var _result = await operations.DetectLanguageWithHttpMessagesAsync(showStats, languageBatchInput, null, cancellationToken).ConfigureAwait(false))
{
- return _result.Body;
+ IList languages = _result.Body.Documents.Count > 0 ? _result.Body.Documents[0].DetectedLanguages : null;
+ string errorMessage = _result.Body.Errors.Count > 0 ? _result.Body.Errors[0].Message : null;
+ RequestStatistics stats = _result.Body.Statistics;
+
+ return new LanguageResult(languages, errorMessage, stats);
}
}
@@ -204,7 +209,7 @@ public static async Task DetectLanguageAsync(
///
/// The cancellation token.
///
- public static async Task EntitiesAsync(
+ public static async Task EntitiesAsync(
this ITextAnalyticsClient operations,
string inputText = default,
string language = "en",
@@ -214,7 +219,11 @@ public static async Task EntitiesAsync(
var multiLanguageBatchInput = new MultiLanguageBatchInput(new List { new MultiLanguageInput("1", inputText, language) });
using (var _result = await operations.EntitiesWithHttpMessagesAsync(showStats, multiLanguageBatchInput, null, cancellationToken).ConfigureAwait(false))
{
- return _result.Body;
+ IList entities = _result.Body.Documents.Count > 0 ? _result.Body.Documents[0].Entities : null;
+ string errorMessage = _result.Body.Errors.Count > 0 ? _result.Body.Errors[0].Message : null;
+ RequestStatistics stats = _result.Body.Statistics;
+
+ return new EntitiesResult(entities, errorMessage, stats);
}
}
@@ -244,7 +253,7 @@ public static async Task EntitiesAsync(
///
/// The cancellation token.
///
- public static async Task KeyPhrasesAsync(
+ public static async Task KeyPhrasesAsync(
this ITextAnalyticsClient operations,
string inputText = default,
string language = "en",
@@ -254,7 +263,11 @@ public static async Task KeyPhrasesAsync(
var multiLanguageBatchInput = new MultiLanguageBatchInput(new List { new MultiLanguageInput("1", inputText, language) });
using (var _result = await operations.KeyPhrasesWithHttpMessagesAsync(showStats, multiLanguageBatchInput, null, cancellationToken).ConfigureAwait(false))
{
- return _result.Body;
+ IList keyPhrases = _result.Body.Documents.Count > 0 ? _result.Body.Documents[0].KeyPhrases : null;
+ string errorMessage = _result.Body.Errors.Count > 0 ? _result.Body.Errors[0].Message : null;
+ RequestStatistics stats = _result.Body.Statistics;
+
+ return new KeyPhraseResult(keyPhrases, errorMessage, stats);
}
}
@@ -285,7 +298,7 @@ public static async Task KeyPhrasesAsync(
///
/// The cancellation token.
///
- public static async Task SentimentAsync(
+ public static async Task SentimentAsync(
this ITextAnalyticsClient operations,
string inputText = default,
string language = "en",
@@ -295,7 +308,11 @@ public static async Task SentimentAsync(
var multiLanguageBatchInput = new MultiLanguageBatchInput(new List { new MultiLanguageInput("1", inputText, language) });
using (var _result = await operations.SentimentWithHttpMessagesAsync(showStats, multiLanguageBatchInput, null, cancellationToken).ConfigureAwait(false))
{
- return _result.Body;
+ double? score = _result.Body.Documents.Count > 0 ? _result.Body.Documents[0].Score : null;
+ string errorMessage = _result.Body.Errors.Count > 0 ? _result.Body.Errors[0].Message : null;
+ RequestStatistics stats = _result.Body.Statistics;
+
+ return new SentimentResult(score, errorMessage, stats);
}
}
@@ -438,7 +455,7 @@ public static SentimentBatchResult SentimentBatch(this ITextAnalyticsClient oper
///
/// The cancellation token.
///
- public static LanguageBatchResult DetectLanguage(
+ public static LanguageResult DetectLanguage(
this ITextAnalyticsClient operations,
string inputText = default,
string countryHint = "en",
@@ -447,7 +464,12 @@ public static LanguageBatchResult DetectLanguage(
{
var languageBatchInput = new LanguageBatchInput(new List { new LanguageInput("1", inputText, countryHint) });
var _result = operations.DetectLanguageWithHttpMessagesAsync(showStats, languageBatchInput, null, cancellationToken).ConfigureAwait(false).GetAwaiter().GetResult();
- return _result.Body;
+
+ IList languages = _result.Body.Documents.Count > 0 ? _result.Body.Documents[0].DetectedLanguages : null;
+ string errorMessage = _result.Body.Errors.Count > 0 ? _result.Body.Errors[0].Message : null;
+ RequestStatistics stats = _result.Body.Statistics;
+
+ return new LanguageResult(languages, errorMessage, stats);
}
///
@@ -477,7 +499,7 @@ public static LanguageBatchResult DetectLanguage(
///
/// The cancellation token.
///
- public static EntitiesBatchResult Entities(
+ public static EntitiesResult Entities(
this ITextAnalyticsClient operations,
string inputText = default,
string language = "en",
@@ -486,7 +508,12 @@ public static EntitiesBatchResult Entities(
{
var multiLanguageBatchInput = new MultiLanguageBatchInput(new List { new MultiLanguageInput("1", inputText, language) });
var _result = operations.EntitiesWithHttpMessagesAsync(showStats, multiLanguageBatchInput, null, cancellationToken).ConfigureAwait(false).GetAwaiter().GetResult();
- return _result.Body;
+
+ IList entities = _result.Body.Documents.Count > 0 ? _result.Body.Documents[0].Entities : null;
+ string errorMessage = _result.Body.Errors.Count > 0 ? _result.Body.Errors[0].Message : null;
+ RequestStatistics stats = _result.Body.Statistics;
+
+ return new EntitiesResult(entities, errorMessage, stats);
}
///
@@ -515,7 +542,7 @@ public static EntitiesBatchResult Entities(
///
/// The cancellation token.
///
- public static KeyPhraseBatchResult KeyPhrases(
+ public static KeyPhraseResult KeyPhrases(
this ITextAnalyticsClient operations,
string inputText = default,
string language = "en",
@@ -524,7 +551,12 @@ public static KeyPhraseBatchResult KeyPhrases(
{
var multiLanguageBatchInput = new MultiLanguageBatchInput(new List { new MultiLanguageInput("1", inputText, language) });
var _result = operations.KeyPhrasesWithHttpMessagesAsync(showStats, multiLanguageBatchInput, null, cancellationToken).ConfigureAwait(false).GetAwaiter().GetResult();
- return _result.Body;
+
+ IList keyPhrases = _result.Body.Documents.Count > 0 ? _result.Body.Documents[0].KeyPhrases : null;
+ string errorMessage = _result.Body.Errors.Count > 0 ? _result.Body.Errors[0].Message : null;
+ RequestStatistics stats = _result.Body.Statistics;
+
+ return new KeyPhraseResult(keyPhrases, errorMessage, stats);
}
///
@@ -554,7 +586,7 @@ public static KeyPhraseBatchResult KeyPhrases(
///
/// The cancellation token.
///
- public static SentimentBatchResult Sentiment(
+ public static SentimentResult Sentiment(
this ITextAnalyticsClient operations,
string inputText = default,
string language = "en",
@@ -563,7 +595,12 @@ public static SentimentBatchResult Sentiment(
{
var multiLanguageBatchInput = new MultiLanguageBatchInput(new List { new MultiLanguageInput("1", inputText, language) });
var _result = operations.SentimentWithHttpMessagesAsync(showStats, multiLanguageBatchInput, null, cancellationToken).ConfigureAwait(false).GetAwaiter().GetResult();
- return _result.Body;
+
+ double? score = _result.Body.Documents.Count > 0 ? _result.Body.Documents[0].Score : null;
+ string errorMessage = _result.Body.Errors.Count > 0 ? _result.Body.Errors[0].Message : null;
+ RequestStatistics stats = _result.Body.Statistics;
+
+ return new SentimentResult(score, errorMessage, stats);
}
}
}
diff --git a/sdk/cognitiveservices/Language.TextAnalytics/tests/TextAnalytics/DetectLanguageTests.cs b/sdk/cognitiveservices/Language.TextAnalytics/tests/TextAnalytics/DetectLanguageTests.cs
index e8c15eb3ccacb..fa92469404126 100644
--- a/sdk/cognitiveservices/Language.TextAnalytics/tests/TextAnalytics/DetectLanguageTests.cs
+++ b/sdk/cognitiveservices/Language.TextAnalytics/tests/TextAnalytics/DetectLanguageTests.cs
@@ -41,12 +41,12 @@ public async Task DetectLanguageAsync()
{
HttpMockServer.Initialize(this.GetType().FullName, "DetectLanguageAsync");
ITextAnalyticsClient client = GetClient(HttpMockServer.CreateInstance());
- LanguageBatchResult result = await client.DetectLanguageAsync(
+ LanguageResult result = await client.DetectLanguageAsync(
"I love my team mates");
- Assert.Equal("English", result.Documents[0].DetectedLanguages[0].Name);
- Assert.Equal("en", result.Documents[0].DetectedLanguages[0].Iso6391Name);
- Assert.True(result.Documents[0].DetectedLanguages[0].Score > 0.7);
+ Assert.Equal("English", result.DetectedLanguages[0].Name);
+ Assert.Equal("en", result.DetectedLanguages[0].Iso6391Name);
+ Assert.True(result.DetectedLanguages[0].Score > 0.7);
context.Stop();
}
}
@@ -79,12 +79,12 @@ public void DetectLanguage()
{
HttpMockServer.Initialize(this.GetType().FullName, "DetectLanguage");
ITextAnalyticsClient client = GetClient(HttpMockServer.CreateInstance());
- LanguageBatchResult result = client.DetectLanguage(
+ LanguageResult result = client.DetectLanguage(
"I love my team mates");
- Assert.Equal("English", result.Documents[0].DetectedLanguages[0].Name);
- Assert.Equal("en", result.Documents[0].DetectedLanguages[0].Iso6391Name);
- Assert.True(result.Documents[0].DetectedLanguages[0].Score > 0.7);
+ Assert.Equal("English", result.DetectedLanguages[0].Name);
+ Assert.Equal("en", result.DetectedLanguages[0].Iso6391Name);
+ Assert.True(result.DetectedLanguages[0].Score > 0.7);
context.Stop();
}
}
diff --git a/sdk/cognitiveservices/Language.TextAnalytics/tests/TextAnalytics/EntitiesTests.cs b/sdk/cognitiveservices/Language.TextAnalytics/tests/TextAnalytics/EntitiesTests.cs
index a0d1b3088d3d0..a19e8a6de62fc 100644
--- a/sdk/cognitiveservices/Language.TextAnalytics/tests/TextAnalytics/EntitiesTests.cs
+++ b/sdk/cognitiveservices/Language.TextAnalytics/tests/TextAnalytics/EntitiesTests.cs
@@ -45,14 +45,13 @@ public async Task EntitiesAsync()
{
HttpMockServer.Initialize(this.GetType().FullName, "EntitiesAsync");
ITextAnalyticsClient client = GetClient(HttpMockServer.CreateInstance());
- EntitiesBatchResult result = await client.EntitiesAsync(
- "Microsoft released Windows 10");
+ EntitiesResult result = await client.EntitiesAsync("Microsoft released Windows 10");
- Assert.Equal("Microsoft", result.Documents[0].Entities[0].Name);
- Assert.Equal("a093e9b9-90f5-a3d5-c4b8-5855e1b01f85", result.Documents[0].Entities[0].BingId);
- Assert.Equal("Microsoft", result.Documents[0].Entities[0].Matches[0].Text);
- Assert.Equal(0.12508682244047509, result.Documents[0].Entities[0].Matches[0].WikipediaScore);
- Assert.Equal(0.99999618530273438, result.Documents[0].Entities[0].Matches[0].EntityTypeScore);
+ Assert.Equal("Microsoft", result.Entities[0].Name);
+ Assert.Equal("a093e9b9-90f5-a3d5-c4b8-5855e1b01f85", result.Entities[0].BingId);
+ Assert.Equal("Microsoft", result.Entities[0].Matches[0].Text);
+ Assert.Equal(0.12508682244047509, result.Entities[0].Matches[0].WikipediaScore);
+ Assert.Equal(0.99999618530273438, result.Entities[0].Matches[0].EntityTypeScore);
context.Stop();
}
}
@@ -92,14 +91,13 @@ public void Entities()
{
HttpMockServer.Initialize(this.GetType().FullName, "Entities");
ITextAnalyticsClient client = GetClient(HttpMockServer.CreateInstance());
- EntitiesBatchResult result = client.Entities(
- "Microsoft released Windows 10");
+ EntitiesResult result = client.Entities("Microsoft released Windows 10");
- Assert.Equal("Microsoft", result.Documents[0].Entities[0].Name);
- Assert.Equal("a093e9b9-90f5-a3d5-c4b8-5855e1b01f85", result.Documents[0].Entities[0].BingId);
- Assert.Equal("Microsoft", result.Documents[0].Entities[0].Matches[0].Text);
- Assert.Equal(0.12508682244047509, result.Documents[0].Entities[0].Matches[0].WikipediaScore);
- Assert.Equal(0.99999618530273438, result.Documents[0].Entities[0].Matches[0].EntityTypeScore);
+ Assert.Equal("Microsoft", result.Entities[0].Name);
+ Assert.Equal("a093e9b9-90f5-a3d5-c4b8-5855e1b01f85", result.Entities[0].BingId);
+ Assert.Equal("Microsoft", result.Entities[0].Matches[0].Text);
+ Assert.Equal(0.12508682244047509, result.Entities[0].Matches[0].WikipediaScore);
+ Assert.Equal(0.99999618530273438, result.Entities[0].Matches[0].EntityTypeScore);
context.Stop();
}
}
diff --git a/sdk/cognitiveservices/Language.TextAnalytics/tests/TextAnalytics/KeyPhrasesTests.cs b/sdk/cognitiveservices/Language.TextAnalytics/tests/TextAnalytics/KeyPhrasesTests.cs
index 7e0c158cb36d1..91fb0b26d907c 100644
--- a/sdk/cognitiveservices/Language.TextAnalytics/tests/TextAnalytics/KeyPhrasesTests.cs
+++ b/sdk/cognitiveservices/Language.TextAnalytics/tests/TextAnalytics/KeyPhrasesTests.cs
@@ -43,10 +43,9 @@ public async Task KeyPhrasesAsync()
{
HttpMockServer.Initialize(this.GetType().FullName, "KeyPhrasesAsync");
ITextAnalyticsClient client = GetClient(HttpMockServer.CreateInstance());
- KeyPhraseBatchResult result = await client.KeyPhrasesAsync(
- "I love my team mates");
+ KeyPhraseResult result = await client.KeyPhrasesAsync("I love my team mates");
- Assert.Equal("team mates", result.Documents[0].KeyPhrases[0]);
+ Assert.Equal("team mates", result.KeyPhrases[0]);
}
}
@@ -80,10 +79,9 @@ public void KeyPhrases()
{
HttpMockServer.Initialize(this.GetType().FullName, "KeyPhrases");
ITextAnalyticsClient client = GetClient(HttpMockServer.CreateInstance());
- KeyPhraseBatchResult result = client.KeyPhrases(
- "I love my team mates");
+ KeyPhraseResult result = client.KeyPhrases("I love my team mates");
- Assert.Equal("team mates", result.Documents[0].KeyPhrases[0]);
+ Assert.Equal("team mates", result.KeyPhrases[0]);
}
}
diff --git a/sdk/cognitiveservices/Language.TextAnalytics/tests/TextAnalytics/SentimentTests.cs b/sdk/cognitiveservices/Language.TextAnalytics/tests/TextAnalytics/SentimentTests.cs
index 464f82262879b..8ee26de9fb40a 100644
--- a/sdk/cognitiveservices/Language.TextAnalytics/tests/TextAnalytics/SentimentTests.cs
+++ b/sdk/cognitiveservices/Language.TextAnalytics/tests/TextAnalytics/SentimentTests.cs
@@ -43,10 +43,9 @@ public async Task SentimentAsync()
{
HttpMockServer.Initialize(this.GetType().FullName, "SentimentAsync");
ITextAnalyticsClient client = GetClient(HttpMockServer.CreateInstance());
- SentimentBatchResult result = await client.SentimentAsync(
- "I love my team mates");
+ SentimentResult result = await client.SentimentAsync("I love my team mates");
- Assert.True(result.Documents[0].Score > 0);
+ Assert.True(result.Score > 0);
}
}
@@ -80,10 +79,9 @@ public void Sentiment()
{
HttpMockServer.Initialize(this.GetType().FullName, "Sentiment");
ITextAnalyticsClient client = GetClient(HttpMockServer.CreateInstance());
- SentimentBatchResult result = client.Sentiment(
- "I love my team mates");
+ SentimentResult result = client.Sentiment("I love my team mates");
- Assert.True(result.Documents[0].Score > 0);
+ Assert.True(result.Score > 0);
}
}
}