From c606cc70b81af557bcb9393f8856c67452b94ff7 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 22 Feb 2019 10:42:27 -0800 Subject: [PATCH] [AutoPR cognitiveservices/data-plane/TextAnalytics] Users/laramume/addv2.1 swagger (#4073) * Generated from 331f6c0edfc37987212f6b0225f8a43f9d170f1f added v2.1 swagger * Generated from dc4e4938a9cd32fb0ac32ec42cd343c966e1e8c9 added v2.1 swagger * Generated from 53ebd5722c6775bfb96190b1246d93921ac7a8c2 resolved PR comments --- .../cognitiveservices/textanalytics/models.go | 15 +- .../cognitiveservices/textanalytics/models.go | 15 +- .../v2.1/textanalytics/client.go | 113 +++++++++------ .../v2.1/textanalytics/models.go | 134 ++++++++++++------ .../textanalyticsapi/interfaces.go | 8 +- .../v2.1/textanalytics/version.go | 2 +- 6 files changed, 189 insertions(+), 98 deletions(-) diff --git a/profiles/latest/cognitiveservices/textanalytics/models.go b/profiles/latest/cognitiveservices/textanalytics/models.go index 1035a0769644..27f372d77bc9 100644 --- a/profiles/latest/cognitiveservices/textanalytics/models.go +++ b/profiles/latest/cognitiveservices/textanalytics/models.go @@ -22,24 +22,27 @@ package textanalytics import original "github.com/Azure/azure-sdk-for-go/services/cognitiveservices/v2.1/textanalytics" type BaseClient = original.BaseClient -type BatchInput = original.BatchInput type DetectedLanguage = original.DetectedLanguage -type EntitiesBatchResultItemV2dot1 = original.EntitiesBatchResultItemV2dot1 -type EntitiesBatchResultV2dot1 = original.EntitiesBatchResultV2dot1 -type EntityRecordV2dot1 = original.EntityRecordV2dot1 +type DocumentStatistics = original.DocumentStatistics +type EntitiesBatchResult = original.EntitiesBatchResult +type EntitiesBatchResultItem = original.EntitiesBatchResultItem +type EntityRecord = original.EntityRecord type ErrorRecord = original.ErrorRecord type ErrorResponse = original.ErrorResponse -type Input = original.Input type InternalError = original.InternalError type KeyPhraseBatchResult = original.KeyPhraseBatchResult type KeyPhraseBatchResultItem = original.KeyPhraseBatchResultItem +type LanguageBatchInput = original.LanguageBatchInput type LanguageBatchResult = original.LanguageBatchResult type LanguageBatchResultItem = original.LanguageBatchResultItem -type MatchRecordV2dot1 = original.MatchRecordV2dot1 +type LanguageInput = original.LanguageInput +type MatchRecord = original.MatchRecord type MultiLanguageBatchInput = original.MultiLanguageBatchInput type MultiLanguageInput = original.MultiLanguageInput +type RequestStatistics = original.RequestStatistics type SentimentBatchResult = original.SentimentBatchResult type SentimentBatchResultItem = original.SentimentBatchResultItem +type SetObject = original.SetObject func New(endpoint string) BaseClient { return original.New(endpoint) diff --git a/profiles/preview/cognitiveservices/textanalytics/models.go b/profiles/preview/cognitiveservices/textanalytics/models.go index 9b866f911f96..70f7b6365f7d 100644 --- a/profiles/preview/cognitiveservices/textanalytics/models.go +++ b/profiles/preview/cognitiveservices/textanalytics/models.go @@ -22,24 +22,27 @@ package textanalytics import original "github.com/Azure/azure-sdk-for-go/services/cognitiveservices/v2.1/textanalytics" type BaseClient = original.BaseClient -type BatchInput = original.BatchInput type DetectedLanguage = original.DetectedLanguage -type EntitiesBatchResultItemV2dot1 = original.EntitiesBatchResultItemV2dot1 -type EntitiesBatchResultV2dot1 = original.EntitiesBatchResultV2dot1 -type EntityRecordV2dot1 = original.EntityRecordV2dot1 +type DocumentStatistics = original.DocumentStatistics +type EntitiesBatchResult = original.EntitiesBatchResult +type EntitiesBatchResultItem = original.EntitiesBatchResultItem +type EntityRecord = original.EntityRecord type ErrorRecord = original.ErrorRecord type ErrorResponse = original.ErrorResponse -type Input = original.Input type InternalError = original.InternalError type KeyPhraseBatchResult = original.KeyPhraseBatchResult type KeyPhraseBatchResultItem = original.KeyPhraseBatchResultItem +type LanguageBatchInput = original.LanguageBatchInput type LanguageBatchResult = original.LanguageBatchResult type LanguageBatchResultItem = original.LanguageBatchResultItem -type MatchRecordV2dot1 = original.MatchRecordV2dot1 +type LanguageInput = original.LanguageInput +type MatchRecord = original.MatchRecord type MultiLanguageBatchInput = original.MultiLanguageBatchInput type MultiLanguageInput = original.MultiLanguageInput +type RequestStatistics = original.RequestStatistics type SentimentBatchResult = original.SentimentBatchResult type SentimentBatchResultItem = original.SentimentBatchResultItem +type SetObject = original.SetObject func New(endpoint string) BaseClient { return original.New(endpoint) diff --git a/services/cognitiveservices/v2.1/textanalytics/client.go b/services/cognitiveservices/v2.1/textanalytics/client.go index 0cad64858681..e7a760d4a212 100644 --- a/services/cognitiveservices/v2.1/textanalytics/client.go +++ b/services/cognitiveservices/v2.1/textanalytics/client.go @@ -1,4 +1,4 @@ -// Package textanalytics implements the Azure ARM Textanalytics service API version v2.1-preview. +// Package textanalytics implements the Azure ARM Textanalytics service API version v2.1. // // The Text Analytics API is a suite of text analytics web services built with best-in-class Microsoft machine learning // algorithms. The API can be used to analyze unstructured text for tasks such as sentiment analysis, key phrase @@ -54,8 +54,9 @@ func NewWithoutDefaults(endpoint string) BaseClient { // DetectLanguage scores close to 1 indicate 100% certainty that the identified language is true. A total of 120 // languages are supported. // Parameters: -// input - collection of documents to analyze. -func (client BaseClient) DetectLanguage(ctx context.Context, input BatchInput) (result LanguageBatchResult, err error) { +// showStats - (optional) if set to true, response will contain input and document level statistics. +// languageBatchInput - collection of documents to analyze. +func (client BaseClient) DetectLanguage(ctx context.Context, showStats *bool, languageBatchInput *LanguageBatchInput) (result LanguageBatchResult, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.DetectLanguage") defer func() { @@ -66,7 +67,7 @@ func (client BaseClient) DetectLanguage(ctx context.Context, input BatchInput) ( tracing.EndSpan(ctx, sc, err) }() } - req, err := client.DetectLanguagePreparer(ctx, input) + req, err := client.DetectLanguagePreparer(ctx, showStats, languageBatchInput) if err != nil { err = autorest.NewErrorWithError(err, "textanalytics.BaseClient", "DetectLanguage", nil, "Failure preparing request") return @@ -88,17 +89,26 @@ func (client BaseClient) DetectLanguage(ctx context.Context, input BatchInput) ( } // DetectLanguagePreparer prepares the DetectLanguage request. -func (client BaseClient) DetectLanguagePreparer(ctx context.Context, input BatchInput) (*http.Request, error) { +func (client BaseClient) DetectLanguagePreparer(ctx context.Context, showStats *bool, languageBatchInput *LanguageBatchInput) (*http.Request, error) { urlParameters := map[string]interface{}{ "Endpoint": client.Endpoint, } + queryParameters := map[string]interface{}{} + if showStats != nil { + queryParameters["showStats"] = autorest.Encode("query", *showStats) + } + preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPost(), - autorest.WithCustomBaseURL("{Endpoint}/text/analytics/v2.1-preview", urlParameters), + autorest.WithCustomBaseURL("{Endpoint}/text/analytics/v2.1", urlParameters), autorest.WithPath("/languages"), - autorest.WithJSON(input)) + autorest.WithQueryParameters(queryParameters)) + if languageBatchInput != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(languageBatchInput)) + } return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -122,22 +132,14 @@ func (client BaseClient) DetectLanguageResponder(resp *http.Response) (result La return } -// Entities 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 Supported -// languages in Text Analytics API 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 Supported -// Entity Types in Text Analytics API for the list of supported Entity Types. See the Supported // languages in Text Analytics API for the list of enabled languages. // Parameters: -// input - collection of documents to analyze. -func (client BaseClient) Entities(ctx context.Context, input MultiLanguageBatchInput) (result EntitiesBatchResultV2dot1, err error) { +// showStats - (optional) if set to true, response will contain input and document level statistics. +// multiLanguageBatchInput - collection of documents to analyze. +func (client BaseClient) Entities(ctx context.Context, showStats *bool, multiLanguageBatchInput *MultiLanguageBatchInput) (result EntitiesBatchResult, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.Entities") defer func() { @@ -148,7 +150,7 @@ func (client BaseClient) Entities(ctx context.Context, input MultiLanguageBatchI tracing.EndSpan(ctx, sc, err) }() } - req, err := client.EntitiesPreparer(ctx, input) + req, err := client.EntitiesPreparer(ctx, showStats, multiLanguageBatchInput) if err != nil { err = autorest.NewErrorWithError(err, "textanalytics.BaseClient", "Entities", nil, "Failure preparing request") return @@ -170,17 +172,26 @@ func (client BaseClient) Entities(ctx context.Context, input MultiLanguageBatchI } // EntitiesPreparer prepares the Entities request. -func (client BaseClient) EntitiesPreparer(ctx context.Context, input MultiLanguageBatchInput) (*http.Request, error) { +func (client BaseClient) EntitiesPreparer(ctx context.Context, showStats *bool, multiLanguageBatchInput *MultiLanguageBatchInput) (*http.Request, error) { urlParameters := map[string]interface{}{ "Endpoint": client.Endpoint, } + queryParameters := map[string]interface{}{} + if showStats != nil { + queryParameters["showStats"] = autorest.Encode("query", *showStats) + } + preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPost(), - autorest.WithCustomBaseURL("{Endpoint}/text/analytics/v2.1-preview", urlParameters), + autorest.WithCustomBaseURL("{Endpoint}/text/analytics/v2.1", urlParameters), autorest.WithPath("/entities"), - autorest.WithJSON(input)) + autorest.WithQueryParameters(queryParameters)) + if multiLanguageBatchInput != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(multiLanguageBatchInput)) + } return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -193,7 +204,7 @@ func (client BaseClient) EntitiesSender(req *http.Request) (*http.Response, erro // EntitiesResponder handles the response to the Entities request. The method always // closes the http.Response Body. -func (client BaseClient) EntitiesResponder(resp *http.Response) (result EntitiesBatchResultV2dot1, err error) { +func (client BaseClient) EntitiesResponder(resp *http.Response) (result EntitiesBatchResult, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -208,9 +219,10 @@ func (client BaseClient) EntitiesResponder(resp *http.Response) (result Entities // href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text // Analytics Documentation for details about the languages that are supported by key phrase extraction. // Parameters: -// input - collection of documents to analyze. Documents can now contain a language field to indicate the text -// language -func (client BaseClient) KeyPhrases(ctx context.Context, input MultiLanguageBatchInput) (result KeyPhraseBatchResult, err error) { +// showStats - (optional) if set to true, response will contain input and document level statistics. +// multiLanguageBatchInput - collection of documents to analyze. Documents can now contain a language field to +// indicate the text language +func (client BaseClient) KeyPhrases(ctx context.Context, showStats *bool, multiLanguageBatchInput *MultiLanguageBatchInput) (result KeyPhraseBatchResult, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.KeyPhrases") defer func() { @@ -221,7 +233,7 @@ func (client BaseClient) KeyPhrases(ctx context.Context, input MultiLanguageBatc tracing.EndSpan(ctx, sc, err) }() } - req, err := client.KeyPhrasesPreparer(ctx, input) + req, err := client.KeyPhrasesPreparer(ctx, showStats, multiLanguageBatchInput) if err != nil { err = autorest.NewErrorWithError(err, "textanalytics.BaseClient", "KeyPhrases", nil, "Failure preparing request") return @@ -243,17 +255,26 @@ func (client BaseClient) KeyPhrases(ctx context.Context, input MultiLanguageBatc } // KeyPhrasesPreparer prepares the KeyPhrases request. -func (client BaseClient) KeyPhrasesPreparer(ctx context.Context, input MultiLanguageBatchInput) (*http.Request, error) { +func (client BaseClient) KeyPhrasesPreparer(ctx context.Context, showStats *bool, multiLanguageBatchInput *MultiLanguageBatchInput) (*http.Request, error) { urlParameters := map[string]interface{}{ "Endpoint": client.Endpoint, } + queryParameters := map[string]interface{}{} + if showStats != nil { + queryParameters["showStats"] = autorest.Encode("query", *showStats) + } + preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPost(), - autorest.WithCustomBaseURL("{Endpoint}/text/analytics/v2.1-preview", urlParameters), + autorest.WithCustomBaseURL("{Endpoint}/text/analytics/v2.1", urlParameters), autorest.WithPath("/keyPhrases"), - autorest.WithJSON(input)) + autorest.WithQueryParameters(queryParameters)) + if multiLanguageBatchInput != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(multiLanguageBatchInput)) + } return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -282,8 +303,9 @@ func (client BaseClient) KeyPhrasesResponder(resp *http.Response) (result KeyPhr // href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text // Analytics Documentation for details about the languages that are supported by sentiment analysis. // Parameters: -// input - collection of documents to analyze. -func (client BaseClient) Sentiment(ctx context.Context, input MultiLanguageBatchInput) (result SentimentBatchResult, err error) { +// showStats - (optional) if set to true, response will contain input and document level statistics. +// multiLanguageBatchInput - collection of documents to analyze. +func (client BaseClient) Sentiment(ctx context.Context, showStats *bool, multiLanguageBatchInput *MultiLanguageBatchInput) (result SetObject, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.Sentiment") defer func() { @@ -294,7 +316,7 @@ func (client BaseClient) Sentiment(ctx context.Context, input MultiLanguageBatch tracing.EndSpan(ctx, sc, err) }() } - req, err := client.SentimentPreparer(ctx, input) + req, err := client.SentimentPreparer(ctx, showStats, multiLanguageBatchInput) if err != nil { err = autorest.NewErrorWithError(err, "textanalytics.BaseClient", "Sentiment", nil, "Failure preparing request") return @@ -316,17 +338,26 @@ func (client BaseClient) Sentiment(ctx context.Context, input MultiLanguageBatch } // SentimentPreparer prepares the Sentiment request. -func (client BaseClient) SentimentPreparer(ctx context.Context, input MultiLanguageBatchInput) (*http.Request, error) { +func (client BaseClient) SentimentPreparer(ctx context.Context, showStats *bool, multiLanguageBatchInput *MultiLanguageBatchInput) (*http.Request, error) { urlParameters := map[string]interface{}{ "Endpoint": client.Endpoint, } + queryParameters := map[string]interface{}{} + if showStats != nil { + queryParameters["showStats"] = autorest.Encode("query", *showStats) + } + preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPost(), - autorest.WithCustomBaseURL("{Endpoint}/text/analytics/v2.1-preview", urlParameters), + autorest.WithCustomBaseURL("{Endpoint}/text/analytics/v2.1", urlParameters), autorest.WithPath("/sentiment"), - autorest.WithJSON(input)) + autorest.WithQueryParameters(queryParameters)) + if multiLanguageBatchInput != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(multiLanguageBatchInput)) + } return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -339,12 +370,12 @@ func (client BaseClient) SentimentSender(req *http.Request) (*http.Response, err // SentimentResponder handles the response to the Sentiment request. The method always // closes the http.Response Body. -func (client BaseClient) SentimentResponder(resp *http.Response) (result SentimentBatchResult, err error) { +func (client BaseClient) SentimentResponder(resp *http.Response) (result SetObject, err error) { err = autorest.Respond( resp, client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusInternalServerError), + autorest.ByUnmarshallingJSON(&result.Value), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return diff --git a/services/cognitiveservices/v2.1/textanalytics/models.go b/services/cognitiveservices/v2.1/textanalytics/models.go index 2b1e0d0349a2..e41ebcc0de1f 100644 --- a/services/cognitiveservices/v2.1/textanalytics/models.go +++ b/services/cognitiveservices/v2.1/textanalytics/models.go @@ -24,11 +24,6 @@ import ( // The package's fully qualified name. const fqdn = "github.com/Azure/azure-sdk-for-go/services/cognitiveservices/v2.1/textanalytics" -// BatchInput ... -type BatchInput struct { - Documents *[]Input `json:"documents,omitempty"` -} - // DetectedLanguage ... type DetectedLanguage struct { // Name - Long name of a detected language (e.g. English, French). @@ -39,32 +34,46 @@ type DetectedLanguage struct { Score *float64 `json:"score,omitempty"` } -// EntitiesBatchResultItemV2dot1 ... -type EntitiesBatchResultItemV2dot1 struct { - // ID - Unique document identifier. - ID *string `json:"id,omitempty"` - // Entities - Recognized entities in the document. - Entities *[]EntityRecordV2dot1 `json:"entities,omitempty"` +// DocumentStatistics ... +type DocumentStatistics struct { + // CharactersCount - Number of text elements recognized in the document. + CharactersCount *int32 `json:"charactersCount,omitempty"` + // TransactionsCount - Number of transactions for the document. + TransactionsCount *int32 `json:"transactionsCount,omitempty"` } -// EntitiesBatchResultV2dot1 ... -type EntitiesBatchResultV2dot1 struct { +// EntitiesBatchResult ... +type EntitiesBatchResult struct { autorest.Response `json:"-"` - Documents *[]EntitiesBatchResultItemV2dot1 `json:"documents,omitempty"` - Errors *[]ErrorRecord `json:"errors,omitempty"` + // Documents - Response by document + Documents *[]EntitiesBatchResultItem `json:"documents,omitempty"` + // Errors - Errors and Warnings by document + Errors *[]ErrorRecord `json:"errors,omitempty"` + // Statistics - (Optional) if showStats=true was specified in the request this field will contain information about the request payload. + Statistics *RequestStatistics `json:"statistics,omitempty"` +} + +// EntitiesBatchResultItem ... +type EntitiesBatchResultItem struct { + // ID - Unique, non-empty document identifier. + ID *string `json:"id,omitempty"` + // Entities - Recognized entities in the document. + Entities *[]EntityRecord `json:"entities,omitempty"` + // Statistics - (Optional) if showStats=true was specified in the request this field will contain information about the document payload. + Statistics *DocumentStatistics `json:"statistics,omitempty"` } -// EntityRecordV2dot1 ... -type EntityRecordV2dot1 struct { +// EntityRecord ... +type EntityRecord struct { // Name - Entity formal name. Name *string `json:"name,omitempty"` // Matches - List of instances this entity appears in the text. - Matches *[]MatchRecordV2dot1 `json:"matches,omitempty"` + Matches *[]MatchRecord `json:"matches,omitempty"` // WikipediaLanguage - Wikipedia language for which the WikipediaId and WikipediaUrl refers to. WikipediaLanguage *string `json:"wikipediaLanguage,omitempty"` // WikipediaID - Wikipedia unique identifier of the recognized entity. WikipediaID *string `json:"wikipediaId,omitempty"` - // WikipediaURL - URL for the entity's English Wikipedia page. + // WikipediaURL - URL for the entity's Wikipedia page. WikipediaURL *string `json:"wikipediaUrl,omitempty"` // BingID - Bing unique identifier of the recognized entity. Use in conjunction with the Bing Entity Search API to fetch additional relevant information. BingID *string `json:"bingId,omitempty"` @@ -90,13 +99,6 @@ type ErrorResponse struct { InnerError *InternalError `json:"innerError,omitempty"` } -// Input ... -type Input struct { - // ID - Unique, non-empty document identifier. - ID *string `json:"id,omitempty"` - Text *string `json:"text,omitempty"` -} - // InternalError ... type InternalError struct { Code *string `json:"code,omitempty"` @@ -107,35 +109,64 @@ type InternalError struct { // KeyPhraseBatchResult ... type KeyPhraseBatchResult struct { autorest.Response `json:"-"` - Documents *[]KeyPhraseBatchResultItem `json:"documents,omitempty"` - Errors *[]ErrorRecord `json:"errors,omitempty"` + // Documents - Response by document + Documents *[]KeyPhraseBatchResultItem `json:"documents,omitempty"` + // Errors - Errors and Warnings by document + Errors *[]ErrorRecord `json:"errors,omitempty"` + // Statistics - =(Optional) if showStats=true was specified in the request this field will contain information about the request payload. + Statistics *RequestStatistics `json:"statistics,omitempty"` } // KeyPhraseBatchResultItem ... type KeyPhraseBatchResultItem struct { + // ID - Unique, non-empty document identifier. + ID *string `json:"id,omitempty"` // KeyPhrases - A list of representative words or phrases. The number of key phrases returned is proportional to the number of words in the input document. KeyPhrases *[]string `json:"keyPhrases,omitempty"` - // ID - Unique document identifier. - ID *string `json:"id,omitempty"` + // Statistics - (Optional) if showStats=true was specified in the request this field will contain information about the document payload. + Statistics *DocumentStatistics `json:"statistics,omitempty"` +} + +// LanguageBatchInput ... +type LanguageBatchInput struct { + Documents *[]LanguageInput `json:"documents,omitempty"` } // LanguageBatchResult ... type LanguageBatchResult struct { autorest.Response `json:"-"` - Documents *[]LanguageBatchResultItem `json:"documents,omitempty"` - Errors *[]ErrorRecord `json:"errors,omitempty"` + // Documents - Response by document + Documents *[]LanguageBatchResultItem `json:"documents,omitempty"` + // Errors - Errors and Warnings by document + Errors *[]ErrorRecord `json:"errors,omitempty"` + // Statistics - (Optional) if showStats=true was specified in the request this field will contain information about the request payload. + Statistics *RequestStatistics `json:"statistics,omitempty"` } // LanguageBatchResultItem ... type LanguageBatchResultItem struct { - // ID - Unique document identifier. + // ID - Unique, non-empty document identifier. ID *string `json:"id,omitempty"` // DetectedLanguages - A list of extracted languages. DetectedLanguages *[]DetectedLanguage `json:"detectedLanguages,omitempty"` + // Statistics - (Optional) if showStats=true was specified in the request this field will contain information about the document payload. + Statistics *DocumentStatistics `json:"statistics,omitempty"` } -// MatchRecordV2dot1 ... -type MatchRecordV2dot1 struct { +// LanguageInput ... +type LanguageInput struct { + CountryHint *string `json:"countryHint,omitempty"` + // ID - Unique, non-empty document identifier. + ID *string `json:"id,omitempty"` + Text *string `json:"text,omitempty"` +} + +// MatchRecord ... +type MatchRecord struct { + // WikipediaScore - (optional) If a well-known item with Wikipedia link is recognized, a decimal number denoting the confidence level of the Wikipedia info will be returned. + WikipediaScore *float64 `json:"wikipediaScore,omitempty"` + // EntityTypeScore - (optional) If an entity type is recognized, a decimal number denoting the confidence level of the entity type will be returned. + EntityTypeScore *float64 `json:"entityTypeScore,omitempty"` // Text - Entity text as appears in the request. Text *string `json:"text,omitempty"` // Offset - Start position (in Unicode characters) for the entity match text. @@ -158,17 +189,40 @@ type MultiLanguageInput struct { Text *string `json:"text,omitempty"` } +// RequestStatistics ... +type RequestStatistics struct { + // DocumentsCount - Number of documents submitted in the request. + DocumentsCount *int32 `json:"documentsCount,omitempty"` + // ValidDocumentsCount - Number of valid documents. This excludes empty, over-size limit or non-supported languages documents. + ValidDocumentsCount *int32 `json:"validDocumentsCount,omitempty"` + // ErroneousDocumentsCount - Number of invalid documents. This includes empty, over-size limit or non-supported languages documents. + ErroneousDocumentsCount *int32 `json:"erroneousDocumentsCount,omitempty"` + // TransactionsCount - Number of transactions for the request. + TransactionsCount *int64 `json:"transactionsCount,omitempty"` +} + // SentimentBatchResult ... type SentimentBatchResult struct { - autorest.Response `json:"-"` - Documents *[]SentimentBatchResultItem `json:"documents,omitempty"` - Errors *[]ErrorRecord `json:"errors,omitempty"` + // Documents - Response by document + Documents *[]SentimentBatchResultItem `json:"documents,omitempty"` + // Errors - Errors and Warnings by document + Errors *[]ErrorRecord `json:"errors,omitempty"` + // Statistics - (Optional) if showStats=true was specified in the request this field will contain information about the request payload. + Statistics *RequestStatistics `json:"statistics,omitempty"` } // SentimentBatchResultItem ... type SentimentBatchResultItem struct { + // ID - Unique, non-empty document identifier. + ID *string `json:"id,omitempty"` // Score - 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. Score *float64 `json:"score,omitempty"` - // ID - Unique document identifier. - ID *string `json:"id,omitempty"` + // Statistics - (Optional) if showStats=true was specified in the request this field will contain information about the document payload. + Statistics *DocumentStatistics `json:"statistics,omitempty"` +} + +// SetObject ... +type SetObject struct { + autorest.Response `json:"-"` + Value interface{} `json:"value,omitempty"` } diff --git a/services/cognitiveservices/v2.1/textanalytics/textanalyticsapi/interfaces.go b/services/cognitiveservices/v2.1/textanalytics/textanalyticsapi/interfaces.go index ab1522777e42..c76a3d7fddca 100644 --- a/services/cognitiveservices/v2.1/textanalytics/textanalyticsapi/interfaces.go +++ b/services/cognitiveservices/v2.1/textanalytics/textanalyticsapi/interfaces.go @@ -24,10 +24,10 @@ import ( // BaseClientAPI contains the set of methods on the BaseClient type. type BaseClientAPI interface { - DetectLanguage(ctx context.Context, input textanalytics.BatchInput) (result textanalytics.LanguageBatchResult, err error) - Entities(ctx context.Context, input textanalytics.MultiLanguageBatchInput) (result textanalytics.EntitiesBatchResultV2dot1, err error) - KeyPhrases(ctx context.Context, input textanalytics.MultiLanguageBatchInput) (result textanalytics.KeyPhraseBatchResult, err error) - Sentiment(ctx context.Context, input textanalytics.MultiLanguageBatchInput) (result textanalytics.SentimentBatchResult, err error) + DetectLanguage(ctx context.Context, showStats *bool, languageBatchInput *textanalytics.LanguageBatchInput) (result textanalytics.LanguageBatchResult, err error) + Entities(ctx context.Context, showStats *bool, multiLanguageBatchInput *textanalytics.MultiLanguageBatchInput) (result textanalytics.EntitiesBatchResult, err error) + KeyPhrases(ctx context.Context, showStats *bool, multiLanguageBatchInput *textanalytics.MultiLanguageBatchInput) (result textanalytics.KeyPhraseBatchResult, err error) + Sentiment(ctx context.Context, showStats *bool, multiLanguageBatchInput *textanalytics.MultiLanguageBatchInput) (result textanalytics.SetObject, err error) } var _ BaseClientAPI = (*textanalytics.BaseClient)(nil) diff --git a/services/cognitiveservices/v2.1/textanalytics/version.go b/services/cognitiveservices/v2.1/textanalytics/version.go index 8a38d41e01f1..f719d2111429 100644 --- a/services/cognitiveservices/v2.1/textanalytics/version.go +++ b/services/cognitiveservices/v2.1/textanalytics/version.go @@ -21,7 +21,7 @@ import "github.com/Azure/azure-sdk-for-go/version" // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - return "Azure-SDK-For-Go/" + version.Number + " textanalytics/v2.1-preview" + return "Azure-SDK-For-Go/" + version.Number + " textanalytics/v2.1" } // Version returns the semantic version (see http://semver.org) of the client.