Skip to content

Commit

Permalink
Users/laramume/tav2.1 (Azure#5284)
Browse files Browse the repository at this point in the history
* # This is a combination of 5 commits.
parent e68ceb4
author Lakshmanan Ramu Meenal <laramume@microsoft.com> 1539635490 -0700
committer Lakshmanan Ramu Meenal <laramume@microsoft.com> 1551313811 -0800

# This is a combination of 2 commits.
# This is the 1st commit message:

added 2.1 preview SDK for text analytics

based on PR commanets changed the number of SDK's to one

# This is the commit message Azure#1:

fixed test project errors

# This is the commit message Azure#2:

fixed test project errors

# This is the commit message Azure#3:

fixed test project errors

# This is the commit message Azure#4:

fixed the log errors

* changed the version name and package notes

* # This is a combination of 5 commits.
# This is the 1st commit message:

added SDK for version 2.1

# This is the commit message Azure#1:

resolved build failure

# This is the commit message Azure#2:

resolved build failure

# This is the commit message Azure#3:

resolved build failure

# This is the commit message Azure#4:

resolved build failure

* added SDK for version 2.1

* changed version number to 3.0.0

* updated assemblyfileversion
  • Loading branch information
laramume authored and mentat9 committed Jun 10, 2019
1 parent b859d89 commit a804e26
Show file tree
Hide file tree
Showing 30 changed files with 595 additions and 282 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public abstract class BaseTests
{
public static bool IsTestTenant = false;
// BaseEndpoint only contains protocol and hostname
private static string BaseEndpoint = "https://westus.api.cognitive.microsoft.com";
private static string BaseEndpoint = "https://westcentralus.api.cognitive.microsoft.com";
private static string SubscriptionKey = "000";

protected ITextAnalyticsClient GetClient(DelegatingHandler handler)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"Entries": [
{
"RequestUri": "/text/analytics/v2.1-preview/languages",
"EncodedRequestUri": "L3RleHQvYW5hbHl0aWNzL3YyLjEtcHJldmlldy9sYW5ndWFnZXM=",
"RequestUri": "/text/analytics/v2.1/languages",
"EncodedRequestUri": "L3RleHQvYW5hbHl0aWNzL3YyLjEvbGFuZ3VhZ2Vz",
"RequestMethod": "POST",
"RequestBody": "{\r\n \"documents\": [\r\n {\r\n \"id\": \"id\",\r\n \"text\": \"I love my team mates\"\r\n }\r\n ]\r\n}",
"RequestHeaders": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"Entries": [
{
"RequestUri": "/text/analytics/v2.1-preview/entities",
"EncodedRequestUri": "L3RleHQvYW5hbHl0aWNzL3YyLjEtcHJldmlldy9lbnRpdGllcw==",
"RequestUri": "/text/analytics/v2.1/entities",
"EncodedRequestUri": "L3RleHQvYW5hbHl0aWNzL3YyLjEvZW50aXRpZXM=",
"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": {
Expand All @@ -20,7 +20,7 @@
"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}",
"ResponseBody": "{\"documents\":[{\"id\":\"id\",\"entities\":[{\"name\":\"Microsoft\",\"matches\":[{\"wikipediaScore\":0.12508682244047509,\"entityTypeScore\":0.99999618530273438,\"text\":\"Microsoft\",\"offset\":0,\"length\":9}],\"wikipediaLanguage\":\"en\",\"wikipediaId\":\"Microsoft\",\"wikipediaUrl\":\"https://en.wikipedia.org/wiki/Microsoft\",\"bingId\":\"a093e9b9-90f5-a3d5-c4b8-5855e1b01f85\",\"type\":\"Organization\"},{\"name\":\"Windows 10\",\"matches\":[{\"wikipediaScore\":0.35750355694656766,\"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\"}]}\r\n ],\r\n \"errors\":[]\r\n}",
"ResponseHeaders": {
"Content-Type": [
"application/json; charset=utf-8"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"Entries": [
{
"RequestUri": "/text/analytics/v2.1-preview/keyPhrases",
"EncodedRequestUri": "L3RleHQvYW5hbHl0aWNzL3YyLjEtcHJldmlldy9rZXlQaHJhc2Vz",
"RequestUri": "/text/analytics/v2.1/keyPhrases",
"EncodedRequestUri": "L3RleHQvYW5hbHl0aWNzL3YyLjEva2V5UGhyYXNlcw==",
"RequestMethod": "POST",
"RequestBody": "{\r\n \"documents\": [\r\n {\r\n \"language\": \"en\",\r\n \"id\": \"id\",\r\n \"text\": \"I love my team mates\"\r\n }\r\n ]\r\n}",
"RequestHeaders": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"Entries": [
{
"RequestUri": "/text/analytics/v2.1-preview/sentiment",
"EncodedRequestUri": "L3RleHQvYW5hbHl0aWNzL3YyLjEtcHJldmlldy9zZW50aW1lbnQ=",
"RequestUri": "/text/analytics/v2.1/sentiment",
"EncodedRequestUri": "L3RleHQvYW5hbHl0aWNzL3YyLjEvc2VudGltZW50",
"RequestMethod": "POST",
"RequestBody": "{\r\n \"documents\": [\r\n {\r\n \"language\": \"en\",\r\n \"id\": \"id\",\r\n \"text\": \"I love my team mates\"\r\n }\r\n ]\r\n}",
"RequestHeaders": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ public async Task DetectLanguage()
HttpMockServer.Initialize(this.GetType().FullName, "DetectLanguage");
ITextAnalyticsClient client = GetClient(HttpMockServer.CreateInstance());
LanguageBatchResult result = await client.DetectLanguageAsync(
new BatchInput(
new List<Input>()
null,
new LanguageBatchInput(
new List<LanguageInput>()
{
new Input("id","I love my team mates")
new LanguageInput("en","id","I love my team mates")
}));

Assert.Equal("English", result.Documents[0].DetectedLanguages[0].Name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ public async Task Entities()
{
HttpMockServer.Initialize(this.GetType().FullName, "Entities");
ITextAnalyticsClient client = GetClient(HttpMockServer.CreateInstance());
EntitiesBatchResultV2dot1 result = await client.EntitiesAsync(
EntitiesBatchResult result = await client.EntitiesAsync(
null,
new MultiLanguageBatchInput(
new List<MultiLanguageInput>()
{
Expand All @@ -29,8 +30,11 @@ public async Task Entities()
}
}));

Assert.Equal("Windows 10", result.Documents[0].Entities[0].Name);
Assert.Equal("5f9fbd03-49c4-39ef-cc95-de83ab897b94", result.Documents[0].Entities[0].BingId);
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);
context.Stop();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public async Task KeyPhrases()
HttpMockServer.Initialize(this.GetType().FullName, "KeyPhrases");
ITextAnalyticsClient client = GetClient(HttpMockServer.CreateInstance());
KeyPhraseBatchResult result = await client.KeyPhrasesAsync(
null,
new MultiLanguageBatchInput(
new List<MultiLanguageInput>()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public async Task Sentiment()
HttpMockServer.Initialize(this.GetType().FullName, "Sentiment");
ITextAnalyticsClient client = GetClient(HttpMockServer.CreateInstance());
SentimentBatchResult result = await client.SentimentAsync(
null,
new MultiLanguageBatchInput(
new List<MultiLanguageInput>()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,36 +58,44 @@ public partial interface ITextAnalyticsClient : System.IDisposable


/// <summary>
/// The API returns a list of strings denoting the key talking points
/// in the input text.
/// The API returns the detected language and a numeric score between 0
/// and 1.
/// </summary>
/// <remarks>
/// See the &lt;a
/// href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages"&gt;Text
/// Analytics Documentation&lt;/a&gt; for details about the languages
/// that are supported by key phrase extraction.
/// Scores close to 1 indicate 100% certainty that the identified
/// language is true. A total of 120 languages are supported.
/// </remarks>
/// <param name='input'>
/// Collection of documents to analyze. Documents can now contain a
/// language field to indicate the text language
/// <param name='showStats'>
/// (optional) if set to true, response will contain input and document
/// level statistics.
/// </param>
/// <param name='languageBatchInput'>
/// Collection of documents to analyze.
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
Task<HttpOperationResponse<KeyPhraseBatchResult>> KeyPhrasesWithHttpMessagesAsync(MultiLanguageBatchInput input, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
Task<HttpOperationResponse<LanguageBatchResult>> DetectLanguageWithHttpMessagesAsync(bool? showStats = default(bool?), LanguageBatchInput languageBatchInput = default(LanguageBatchInput), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));

/// <summary>
/// The API returns the detected language and a numeric score between 0
/// and 1.
/// The API returns a list of recognized entities in a given document.
/// </summary>
/// <remarks>
/// Scores close to 1 indicate 100% certainty that the identified
/// language is true. A total of 120 languages are supported.
/// 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 &lt;a
/// href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/text-analytics-supported-languages"&gt;Supported
/// languages in Text Analytics API&lt;/a&gt; for the list of enabled
/// languages.
/// </remarks>
/// <param name='input'>
/// <param name='showStats'>
/// (optional) if set to true, response will contain input and document
/// level statistics.
/// </param>
/// <param name='multiLanguageBatchInput'>
/// Collection of documents to analyze.
/// </param>
/// <param name='customHeaders'>
Expand All @@ -96,56 +104,50 @@ public partial interface ITextAnalyticsClient : System.IDisposable
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
Task<HttpOperationResponse<LanguageBatchResult>> DetectLanguageWithHttpMessagesAsync(BatchInput input, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
Task<HttpOperationResponse<EntitiesBatchResult>> EntitiesWithHttpMessagesAsync(bool? showStats = default(bool?), MultiLanguageBatchInput multiLanguageBatchInput = default(MultiLanguageBatchInput), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));

/// <summary>
/// The API returns a numeric score between 0 and 1.
/// The API returns a list of strings denoting the key talking points
/// in the input text.
/// </summary>
/// <remarks>
/// Scores close to 1 indicate positive sentiment, while scores close
/// to 0 indicate negative sentiment. A score of 0.5 indicates the lack
/// of sentiment (e.g. a factoid statement). See the &lt;a
/// See the &lt;a
/// href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages"&gt;Text
/// Analytics Documentation&lt;/a&gt; for details about the languages
/// that are supported by sentiment analysis.
/// that are supported by key phrase extraction.
/// </remarks>
/// <param name='input'>
/// Collection of documents to analyze.
/// <param name='showStats'>
/// (optional) if set to true, response will contain input and document
/// level statistics.
/// </param>
/// <param name='multiLanguageBatchInput'>
/// Collection of documents to analyze. Documents can now contain a
/// language field to indicate the text language
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
Task<HttpOperationResponse<SentimentBatchResult>> SentimentWithHttpMessagesAsync(MultiLanguageBatchInput input, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
Task<HttpOperationResponse<KeyPhraseBatchResult>> KeyPhrasesWithHttpMessagesAsync(bool? showStats = default(bool?), MultiLanguageBatchInput multiLanguageBatchInput = default(MultiLanguageBatchInput), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));

/// <summary>
/// The API returns a list of recognized entities in a given document.
/// The API returns a numeric score between 0 and 1.
/// </summary>
/// <remarks>
/// 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 &lt;a
/// href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/text-analytics-supported-languages"&gt;Supported
/// languages in Text Analytics API&lt;/a&gt; for the list of enabled
/// languages.The API returns a list of known entities and general
/// named entities ("Person", "Location", "Organization" etc) in a
/// given document. Known entities are returned with Wikipedia Id and
/// Wikipedia link, and also Bing Id which can be used in Bing Entity
/// Search API. General named entities are returned with entity types.
/// If a general named entity is also a known entity, then all
/// information regarding it (Wikipedia Id, Bing Id, entity type etc)
/// will be returned. See the &lt;a
/// href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/how-tos/text-analytics-how-to-entity-linking#supported-types-for-named-entity-recognition"&gt;Supported
/// Entity Types in Text Analytics API&lt;/a&gt; for the list of
/// supported Entity Types. See the &lt;a
/// href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/text-analytics-supported-languages"&gt;Supported
/// languages in Text Analytics API&lt;/a&gt; for the list of enabled
/// languages.
/// Scores close to 1 indicate positive sentiment, while scores close
/// to 0 indicate negative sentiment. A score of 0.5 indicates the lack
/// of sentiment (e.g. a factoid statement). See the &lt;a
/// href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages"&gt;Text
/// Analytics Documentation&lt;/a&gt; for details about the languages
/// that are supported by sentiment analysis.
/// </remarks>
/// <param name='input'>
/// <param name='showStats'>
/// (optional) if set to true, response will contain input and document
/// level statistics.
/// </param>
/// <param name='multiLanguageBatchInput'>
/// Collection of documents to analyze.
/// </param>
/// <param name='customHeaders'>
Expand All @@ -154,7 +156,7 @@ public partial interface ITextAnalyticsClient : System.IDisposable
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
Task<HttpOperationResponse<EntitiesBatchResultV2dot1>> EntitiesWithHttpMessagesAsync(MultiLanguageBatchInput input, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
Task<HttpOperationResponse<SentimentBatchResult>> SentimentWithHttpMessagesAsync(bool? showStats = default(bool?), MultiLanguageBatchInput multiLanguageBatchInput = default(MultiLanguageBatchInput), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// <auto-generated>
// 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.
// </auto-generated>

namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models
{
using Newtonsoft.Json;
using System.Linq;

public partial class DocumentStatistics
{
/// <summary>
/// Initializes a new instance of the DocumentStatistics class.
/// </summary>
public DocumentStatistics()
{
CustomInit();
}

/// <summary>
/// Initializes a new instance of the DocumentStatistics class.
/// </summary>
/// <param name="charactersCount">Number of text elements recognized in
/// the document.</param>
/// <param name="transactionsCount">Number of transactions for the
/// document.</param>
public DocumentStatistics(int? charactersCount = default(int?), int? transactionsCount = default(int?))
{
CharactersCount = charactersCount;
TransactionsCount = transactionsCount;
CustomInit();
}

/// <summary>
/// An initialization method that performs custom operations like setting defaults
/// </summary>
partial void CustomInit();

/// <summary>
/// Gets or sets number of text elements recognized in the document.
/// </summary>
[JsonProperty(PropertyName = "charactersCount")]
public int? CharactersCount { get; set; }

/// <summary>
/// Gets or sets number of transactions for the document.
/// </summary>
[JsonProperty(PropertyName = "transactionsCount")]
public int? TransactionsCount { get; set; }

}
}
Loading

0 comments on commit a804e26

Please sign in to comment.