diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/CHANGELOG.md b/sdk/textanalytics/Azure.AI.TextAnalytics/CHANGELOG.md index 2367ea7c6ff6..85ca32d980ea 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/CHANGELOG.md +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/CHANGELOG.md @@ -8,6 +8,7 @@ - Support added for Opinion Mining. This feature is available in the Text Analytics service v3.1-preview.1 and above. - Added `Offset` and `Length` properties for `CategorizedEntity`, `SentenceSentiment`, and `LinkedEntityMatch`. The default encoding is UTF-16 code units. For additional information see https://aka.ms/text-analytics-offsets - `TextAnalyticsError` and `TextAnalyticsWarning` now are marked as immutable. +- Added property `BingEntitySearchApiId` to the `LinkedEntity` class. This property is only available for v3.1-preview.2 and up, and it is to be used in conjunction with the Bing Entity Search API to fetch additional relevant information about the returned entity. ## 5.0.0 (2020-07-27) - Re-release of version `1.0.1` with updated version `5.0.0`. diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/api/Azure.AI.TextAnalytics.netstandard2.0.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/api/Azure.AI.TextAnalytics.netstandard2.0.cs index be7a68e8e6c5..58d4a7371188 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/api/Azure.AI.TextAnalytics.netstandard2.0.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/api/Azure.AI.TextAnalytics.netstandard2.0.cs @@ -136,6 +136,7 @@ public readonly partial struct LinkedEntity { private readonly object _dummy; private readonly int _dummyPrimitive; + public string BingEntitySearchApiId { get { throw null; } } public string DataSource { get { throw null; } } public string DataSourceEntityId { get { throw null; } } public string Language { get { throw null; } } @@ -349,7 +350,9 @@ public static partial class TextAnalyticsModelFactory public static Azure.AI.TextAnalytics.ExtractKeyPhrasesResult ExtractKeyPhrasesResult(string id, Azure.AI.TextAnalytics.TextDocumentStatistics statistics, Azure.AI.TextAnalytics.KeyPhraseCollection keyPhrases) { throw null; } public static Azure.AI.TextAnalytics.ExtractKeyPhrasesResultCollection ExtractKeyPhrasesResultCollection(System.Collections.Generic.IEnumerable list, Azure.AI.TextAnalytics.TextDocumentBatchStatistics statistics, string modelVersion) { throw null; } public static Azure.AI.TextAnalytics.KeyPhraseCollection KeyPhraseCollection(System.Collections.Generic.IList keyPhrases, System.Collections.Generic.IList warnings = null) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public static Azure.AI.TextAnalytics.LinkedEntity LinkedEntity(string name, string dataSourceEntityId, string language, string dataSource, System.Uri url, System.Collections.Generic.IEnumerable matches) { throw null; } + public static Azure.AI.TextAnalytics.LinkedEntity LinkedEntity(string name, string dataSourceEntityId, string language, string dataSource, System.Uri url, System.Collections.Generic.IEnumerable matches, string bingEntitySearchApiId) { throw null; } public static Azure.AI.TextAnalytics.LinkedEntityCollection LinkedEntityCollection(System.Collections.Generic.IList entities, System.Collections.Generic.IList warnings = null) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public static Azure.AI.TextAnalytics.LinkedEntityMatch LinkedEntityMatch(string text, double score) { throw null; } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LinkedEntity.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LinkedEntity.Serialization.cs index 0ccd8d4e9d29..952b14eaecbd 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LinkedEntity.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LinkedEntity.Serialization.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; using Azure.Core; @@ -19,7 +20,7 @@ internal static LinkedEntity DeserializeLinkedEntity(JsonElement element) IEnumerable matches = default; string language = default; Optional id = default; - string url = default; + Uri url = default; string dataSource = default; Optional bingId = default; foreach (var property in element.EnumerateObject()) @@ -51,7 +52,7 @@ internal static LinkedEntity DeserializeLinkedEntity(JsonElement element) } if (property.NameEquals("url")) { - url = property.Value.GetString(); + url = new Uri(property.Value.GetString()); continue; } if (property.NameEquals("dataSource")) diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/LinkedEntity.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/LinkedEntity.cs index f74744d9c861..3b79cd09b802 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/LinkedEntity.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/LinkedEntity.cs @@ -16,22 +16,15 @@ namespace Azure.AI.TextAnalytics [CodeGenModel("LinkedEntity")] public readonly partial struct LinkedEntity { - /// - /// Gets the URL that identifies the linked entity's entry in the data source. - /// - [CodeGenMember("Url")] - private string _url { get; } - - internal LinkedEntity(string name, IEnumerable matches, string language, string dataSourceEntityId, string url, string dataSource, string bingId) + internal LinkedEntity(string name, IEnumerable matches, string language, string dataSourceEntityId, Uri url, string dataSource, string bingEntitySearchApiId) { Name = name; DataSourceEntityId = dataSourceEntityId; Language = language; DataSource = dataSource; - _url = url; - Url = new Uri(url); + Url = url; Matches = matches; - BingId = bingId; + BingEntitySearchApiId = bingEntitySearchApiId; } /// @@ -58,6 +51,7 @@ internal LinkedEntity(string name, IEnumerable matches, strin /// /// Gets the URL that identifies the linked entity's entry in the data source. /// + [CodeGenMember("Url")] public Uri Url { get; } /// @@ -66,7 +60,11 @@ internal LinkedEntity(string name, IEnumerable matches, strin /// public IEnumerable Matches { get; } - /// Bing unique identifier of the recognized entity. Use in conjunction with the Bing Entity Search API to fetch additional relevant information. - private string BingId { get; } + /// Bing Entity Search API unique identifier of the recognized entity. + /// Use in conjunction with the Bing Entity Search API to fetch additional relevant information. + /// This property is only available for v3.1-preview.2 and up. + /// + [CodeGenMember("BingId")] + public string BingEntitySearchApiId { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/TextAnalyticsModelFactory.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/TextAnalyticsModelFactory.cs index 69f95780c000..d007f5e6432c 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/TextAnalyticsModelFactory.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/TextAnalyticsModelFactory.cs @@ -397,9 +397,26 @@ public static ExtractKeyPhrasesResultCollection ExtractKeyPhrasesResultCollectio /// Sets the property. /// Sets the property. /// A new instance of for mocking purposes. + [EditorBrowsable(EditorBrowsableState.Never)] public static LinkedEntity LinkedEntity(string name, string dataSourceEntityId, string language, string dataSource, Uri url, IEnumerable matches) { - return new LinkedEntity(name, matches, language, dataSourceEntityId, url.AbsoluteUri, dataSource, default); + return new LinkedEntity(name, matches, language, dataSourceEntityId, url, dataSource, default); + } + + /// + /// Initializes a new instance of for mocking purposes. + /// + /// Sets the property. + /// Sets the property. + /// Sets the property. + /// Sets the property. + /// Sets the property. + /// Sets the property. + /// Sets the property. + /// A new instance of for mocking purposes. + public static LinkedEntity LinkedEntity(string name, string dataSourceEntityId, string language, string dataSource, Uri url, IEnumerable matches, string bingEntitySearchApiId) + { + return new LinkedEntity(name, matches, language, dataSourceEntityId, url, dataSource, bingEntitySearchApiId); } /// diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/RecognizeLinkedEntitiesTests.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/RecognizeLinkedEntitiesTests.cs index ad4dbca25195..db099076daeb 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/RecognizeLinkedEntitiesTests.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/RecognizeLinkedEntitiesTests.cs @@ -53,6 +53,7 @@ public async Task RecognizeLinkedEntitiesTest() Assert.IsNotNull(entity.Language); Assert.IsNotNull(entity.Url); Assert.IsNotNull(entity.Matches); + Assert.IsNotNull(entity.BingEntitySearchApiId); LinkedEntityMatch match = entity.Matches.First(); Assert.IsNotNull(match.ConfidenceScore);