Skip to content

Commit

Permalink
# This is a combination of 5 commits.
Browse files Browse the repository at this point in the history
# This is the 1st commit message:

added SDK for version 2.1

# This is the commit message #1:

resolved build failure

# This is the commit message #2:

resolved build failure

# This is the commit message #3:

resolved build failure

# This is the commit message #4:

resolved build failure
  • Loading branch information
laramume committed Feb 28, 2019
1 parent 9913764 commit 886306d
Show file tree
Hide file tree
Showing 25 changed files with 605 additions and 280 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
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>()
true,
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(
true,
new MultiLanguageBatchInput(
new List<MultiLanguageInput>()
{
Expand All @@ -31,6 +32,9 @@ 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].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(
true,
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(
true,
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; }

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,29 @@ namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models
using System.Collections.Generic;
using System.Linq;

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

/// <summary>
/// Initializes a new instance of the EntitiesBatchResultV2dot1 class.
/// Initializes a new instance of the EntitiesBatchResult class.
/// </summary>
public EntitiesBatchResultV2dot1(IList<EntitiesBatchResultItemV2dot1> documents = default(IList<EntitiesBatchResultItemV2dot1>), IList<ErrorRecord> errors = default(IList<ErrorRecord>))
/// <param name="documents">Response by document</param>
/// <param name="errors">Errors and Warnings by document</param>
/// <param name="statistics">(Optional) if showStats=true was specified
/// in the request this field will contain information about the
/// request payload.</param>
public EntitiesBatchResult(IList<EntitiesBatchResultItem> documents = default(IList<EntitiesBatchResultItem>), IList<ErrorRecord> errors = default(IList<ErrorRecord>), RequestStatistics statistics = default(RequestStatistics))
{
Documents = documents;
Errors = errors;
Statistics = statistics;
CustomInit();
}

Expand All @@ -41,14 +47,23 @@ public EntitiesBatchResultV2dot1()
partial void CustomInit();

/// <summary>
/// Gets response by document
/// </summary>
[JsonProperty(PropertyName = "documents")]
public IList<EntitiesBatchResultItemV2dot1> Documents { get; private set; }
public IList<EntitiesBatchResultItem> Documents { get; private set; }

/// <summary>
/// Gets errors and Warnings by document
/// </summary>
[JsonProperty(PropertyName = "errors")]
public IList<ErrorRecord> Errors { get; private set; }

/// <summary>
/// Gets (Optional) if showStats=true was specified in the request this
/// field will contain information about the request payload.
/// </summary>
[JsonProperty(PropertyName = "statistics")]
public RequestStatistics Statistics { get; private set; }

}
}
Loading

0 comments on commit 886306d

Please sign in to comment.