diff --git a/sdk/textanalytics/azure-ai-textanalytics/CHANGELOG.md b/sdk/textanalytics/azure-ai-textanalytics/CHANGELOG.md index c834ba70748bc..c7c011bda696f 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/CHANGELOG.md +++ b/sdk/textanalytics/azure-ai-textanalytics/CHANGELOG.md @@ -1,32 +1,4 @@ # Release History -## 5.1.0-beta.3 (Unreleased) - - -## 5.1.0-beta.2 (2020-10-06) -### Breaking changes -- Removed property `length` from `CategorizedEntity`, `SentenceSentiment`, `LinkedEntityMatch`, `AspectSentiment`, -`OpinionSentiment`, and `PiiEntity` because the length information can be accessed from the text property itself - using the string's length property. - -### Dependency updates -- Update dependency version, `azure-core` to 1.9.0 and `azure-core-http-netty` to 1.6.2. - -## 5.1.0-beta.1 (2020-09-17) -- Added `offset` and `length` properties for `CategorizedEntity`, `LinkedEntityMatch` and `SentenceSentiment` - - `length` is the number of characters in the text of these models - - `offset` is the offset of the text from the start of the document - -**New features** -- Updated Text Analytics SDK's default service API version to `v3.1-preview.2` from `v3.0`. -- Added support for Personally Identifiable Information(PII) entity recognition feature. - To use this feature, you need to make sure you are using the service's v3.1-preview.1 API. -- Added support for the Opinion Mining feature. To use this feature, you need to make sure you are using the -service's v3.1-preview.1 and above API. To get this support pass `includeOpinionMining` as `true` in -`AnalyzeSentimentOptions` when calling the sentiment analysis endpoints. -- Add 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/README.md b/sdk/textanalytics/azure-ai-textanalytics/README.md index 6f88ab9b2a798..39a59853859e3 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/README.md +++ b/sdk/textanalytics/azure-ai-textanalytics/README.md @@ -6,7 +6,6 @@ and includes six main functions: - Language Detection - Key Phrase Extraction - Named Entity Recognition -- Personally Identifiable Information Entity Recognition - Linked Entity Recognition [Source code][source_code] | [Package (Maven)][package] | [API reference documentation][api_reference_doc] | [Product Documentation][product_documentation] | [Samples][samples_readme] @@ -14,7 +13,7 @@ and includes six main functions: ## Getting started ### Prerequisites -- A [Java Development Kit (JDK)][jdk_link], version 8 or later. +- Java Development Kit (JDK) with version 8 or above - [Azure Subscription][azure_subscription] - [Cognitive Services or Text Analytics account][text_analytics_account] to use this package. @@ -56,7 +55,7 @@ az cognitiveservices account create \ com.azure azure-ai-textanalytics - 5.1.0-beta.2 + 5.0.0 ``` [//]: # ({x-version-update-end}) @@ -86,7 +85,7 @@ az cognitiveservices account keys list --resource-group + ```java TextAnalyticsClient textAnalyticsClient = new TextAnalyticsClientBuilder() .credential(new AzureKeyCredential("{key}")) @@ -95,7 +94,7 @@ TextAnalyticsClient textAnalyticsClient = new TextAnalyticsClientBuilder() ``` The Azure Text Analytics client library provides a way to **rotate the existing key**. - + ```java AzureKeyCredential credential = new AzureKeyCredential("{key}"); TextAnalyticsClient textAnalyticsClient = new TextAnalyticsClientBuilder() @@ -117,7 +116,7 @@ Authentication with AAD requires some initial setup: com.azure azure-identity - 1.1.3 + 1.0.8 ``` [//]: # ({x-version-update-end}) @@ -133,7 +132,7 @@ Authorization is easiest using [DefaultAzureCredential][wiki_identity]. It finds running environment. For more information about using Azure Active Directory authorization with Text Analytics, please refer to [the associated documentation][aad_authorization]. - + ```java TokenCredential defaultCredential = new DefaultAzureCredentialBuilder().build(); TextAnalyticsAsyncClient textAnalyticsClient = new TextAnalyticsClientBuilder() @@ -187,21 +186,20 @@ The following sections provide several code snippets covering some of the most c * [Detect Language](#detect-language "Detect language") * [Extract Key Phrases](#extract-key-phrases "Extract key phrases") * [Recognize Entities](#recognize-entities "Recognize entities") -* [Recognize Personally Identifiable Information Entities](#recognize-personally-identifiable-information-entities "Recognize Personally Identifiable Information entities") * [Recognize Linked Entities](#recognize-linked-entities "Recognize linked entities") ### Text Analytics Client Text analytics support both synchronous and asynchronous client creation by using `TextAnalyticsClientBuilder`, - + ``` java TextAnalyticsClient textAnalyticsClient = new TextAnalyticsClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("{endpoint}") .buildClient(); ``` - + ``` java TextAnalyticsAsyncClient textAnalyticsClient = new TextAnalyticsClientBuilder() .credential(new AzureKeyCredential("{key}")) @@ -211,9 +209,9 @@ TextAnalyticsAsyncClient textAnalyticsClient = new TextAnalyticsClientBuilder() ### Analyze sentiment Run a Text Analytics predictive model to identify the positive, negative, neutral or mixed sentiment contained in the -provided document or batch of documents. +passed-in document or batch of documents. - + ```java String document = "The hotel was dark and unclean. I like microsoft."; DocumentSentiment documentSentiment = textAnalyticsClient.analyzeSentiment(document); @@ -222,17 +220,12 @@ documentSentiment.getSentences().forEach(sentenceSentiment -> System.out.printf("Analyzed sentence sentiment: %s.%n", sentenceSentiment.getSentiment())); ``` For samples on using the production recommended option `AnalyzeSentimentBatch` see [here][analyze_sentiment_sample]. - -To get more granular information about the opinions related to aspects of a product/service, also knows as Aspect-based -Sentiment Analysis in Natural Language Processing (NLP), see sample on sentiment analysis with opinion mining see -[here][analyze_sentiment_with_opinion_mining_sample]. - Please refer to the service documentation for a conceptual discussion of [sentiment analysis][sentiment_analysis]. ### Detect language Run a Text Analytics predictive model to determine the language that the provided document or batch of documents are written in. - + ```java String document = "Bonjour tout le monde"; DetectedLanguage detectedLanguage = textAnalyticsClient.detectLanguage(document); @@ -243,9 +236,9 @@ For samples on using the production recommended option `DetectLanguageBatch` see Please refer to the service documentation for a conceptual discussion of [language detection][language_detection]. ### Extract key phrases -Run a model to identify a collection of significant phrases found in the provided document or batch of documents. +Run a model to identify a collection of significant phrases found in the passed-in document or batch of documents. - + ```java String document = "My cat might need to see a veterinarian."; System.out.println("Extracted phrases:"); @@ -255,11 +248,11 @@ For samples on using the production recommended option `ExtractKeyPhrasesBatch` Please refer to the service documentation for a conceptual discussion of [key phrase extraction][key_phrase_extraction]. ### Recognize entities -Run a predictive model to identify a collection of named entities in the provided document or batch of documents and +Run a predictive model to identify a collection of named entities in the passed-in document or batch of documents and categorize those entities into categories such as person, location, or organization. For more information on available categories, see [Text Analytics Named Entity Categories][named_entities_categories]. - + ```java String document = "Satya Nadella is the CEO of Microsoft"; textAnalyticsClient.recognizeEntities(document).forEach(entity -> @@ -269,32 +262,11 @@ textAnalyticsClient.recognizeEntities(document).forEach(entity -> For samples on using the production recommended option `RecognizeEntitiesBatch` see [here][recognize_entities_sample]. Please refer to the service documentation for a conceptual discussion of [named entity recognition][named_entity_recognition]. -### Recognize Personally Identifiable Information entities -Run a predictive model to identify a collection of Personally Identifiable Information(PII) entities in the provided -document. It recognizes and categorizes PII entities in its input text, such as -Social Security Numbers, bank account information, credit card numbers, and more. This endpoint is only supported for -API versions v3.1-preview.1 and above. - - -```java - String document = "My SSN is 859-98-0987"; - PiiEntityCollection piiEntityCollection = textAnalyticsClient.recognizePiiEntities(document); - System.out.printf("Redacted Text: %s%n", piiEntityCollection.getRedactedText()); - piiEntityCollection.forEach(entity -> System.out.printf( - "Recognized Personally Identifiable Information entity: %s, entity category: %s, entity subcategory: %s," - + " confidence score: %f.%n", - entity.getText(), entity.getCategory(), entity.getSubcategory(), entity.getConfidenceScore())); -} -``` - -For samples on using the production recommended option `RecognizePiiEntitiesBatch` see [here][recognize_pii_entities_sample]. -Please refer to the service documentation for [supported PII entity types][pii_entity_recognition]. - ### Recognize linked entities -Run a predictive model to identify a collection of entities found in the provided document or batch of documents, +Run a predictive model to identify a collection of entities found in the passed-in document or batch of documents, and include information linking the entities to their corresponding entries in a well-known knowledge base. - + ```java String document = "Old Faithful is a geyser at Yellowstone Park."; @@ -318,7 +290,7 @@ Text Analytics clients raise exceptions. For example, if you try to detect the l document IDs, `400` error is return that indicating bad request. In the following code snippet, the error is handled gracefully by catching the exception and display the additional information about the error. - + ```java List documents = Arrays.asList( new DetectLanguageInput("1", "This is written in English.", "us"), @@ -378,7 +350,6 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m [create_new_resource]: https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account?tabs=multiservice%2Cwindows#create-a-new-azure-cognitive-services-resource [custom_subdomain]: https://docs.microsoft.com/azure/cognitive-services/authentication#create-a-resource-with-a-custom-subdomain [grant_access]: https://docs.microsoft.com/azure/cognitive-services/authentication#assign-a-role-to-a-service-principal -[jdk_link]: https://docs.microsoft.com/java/azure/jdk/?view=azure-java-stable [key]: https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account?tabs=multiservice%2Cwindows#get-the-keys-for-your-resource [key_phrase_extraction]: https://docs.microsoft.com/azure/cognitive-services/text-analytics/how-tos/text-analytics-how-to-keyword-extraction [language_detection]: https://docs.microsoft.com/azure/cognitive-services/text-analytics/how-tos/text-analytics-how-to-language-detection @@ -386,7 +357,6 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m [named_entity_recognition]: https://docs.microsoft.com/azure/cognitive-services/text-analytics/how-tos/text-analytics-how-to-entity-linking [named_entity_recognition_types]: https://docs.microsoft.com/azure/cognitive-services/text-analytics/named-entity-types?tabs=personal [named_entities_categories]: https://docs.microsoft.com/azure/cognitive-services/Text-Analytics/named-entity-types -[pii_entity_recognition]: https://docs.microsoft.com/azure/cognitive-services/text-analytics/named-entity-types?tabs=personal [package]: https://mvnrepository.com/artifact/com.azure/azure-ai-textanalytics [performance_tuning]: https://github.com/Azure/azure-sdk-for-java/wiki/Performance-Tuning [product_documentation]: https://docs.microsoft.com/azure/cognitive-services/text-analytics/overview @@ -405,10 +375,8 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m [samples_readme]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/textanalytics/azure-ai-textanalytics/src/samples/README.md [detect_language_sample]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/DetectLanguageBatchDocuments.java [analyze_sentiment_sample]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/AnalyzeSentimentBatchDocuments.java -[analyze_sentiment_with_opinion_mining_sample]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/AnalyzeSentimentWithOpinionMining.java [extract_key_phrases_sample]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/ExtractKeyPhrasesBatchDocuments.java [recognize_entities_sample]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizeEntitiesBatchDocuments.java -[recognize_pii_entities_sample]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizePiiEntitiesBatchDocuments.java [recognize_linked_entities_sample]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizeLinkedEntitiesBatchDocuments.java ![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Ftextanalytics%2Fazure-ai-textanalytics%2FREADME.png) diff --git a/sdk/textanalytics/azure-ai-textanalytics/pom.xml b/sdk/textanalytics/azure-ai-textanalytics/pom.xml index 4711162af22aa..6b6df8ed80150 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/pom.xml +++ b/sdk/textanalytics/azure-ai-textanalytics/pom.xml @@ -13,7 +13,7 @@ com.azure azure-ai-textanalytics - 5.1.0-beta.3 + 5.0.0 Microsoft Azure client library for Text Analytics This package contains the Microsoft Azure Cognitive Services Text Analytics SDK. @@ -36,12 +36,12 @@ com.azure azure-core - 1.10.0 + 1.6.0 com.azure azure-core-http-netty - 1.6.3 + 1.5.3 + 1.3.1 test com.azure azure-core-http-okhttp - 1.3.3 + 1.2.4 test org.junit.jupiter junit-jupiter-api - 5.6.3 + 5.6.2 test org.junit.jupiter junit-jupiter-engine - 5.6.3 + 5.6.2 test org.junit.jupiter junit-jupiter-params - 5.6.3 + 5.6.2 test com.azure azure-identity - 1.2.0 - test - - - org.mockito - mockito-core - 3.3.3 + 1.0.8 test - - - - java-lts - - [11,) - - - - - org.apache.maven.plugins - maven-surefire-plugin - 3.0.0-M3 - - - --add-exports com.azure.core/com.azure.core.implementation.http=ALL-UNNAMED - - --add-opens com.azure.ai.textanalytics/com.azure.ai.textanalytics=ALL-UNNAMED - --add-exports com.azure.core/com.azure.core.implementation.http=ALL-UNNAMED - - - - - - - diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/AnalyzeSentimentAsyncClient.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/AnalyzeSentimentAsyncClient.java index 9e5cb68ccf37b..cc0ad672ecd80 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/AnalyzeSentimentAsyncClient.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/AnalyzeSentimentAsyncClient.java @@ -4,32 +4,24 @@ package com.azure.ai.textanalytics; import com.azure.ai.textanalytics.implementation.TextAnalyticsClientImpl; -import com.azure.ai.textanalytics.implementation.Utility; -import com.azure.ai.textanalytics.implementation.models.AspectConfidenceScoreLabel; -import com.azure.ai.textanalytics.implementation.models.AspectRelationType; import com.azure.ai.textanalytics.implementation.models.DocumentError; import com.azure.ai.textanalytics.implementation.models.DocumentSentiment; import com.azure.ai.textanalytics.implementation.models.DocumentSentimentValue; import com.azure.ai.textanalytics.implementation.models.MultiLanguageBatchInput; -import com.azure.ai.textanalytics.implementation.models.SentenceAspect; -import com.azure.ai.textanalytics.implementation.models.SentenceOpinion; import com.azure.ai.textanalytics.implementation.models.SentenceSentimentValue; import com.azure.ai.textanalytics.implementation.models.SentimentConfidenceScorePerLabel; import com.azure.ai.textanalytics.implementation.models.SentimentResponse; -import com.azure.ai.textanalytics.implementation.models.StringIndexType; import com.azure.ai.textanalytics.implementation.models.WarningCodeValue; -import com.azure.ai.textanalytics.models.AnalyzeSentimentOptions; import com.azure.ai.textanalytics.models.AnalyzeSentimentResult; -import com.azure.ai.textanalytics.models.AspectSentiment; -import com.azure.ai.textanalytics.models.MinedOpinion; -import com.azure.ai.textanalytics.models.OpinionSentiment; +import com.azure.ai.textanalytics.util.AnalyzeSentimentResultCollection; import com.azure.ai.textanalytics.models.SentenceSentiment; import com.azure.ai.textanalytics.models.SentimentConfidenceScores; +import com.azure.ai.textanalytics.models.TextAnalyticsRequestOptions; import com.azure.ai.textanalytics.models.TextAnalyticsWarning; import com.azure.ai.textanalytics.models.TextDocumentInput; import com.azure.ai.textanalytics.models.TextSentiment; import com.azure.ai.textanalytics.models.WarningCode; -import com.azure.ai.textanalytics.util.AnalyzeSentimentResultCollection; +import com.azure.core.exception.HttpResponseException; import com.azure.core.http.rest.Response; import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; @@ -39,12 +31,12 @@ import java.util.ArrayList; import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import java.util.stream.Collectors; import static com.azure.ai.textanalytics.TextAnalyticsAsyncClient.COGNITIVE_TRACING_NAMESPACE_VALUE; +import static com.azure.ai.textanalytics.implementation.Utility.getEmptyErrorIdHttpResponse; import static com.azure.ai.textanalytics.implementation.Utility.inputDocumentsValidation; +import static com.azure.ai.textanalytics.implementation.Utility.mapToHttpResponseExceptionIfExist; import static com.azure.ai.textanalytics.implementation.Utility.toBatchStatistics; import static com.azure.ai.textanalytics.implementation.Utility.toMultiLanguageInput; import static com.azure.ai.textanalytics.implementation.Utility.toTextAnalyticsError; @@ -57,7 +49,6 @@ * Helper class for managing sentiment analysis endpoint. */ class AnalyzeSentimentAsyncClient { - private static final int NEUTRAL_SCORE_ZERO = 0; private final ClientLogger logger = new ClientLogger(AnalyzeSentimentAsyncClient.class); private final TextAnalyticsClientImpl service; @@ -76,16 +67,12 @@ class AnalyzeSentimentAsyncClient { * which contains {@link AnalyzeSentimentResultCollection}. * * @param documents The list of documents to analyze sentiments for. - * @param options The additional configurable {@link AnalyzeSentimentOptions options} that may be passed when - * analyzing sentiments. + * @param options The {@link TextAnalyticsRequestOptions} request options. * * @return A mono {@link Response} contains {@link AnalyzeSentimentResultCollection}. - * - * @throws NullPointerException if {@code documents} is null. - * @throws IllegalArgumentException if {@code documents} is empty. */ public Mono> analyzeSentimentBatch( - Iterable documents, AnalyzeSentimentOptions options) { + Iterable documents, TextAnalyticsRequestOptions options) { try { inputDocumentsValidation(documents); return withContext(context -> getAnalyzedSentimentResponse(documents, options, context)); @@ -99,14 +86,13 @@ public Mono> analyzeSentimentBatch( * which contains {@link AnalyzeSentimentResultCollection}. * * @param documents The list of documents to analyze sentiments for. - * @param options The additional configurable {@link AnalyzeSentimentOptions options} that may be passed when - * analyzing sentiments. + * @param options The {@link TextAnalyticsRequestOptions} request options. * @param context Additional context that is passed through the Http pipeline during the service call. * * @return A mono {@link Response} contains {@link AnalyzeSentimentResultCollection}. */ Mono> analyzeSentimentBatchWithContext( - Iterable documents, AnalyzeSentimentOptions options, Context context) { + Iterable documents, TextAnalyticsRequestOptions options, Context context) { try { inputDocumentsValidation(documents); return getAnalyzedSentimentResponse(documents, options, context); @@ -119,19 +105,28 @@ Mono> analyzeSentimentBatchWithContex * Helper method to convert the service response of {@link SentimentResponse} to {@link Response} that contains * {@link AnalyzeSentimentResultCollection}. * - * @param response The {@link Response} of {@link SentimentResponse} returned by the service. + * @param response The {@link SimpleResponse} of {@link SentimentResponse} returned by the service. * * @return A {@link Response} contains {@link AnalyzeSentimentResultCollection}. */ private Response toAnalyzeSentimentResultCollectionResponse( - Response response) { + SimpleResponse response) { final SentimentResponse sentimentResponse = response.getValue(); final List analyzeSentimentResults = new ArrayList<>(); - final List documentSentiments = sentimentResponse.getDocuments(); - for (DocumentSentiment documentSentiment : documentSentiments) { - analyzeSentimentResults.add(convertToAnalyzeSentimentResult(documentSentiment, documentSentiments)); + for (DocumentSentiment documentSentiment : sentimentResponse.getDocuments()) { + analyzeSentimentResults.add(convertToAnalyzeSentimentResult(documentSentiment)); } for (DocumentError documentError : sentimentResponse.getErrors()) { + /* + * TODO: Remove this after service update to throw exception. + * Currently, service sets max limit of document size to 5, if the input documents size > 5, it will + * have an id = "", empty id. In the future, they will remove this and throw HttpResponseException. + */ + if (documentError.getId().isEmpty()) { + throw logger.logExceptionAsError( + new HttpResponseException(documentError.getError().getInnererror().getMessage(), + getEmptyErrorIdHttpResponse(response), documentError.getError().getInnererror().getCode())); + } analyzeSentimentResults.add(new AnalyzeSentimentResult(documentError.getId(), null, toTextAnalyticsError(documentError.getError()), null)); } @@ -144,12 +139,10 @@ private Response toAnalyzeSentimentResultColle * Helper method to convert the service response of {@link DocumentSentiment} to {@link AnalyzeSentimentResult}. * * @param documentSentiment The {@link DocumentSentiment} returned by the service. - * @param documentSentimentList The document sentiment list returned by the service. * * @return The {@link AnalyzeSentimentResult} to be returned by the SDK. */ - private AnalyzeSentimentResult convertToAnalyzeSentimentResult(DocumentSentiment documentSentiment, - List documentSentimentList) { + private AnalyzeSentimentResult convertToAnalyzeSentimentResult(DocumentSentiment documentSentiment) { // Document text sentiment final SentimentConfidenceScorePerLabel confidenceScorePerLabel = documentSentiment.getConfidenceScores(); // Sentence text sentiment @@ -161,10 +154,7 @@ private AnalyzeSentimentResult convertToAnalyzeSentimentResult(DocumentSentiment return new SentenceSentiment(sentenceSentiment.getText(), TextSentiment.fromString(sentenceSentimentValue == null ? null : sentenceSentimentValue.toString()), new SentimentConfidenceScores(confidenceScorePerSentence.getNegative(), - confidenceScorePerSentence.getNeutral(), confidenceScorePerSentence.getPositive()), - toMinedOpinionList(sentenceSentiment, documentSentimentList), - sentenceSentiment.getOffset() - ); + confidenceScorePerSentence.getNeutral(), confidenceScorePerSentence.getPositive())); }).collect(Collectors.toList()); // Warnings @@ -197,141 +187,22 @@ private AnalyzeSentimentResult convertToAnalyzeSentimentResult(DocumentSentiment * {@link AnalyzeSentimentResultCollection} from a {@link SimpleResponse} of {@link SentimentResponse}. * * @param documents A list of documents to be analyzed. - * @param options The additional configurable {@link AnalyzeSentimentOptions options} that may be passed when - * analyzing sentiments. + * @param options The {@link TextAnalyticsRequestOptions} request options. * @param context Additional context that is passed through the Http pipeline during the service call. * * @return A mono {@link Response} contains {@link AnalyzeSentimentResultCollection}. */ private Mono> getAnalyzedSentimentResponse( - Iterable documents, AnalyzeSentimentOptions options, Context context) { - String modelVersion = null; - Boolean includeStatistics = null; - Boolean includeOpinionMining = null; - if (options != null) { - modelVersion = options.getModelVersion(); - includeStatistics = options.isIncludeStatistics(); - includeOpinionMining = options.isIncludeOpinionMining(); - } + Iterable documents, TextAnalyticsRequestOptions options, Context context) { return service.sentimentWithResponseAsync( new MultiLanguageBatchInput().setDocuments(toMultiLanguageInput(documents)), - modelVersion, includeStatistics, includeOpinionMining, StringIndexType.UTF16CODE_UNIT, - context.addData(AZ_TRACING_NAMESPACE_KEY, COGNITIVE_TRACING_NAMESPACE_VALUE)) + context.addData(AZ_TRACING_NAMESPACE_KEY, COGNITIVE_TRACING_NAMESPACE_VALUE), + options == null ? null : options.getModelVersion(), + options == null ? null : options.isIncludeStatistics()) .doOnSubscribe(ignoredValue -> logger.info("A batch of documents - {}", documents.toString())) .doOnSuccess(response -> logger.info("Analyzed sentiment for a batch of documents - {}", response)) .doOnError(error -> logger.warning("Failed to analyze sentiment - {}", error)) .map(this::toAnalyzeSentimentResultCollectionResponse) - .onErrorMap(Utility::mapToHttpResponseExceptionIfExist); - } - - /* - * Transform SentenceSentiment's opinion mining to output that user can use. - */ - private IterableStream toMinedOpinionList( - com.azure.ai.textanalytics.implementation.models.SentenceSentiment sentenceSentiment, - List documentSentimentList) { - // If include opinion mining indicator is false, the service return null for the aspect list. - final List sentenceAspects = sentenceSentiment.getAspects(); - if (sentenceAspects == null) { - return null; - } - final List minedOpinions = new ArrayList<>(); - sentenceAspects.forEach(sentenceAspect -> { - final List opinionSentiments = new ArrayList<>(); - sentenceAspect.getRelations().forEach(aspectRelation -> { - final AspectRelationType aspectRelationType = aspectRelation.getRelationType(); - final String opinionPointer = aspectRelation.getRef(); - if (AspectRelationType.OPINION == aspectRelationType) { - opinionSentiments.add(toOpinionSentiment( - findSentimentOpinion(opinionPointer, documentSentimentList))); - } - }); - - minedOpinions.add(new MinedOpinion( - new AspectSentiment(sentenceAspect.getText(), - TextSentiment.fromString(sentenceAspect.getSentiment().toString()), - sentenceAspect.getOffset(), - toSentimentConfidenceScores(sentenceAspect.getConfidenceScores())), - new IterableStream<>(opinionSentiments))); - }); - - return new IterableStream<>(minedOpinions); - } - - /* - * Transform type AspectConfidenceScoreLabel to SentimentConfidenceScores. - */ - private SentimentConfidenceScores toSentimentConfidenceScores( - AspectConfidenceScoreLabel aspectConfidenceScoreLabel) { - return new SentimentConfidenceScores(aspectConfidenceScoreLabel.getNegative(), NEUTRAL_SCORE_ZERO, - aspectConfidenceScoreLabel.getPositive()); - } - - /* - * Transform type SentenceOpinion to OpinionSentiment. - */ - private OpinionSentiment toOpinionSentiment(SentenceOpinion sentenceOpinion) { - return new OpinionSentiment(sentenceOpinion.getText(), - TextSentiment.fromString(sentenceOpinion.getSentiment().toString()), - sentenceOpinion.getOffset(), sentenceOpinion.isNegated(), - toSentimentConfidenceScores(sentenceOpinion.getConfidenceScores())); - } - - /* - * Parses the reference pointer to an index array that contains document, sentence, and opinion indexes. - */ - int[] parseRefPointerToIndexArray(String opinionPointer) { - // The pattern always start with character '#', the opinion index will existing in specified sentence, which - // is under specified document. - // example: #/documents/0/sentences/0/opinions/0 - final String patternRegex = "#/documents/(\\d+)/sentences/(\\d+)/opinions/(\\d+)"; - final Pattern pattern = Pattern.compile(patternRegex); - final Matcher matcher = pattern.matcher(opinionPointer); - final boolean isMatched = matcher.find(); - - // The first index represents the document index, second one represents the sentence index, - // third ond represents the opinion index. - final int[] result = new int[3]; - - if (isMatched) { - String[] segments = opinionPointer.split("/"); - result[0] = Integer.parseInt(segments[2]); - result[1] = Integer.parseInt(segments[4]); - result[2] = Integer.parseInt(segments[6]); - } else { - throw logger.logExceptionAsError(new IllegalStateException( - String.format("'%s' is not a valid opinion pointer.", opinionPointer))); - } - - return result; - } - - /* - * Find the specific sentence opinion in the document sentiment list by given the opinion reference pointer. - */ - SentenceOpinion findSentimentOpinion(String opinionPointer, List documentSentiments) { - final int[] opinionIndexes = parseRefPointerToIndexArray(opinionPointer); - final int documentIndex = opinionIndexes[0]; - final int sentenceIndex = opinionIndexes[1]; - final int opinionIndex = opinionIndexes[2]; - if (documentIndex >= documentSentiments.size()) { - throw logger.logExceptionAsError(new IllegalStateException( - String.format("Invalid document index '%s' in '%s'.", documentIndex, opinionPointer))); - } - final DocumentSentiment documentsentiment = documentSentiments.get(documentIndex); - - final List sentenceSentiments = - documentsentiment.getSentences(); - if (sentenceIndex >= sentenceSentiments.size()) { - throw logger.logExceptionAsError(new IllegalStateException( - String.format("Invalid sentence index '%s' in '%s'.", sentenceIndex, opinionPointer))); - } - - final List opinions = sentenceSentiments.get(sentenceIndex).getOpinions(); - if (opinionIndex >= opinions.size()) { - throw logger.logExceptionAsError(new IllegalStateException( - String.format("Invalid opinion index '%s' in '%s'.", opinionIndex, opinionPointer))); - } - return opinions.get(opinionIndex); + .onErrorMap(throwable -> mapToHttpResponseExceptionIfExist(throwable)); } } diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/DetectLanguageAsyncClient.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/DetectLanguageAsyncClient.java index 8dc6407a88e36..942844ba1ff25 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/DetectLanguageAsyncClient.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/DetectLanguageAsyncClient.java @@ -11,11 +11,12 @@ import com.azure.ai.textanalytics.implementation.models.WarningCodeValue; import com.azure.ai.textanalytics.models.DetectLanguageInput; import com.azure.ai.textanalytics.models.DetectLanguageResult; +import com.azure.ai.textanalytics.util.DetectLanguageResultCollection; import com.azure.ai.textanalytics.models.DetectedLanguage; import com.azure.ai.textanalytics.models.TextAnalyticsRequestOptions; import com.azure.ai.textanalytics.models.TextAnalyticsWarning; import com.azure.ai.textanalytics.models.WarningCode; -import com.azure.ai.textanalytics.util.DetectLanguageResultCollection; +import com.azure.core.exception.HttpResponseException; import com.azure.core.http.rest.Response; import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; @@ -28,6 +29,7 @@ import java.util.stream.Collectors; import static com.azure.ai.textanalytics.TextAnalyticsAsyncClient.COGNITIVE_TRACING_NAMESPACE_VALUE; +import static com.azure.ai.textanalytics.implementation.Utility.getEmptyErrorIdHttpResponse; import static com.azure.ai.textanalytics.implementation.Utility.inputDocumentsValidation; import static com.azure.ai.textanalytics.implementation.Utility.mapToHttpResponseExceptionIfExist; import static com.azure.ai.textanalytics.implementation.Utility.toBatchStatistics; @@ -101,7 +103,7 @@ Mono> detectLanguageBatchWithContext( * @return A {@link Response} that contains {@link DetectLanguageResultCollection}. */ private Response toTextAnalyticsResultDocumentResponse( - Response response) { + SimpleResponse response) { final LanguageResult languageResult = response.getValue(); final List detectLanguageResults = new ArrayList<>(); for (DocumentLanguage documentLanguage : languageResult.getDocuments()) { @@ -128,6 +130,17 @@ private Response toTextAnalyticsResultDocumentRe } // Document errors for (DocumentError documentError : languageResult.getErrors()) { + /* + * TODO: Remove this after service update to throw exception. + * Currently, service sets max limit of document size to 5, if the input documents size > 5, it will + * have an id = "", empty id. In the future, they will remove this and throw HttpResponseException. + */ + if (documentError.getId().isEmpty()) { + throw logger.logExceptionAsError( + new HttpResponseException(documentError.getError().getInnererror().getMessage(), + getEmptyErrorIdHttpResponse(response), documentError.getError().getInnererror().getCode())); + } + detectLanguageResults.add(new DetectLanguageResult(documentError.getId(), null, toTextAnalyticsError(documentError.getError()), null)); } @@ -151,9 +164,9 @@ private Mono> getDetectedLanguageRespon Iterable documents, TextAnalyticsRequestOptions options, Context context) { return service.languagesWithResponseAsync( new LanguageBatchInput().setDocuments(toLanguageInput(documents)), + context.addData(AZ_TRACING_NAMESPACE_KEY, COGNITIVE_TRACING_NAMESPACE_VALUE), options == null ? null : options.getModelVersion(), - options == null ? null : options.isIncludeStatistics(), - context.addData(AZ_TRACING_NAMESPACE_KEY, COGNITIVE_TRACING_NAMESPACE_VALUE)) + options == null ? null : options.isIncludeStatistics()) .doOnSubscribe(ignoredValue -> logger.info("A batch of documents - {}", documents.toString())) .doOnSuccess(response -> logger.info("Detected languages for a batch of documents - {}", response.getValue())) diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/ExtractKeyPhraseAsyncClient.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/ExtractKeyPhraseAsyncClient.java index 0364ce8307ebe..28bc6dd54f594 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/ExtractKeyPhraseAsyncClient.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/ExtractKeyPhraseAsyncClient.java @@ -11,11 +11,13 @@ import com.azure.ai.textanalytics.implementation.models.WarningCodeValue; import com.azure.ai.textanalytics.models.ExtractKeyPhraseResult; import com.azure.ai.textanalytics.models.KeyPhrasesCollection; +import com.azure.ai.textanalytics.models.TextAnalyticsError; import com.azure.ai.textanalytics.models.TextAnalyticsRequestOptions; import com.azure.ai.textanalytics.models.TextAnalyticsWarning; import com.azure.ai.textanalytics.models.TextDocumentInput; import com.azure.ai.textanalytics.models.WarningCode; import com.azure.ai.textanalytics.util.ExtractKeyPhrasesResultCollection; +import com.azure.core.exception.HttpResponseException; import com.azure.core.http.rest.Response; import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; @@ -30,6 +32,7 @@ import java.util.stream.Collectors; import static com.azure.ai.textanalytics.TextAnalyticsAsyncClient.COGNITIVE_TRACING_NAMESPACE_VALUE; +import static com.azure.ai.textanalytics.implementation.Utility.getEmptyErrorIdHttpResponse; import static com.azure.ai.textanalytics.implementation.Utility.inputDocumentsValidation; import static com.azure.ai.textanalytics.implementation.Utility.mapToHttpResponseExceptionIfExist; import static com.azure.ai.textanalytics.implementation.Utility.toBatchStatistics; @@ -132,12 +135,12 @@ Mono> extractKeyPhrasesBatchWithCont * Helper method to convert the service response of {@link KeyPhraseResult} to {@link Response} * which contains {@link ExtractKeyPhrasesResultCollection}. * - * @param response the {@link Response} returned by the service. + * @param response the {@link SimpleResponse} returned by the service. * * @return A {@link Response} which contains {@link ExtractKeyPhrasesResultCollection}. */ private Response toExtractKeyPhrasesResultCollectionResponse( - final Response response) { + final SimpleResponse response) { final KeyPhraseResult keyPhraseResult = response.getValue(); // List of documents results final List keyPhraseResultList = new ArrayList<>(); @@ -158,8 +161,21 @@ private Response toExtractKeyPhrasesResultCol } // Document errors for (DocumentError documentError : keyPhraseResult.getErrors()) { - keyPhraseResultList.add(new ExtractKeyPhraseResult(documentError.getId(), null, - toTextAnalyticsError(documentError.getError()), null)); + /* + * TODO: Remove this after service update to throw exception. + * Currently, service sets max limit of document size to 5, if the input documents size > 5, it will + * have an id = "", empty id. In the future, they will remove this and throw HttpResponseException. + */ + if (documentError.getId().isEmpty()) { + throw logger.logExceptionAsError( + new HttpResponseException(documentError.getError().getInnererror().getMessage(), + getEmptyErrorIdHttpResponse(response), documentError.getError().getInnererror().getCode())); + } + + final TextAnalyticsError error = toTextAnalyticsError(documentError.getError()); + final String documentId = documentError.getId(); + keyPhraseResultList.add(new ExtractKeyPhraseResult( + documentId, null, error, null)); } return new SimpleResponse<>(response, @@ -182,9 +198,9 @@ private Mono> getExtractedKeyPhrases Iterable documents, TextAnalyticsRequestOptions options, Context context) { return service.keyPhrasesWithResponseAsync( new MultiLanguageBatchInput().setDocuments(toMultiLanguageInput(documents)), + context.addData(AZ_TRACING_NAMESPACE_KEY, COGNITIVE_TRACING_NAMESPACE_VALUE), options == null ? null : options.getModelVersion(), - options == null ? null : options.isIncludeStatistics(), - context.addData(AZ_TRACING_NAMESPACE_KEY, COGNITIVE_TRACING_NAMESPACE_VALUE)) + options == null ? null : options.isIncludeStatistics()) .doOnSubscribe(ignoredValue -> logger.info("A batch of document - {}", documents.toString())) .doOnSuccess(response -> logger.info("A batch of key phrases output - {}", response.getValue())) .doOnError(error -> logger.warning("Failed to extract key phrases - {}", error)) diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/RecognizeEntityAsyncClient.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/RecognizeEntityAsyncClient.java index 45322526093da..30a026f24a6d2 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/RecognizeEntityAsyncClient.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/RecognizeEntityAsyncClient.java @@ -4,20 +4,19 @@ package com.azure.ai.textanalytics; import com.azure.ai.textanalytics.implementation.TextAnalyticsClientImpl; -import com.azure.ai.textanalytics.implementation.models.DocumentError; import com.azure.ai.textanalytics.implementation.models.EntitiesResult; import com.azure.ai.textanalytics.implementation.models.MultiLanguageBatchInput; -import com.azure.ai.textanalytics.implementation.models.StringIndexType; import com.azure.ai.textanalytics.implementation.models.WarningCodeValue; import com.azure.ai.textanalytics.models.CategorizedEntity; import com.azure.ai.textanalytics.models.CategorizedEntityCollection; import com.azure.ai.textanalytics.models.EntityCategory; import com.azure.ai.textanalytics.models.RecognizeEntitiesResult; +import com.azure.ai.textanalytics.util.RecognizeEntitiesResultCollection; import com.azure.ai.textanalytics.models.TextAnalyticsRequestOptions; import com.azure.ai.textanalytics.models.TextAnalyticsWarning; import com.azure.ai.textanalytics.models.TextDocumentInput; import com.azure.ai.textanalytics.models.WarningCode; -import com.azure.ai.textanalytics.util.RecognizeEntitiesResultCollection; +import com.azure.core.exception.HttpResponseException; import com.azure.core.http.rest.Response; import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; @@ -32,6 +31,7 @@ import java.util.stream.Collectors; import static com.azure.ai.textanalytics.TextAnalyticsAsyncClient.COGNITIVE_TRACING_NAMESPACE_VALUE; +import static com.azure.ai.textanalytics.implementation.Utility.getEmptyErrorIdHttpResponse; import static com.azure.ai.textanalytics.implementation.Utility.inputDocumentsValidation; import static com.azure.ai.textanalytics.implementation.Utility.mapToHttpResponseExceptionIfExist; import static com.azure.ai.textanalytics.implementation.Utility.toBatchStatistics; @@ -133,12 +133,12 @@ Mono> recognizeEntitiesBatchWithCont * Helper method to convert the service response of {@link EntitiesResult} to {@link Response} which contains * {@link RecognizeEntitiesResultCollection}. * - * @param response the {@link Response} of {@link EntitiesResult} returned by the service. + * @param response the {@link SimpleResponse} of {@link EntitiesResult} returned by the service. * * @return A {@link Response} that contains {@link RecognizeEntitiesResultCollection}. */ private Response toRecognizeEntitiesResultCollectionResponse( - final Response response) { + final SimpleResponse response) { EntitiesResult entitiesResult = response.getValue(); // List of documents results List recognizeEntitiesResults = new ArrayList<>(); @@ -151,8 +151,7 @@ private Response toRecognizeEntitiesResultCol new CategorizedEntityCollection( new IterableStream<>(documentEntities.getEntities().stream().map(entity -> new CategorizedEntity(entity.getText(), EntityCategory.fromString(entity.getCategory()), - entity.getSubcategory(), entity.getConfidenceScore(), entity.getOffset() - )) + entity.getSubcategory(), entity.getConfidenceScore())) .collect(Collectors.toList())), new IterableStream<>(documentEntities.getWarnings().stream() .map(warning -> { @@ -163,10 +162,22 @@ private Response toRecognizeEntitiesResultCol }).collect(Collectors.toList()))) ))); // Document errors - for (DocumentError documentError : entitiesResult.getErrors()) { - recognizeEntitiesResults.add(new RecognizeEntitiesResult(documentError.getId(), null, - toTextAnalyticsError(documentError.getError()), null)); - } + entitiesResult.getErrors().forEach(documentError -> { + /* + * TODO: Remove this after service update to throw exception. + * Currently, service sets max limit of document size to 5, if the input documents size > 5, it will + * have an id = "", empty id. In the future, they will remove this and throw HttpResponseException. + */ + if (documentError.getId().isEmpty()) { + throw logger.logExceptionAsError( + new HttpResponseException(documentError.getError().getInnererror().getMessage(), + getEmptyErrorIdHttpResponse(response), documentError.getError().getInnererror().getCode())); + } + + recognizeEntitiesResults.add( + new RecognizeEntitiesResult(documentError.getId(), null, + toTextAnalyticsError(documentError.getError()), null)); + }); return new SimpleResponse<>(response, new RecognizeEntitiesResultCollection(recognizeEntitiesResults, entitiesResult.getModelVersion(), @@ -187,10 +198,9 @@ private Mono> getRecognizedEntitiesR Iterable documents, TextAnalyticsRequestOptions options, Context context) { return service.entitiesRecognitionGeneralWithResponseAsync( new MultiLanguageBatchInput().setDocuments(toMultiLanguageInput(documents)), + context.addData(AZ_TRACING_NAMESPACE_KEY, COGNITIVE_TRACING_NAMESPACE_VALUE), options == null ? null : options.getModelVersion(), - options == null ? null : options.isIncludeStatistics(), - StringIndexType.UTF16CODE_UNIT, - context.addData(AZ_TRACING_NAMESPACE_KEY, COGNITIVE_TRACING_NAMESPACE_VALUE)) + options == null ? null : options.isIncludeStatistics()) .doOnSubscribe(ignoredValue -> logger.info("A batch of documents - {}", documents.toString())) .doOnSuccess(response -> logger.info("Recognized entities for a batch of documents- {}", response.getValue())) diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/RecognizeLinkedEntityAsyncClient.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/RecognizeLinkedEntityAsyncClient.java index 2f570c1ba86d7..035762c54c6b3 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/RecognizeLinkedEntityAsyncClient.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/RecognizeLinkedEntityAsyncClient.java @@ -4,10 +4,8 @@ package com.azure.ai.textanalytics; import com.azure.ai.textanalytics.implementation.TextAnalyticsClientImpl; -import com.azure.ai.textanalytics.implementation.models.DocumentError; import com.azure.ai.textanalytics.implementation.models.EntityLinkingResult; import com.azure.ai.textanalytics.implementation.models.MultiLanguageBatchInput; -import com.azure.ai.textanalytics.implementation.models.StringIndexType; import com.azure.ai.textanalytics.implementation.models.WarningCodeValue; import com.azure.ai.textanalytics.models.LinkedEntity; import com.azure.ai.textanalytics.models.LinkedEntityCollection; @@ -18,6 +16,7 @@ import com.azure.ai.textanalytics.models.TextDocumentInput; import com.azure.ai.textanalytics.models.WarningCode; import com.azure.ai.textanalytics.util.RecognizeLinkedEntitiesResultCollection; +import com.azure.core.exception.HttpResponseException; import com.azure.core.http.rest.Response; import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; @@ -32,6 +31,7 @@ import java.util.stream.Collectors; import static com.azure.ai.textanalytics.TextAnalyticsAsyncClient.COGNITIVE_TRACING_NAMESPACE_VALUE; +import static com.azure.ai.textanalytics.implementation.Utility.getEmptyErrorIdHttpResponse; import static com.azure.ai.textanalytics.implementation.Utility.inputDocumentsValidation; import static com.azure.ai.textanalytics.implementation.Utility.mapToHttpResponseExceptionIfExist; import static com.azure.ai.textanalytics.implementation.Utility.toBatchStatistics; @@ -135,12 +135,12 @@ Mono> recognizeLinkedEntitiesB * Helper method to convert the service response of {@link EntityLinkingResult} to * {@link Response} which contains {@link RecognizeLinkedEntitiesResultCollection}. * - * @param response the {@link Response} of {@link EntityLinkingResult} returned by the service. + * @param response the {@link SimpleResponse} of {@link EntityLinkingResult} returned by the service. * * @return A {@link Response} that contains {@link RecognizeLinkedEntitiesResultCollection}. */ private Response toRecognizeLinkedEntitiesResultCollectionResponse( - final Response response) { + final SimpleResponse response) { final EntityLinkingResult entityLinkingResult = response.getValue(); // List of documents results final List linkedEntitiesResults = new ArrayList<>(); @@ -161,10 +161,22 @@ private Response toRecognizeLinkedEntit }).collect(Collectors.toList()))) ))); // Document errors - for (DocumentError documentError : entityLinkingResult.getErrors()) { - linkedEntitiesResults.add(new RecognizeLinkedEntitiesResult(documentError.getId(), null, - toTextAnalyticsError(documentError.getError()), null)); - } + entityLinkingResult.getErrors().forEach(documentError -> { + /* + * TODO: Remove this after service update to throw exception. + * Currently, service sets max limit of document size to 5, if the input documents size > 5, it will + * have an id = "", empty id. In the future, they will remove this and throw HttpResponseException. + */ + if (documentError.getId().isEmpty()) { + throw logger.logExceptionAsError( + new HttpResponseException(documentError.getError().getInnererror().getMessage(), + getEmptyErrorIdHttpResponse(response), documentError.getError().getInnererror().getCode())); + } + + linkedEntitiesResults.add( + new RecognizeLinkedEntitiesResult(documentError.getId(), null, + toTextAnalyticsError(documentError.getError()), null)); + }); return new SimpleResponse<>(response, new RecognizeLinkedEntitiesResultCollection(linkedEntitiesResults, entityLinkingResult.getModelVersion(), @@ -179,10 +191,10 @@ private IterableStream mapLinkedEntity( linkedEntitiesList.add(new LinkedEntity( linkedEntity.getName(), new IterableStream<>(linkedEntity.getMatches().stream().map(match -> new LinkedEntityMatch( - match.getText(), match.getConfidenceScore(), match.getOffset())) + match.getText(), match.getConfidenceScore())) .collect(Collectors.toList())), linkedEntity.getLanguage(), - linkedEntity.getId(), linkedEntity.getUrl(), linkedEntity.getDataSource(), linkedEntity.getBingId())); + linkedEntity.getId(), linkedEntity.getUrl(), linkedEntity.getDataSource())); } return new IterableStream<>(linkedEntitiesList); } @@ -201,10 +213,9 @@ private IterableStream mapLinkedEntity( Context context) { return service.entitiesLinkingWithResponseAsync( new MultiLanguageBatchInput().setDocuments(toMultiLanguageInput(documents)), + context.addData(AZ_TRACING_NAMESPACE_KEY, COGNITIVE_TRACING_NAMESPACE_VALUE), options == null ? null : options.getModelVersion(), - options == null ? null : options.isIncludeStatistics(), - StringIndexType.UTF16CODE_UNIT, - context.addData(AZ_TRACING_NAMESPACE_KEY, COGNITIVE_TRACING_NAMESPACE_VALUE)) + options == null ? null : options.isIncludeStatistics()) .doOnSubscribe(ignoredValue -> logger.info("A batch of documents - {}", documents.toString())) .doOnSuccess(response -> logger.info("Recognized linked entities for a batch of documents - {}", response.getValue())) diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/RecognizePiiEntityAsyncClient.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/RecognizePiiEntityAsyncClient.java deleted file mode 100644 index ba2a11f679c4e..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/RecognizePiiEntityAsyncClient.java +++ /dev/null @@ -1,225 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.textanalytics; - -import com.azure.ai.textanalytics.implementation.TextAnalyticsClientImpl; -import com.azure.ai.textanalytics.implementation.models.DocumentError; -import com.azure.ai.textanalytics.implementation.models.EntitiesResult; -import com.azure.ai.textanalytics.implementation.models.MultiLanguageBatchInput; -import com.azure.ai.textanalytics.implementation.models.PiiEntitiesResult; -import com.azure.ai.textanalytics.implementation.models.StringIndexType; -import com.azure.ai.textanalytics.implementation.models.WarningCodeValue; -import com.azure.ai.textanalytics.models.EntityCategory; -import com.azure.ai.textanalytics.models.PiiEntity; -import com.azure.ai.textanalytics.models.PiiEntityCollection; -import com.azure.ai.textanalytics.models.PiiEntityDomainType; -import com.azure.ai.textanalytics.models.RecognizePiiEntitiesResult; -import com.azure.ai.textanalytics.models.RecognizePiiEntityOptions; -import com.azure.ai.textanalytics.models.TextAnalyticsWarning; -import com.azure.ai.textanalytics.models.TextDocumentInput; -import com.azure.ai.textanalytics.models.WarningCode; -import com.azure.ai.textanalytics.util.RecognizePiiEntitiesResultCollection; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.SimpleResponse; -import com.azure.core.util.Context; -import com.azure.core.util.IterableStream; -import com.azure.core.util.logging.ClientLogger; -import reactor.core.publisher.Mono; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -import static com.azure.ai.textanalytics.TextAnalyticsAsyncClient.COGNITIVE_TRACING_NAMESPACE_VALUE; -import static com.azure.ai.textanalytics.implementation.Utility.inputDocumentsValidation; -import static com.azure.ai.textanalytics.implementation.Utility.mapToHttpResponseExceptionIfExist; -import static com.azure.ai.textanalytics.implementation.Utility.toBatchStatistics; -import static com.azure.ai.textanalytics.implementation.Utility.toMultiLanguageInput; -import static com.azure.ai.textanalytics.implementation.Utility.toTextAnalyticsError; -import static com.azure.ai.textanalytics.implementation.Utility.toTextAnalyticsException; -import static com.azure.ai.textanalytics.implementation.Utility.toTextDocumentStatistics; -import static com.azure.core.util.FluxUtil.monoError; -import static com.azure.core.util.FluxUtil.withContext; -import static com.azure.core.util.tracing.Tracer.AZ_TRACING_NAMESPACE_KEY; - -/** - * Helper class for managing recognize Personally Identifiable Information entity endpoint. - */ -class RecognizePiiEntityAsyncClient { - private final ClientLogger logger = new ClientLogger(RecognizePiiEntityAsyncClient.class); - private final TextAnalyticsClientImpl service; - - /** - * Create a {@link RecognizePiiEntityAsyncClient} that sends requests to the Text Analytics services's - * recognize Personally Identifiable Information entity endpoint. - * - * @param service The proxy service used to perform REST calls. - */ - RecognizePiiEntityAsyncClient(TextAnalyticsClientImpl service) { - this.service = service; - } - - /** - * Helper function for calling service with max overloaded parameters that returns a {@link Mono} - * which contains {@link PiiEntityCollection}. - * - * @param document A single document. - * @param language The language code. - * @param options The additional configurable {@link RecognizePiiEntityOptions options} that may be passed when - * recognizing PII entities. - * - * @return The {@link Mono} of {@link PiiEntityCollection}. - */ - Mono recognizePiiEntities(String document, String language, - RecognizePiiEntityOptions options) { - try { - Objects.requireNonNull(document, "'document' cannot be null."); - return recognizePiiEntitiesBatch( - Collections.singletonList(new TextDocumentInput("0", document).setLanguage(language)), options) - .map(resultCollectionResponse -> { - PiiEntityCollection entityCollection = null; - // for each loop will have only one entry inside - for (RecognizePiiEntitiesResult entitiesResult : resultCollectionResponse.getValue()) { - if (entitiesResult.isError()) { - throw logger.logExceptionAsError(toTextAnalyticsException(entitiesResult.getError())); - } - entityCollection = new PiiEntityCollection(entitiesResult.getEntities(), - entitiesResult.getEntities().getRedactedText(), - entitiesResult.getEntities().getWarnings()); - } - return entityCollection; - }); - } catch (RuntimeException ex) { - return monoError(logger, ex); - } - } - - /** - * Helper function for calling service with max overloaded parameters. - * - * @param documents The list of documents to recognize Personally Identifiable Information entities for. - * @param options The additional configurable {@link RecognizePiiEntityOptions options} that may be passed when - * recognizing PII entities. - * - * @return A mono {@link Response} that contains {@link RecognizePiiEntitiesResultCollection}. - */ - Mono> recognizePiiEntitiesBatch( - Iterable documents, RecognizePiiEntityOptions options) { - try { - inputDocumentsValidation(documents); - return withContext(context -> getRecognizePiiEntitiesResponse(documents, options, context)); - } catch (RuntimeException ex) { - return monoError(logger, ex); - } - } - - /** - * Helper function for calling service with max overloaded parameters with {@link Context} is given. - * - * @param documents The list of documents to recognize Personally Identifiable Information entities for. - * @param options The additional configurable {@link RecognizePiiEntityOptions options} that may be passed when - * recognizing PII entities. - * @param context Additional context that is passed through the Http pipeline during the service call. - * - * @return A mono {@link Response} that contains {@link RecognizePiiEntitiesResultCollection}. - */ - Mono> recognizePiiEntitiesBatchWithContext( - Iterable documents, RecognizePiiEntityOptions options, Context context) { - try { - inputDocumentsValidation(documents); - return getRecognizePiiEntitiesResponse(documents, options, context); - } catch (RuntimeException ex) { - return monoError(logger, ex); - } - } - - /** - * Helper method to convert the service response of {@link EntitiesResult} to {@link Response} which contains - * {@link RecognizePiiEntitiesResultCollection}. - * - * @param response the {@link Response} of {@link EntitiesResult} returned by the service. - * - * @return A {@link Response} that contains {@link RecognizePiiEntitiesResultCollection}. - */ - private Response toRecognizePiiEntitiesResultCollectionResponse( - final Response response) { - final PiiEntitiesResult piiEntitiesResult = response.getValue(); - // List of documents results - final List recognizeEntitiesResults = new ArrayList<>(); - piiEntitiesResult.getDocuments().forEach(documentEntities -> { - // Pii entities list - final List piiEntities = documentEntities.getEntities().stream().map(entity -> - new PiiEntity(entity.getText(), EntityCategory.fromString(entity.getCategory()), - entity.getSubcategory(), entity.getConfidenceScore(), entity.getOffset())) - .collect(Collectors.toList()); - // Warnings - final List warnings = documentEntities.getWarnings().stream() - .map(warning -> { - final WarningCodeValue warningCodeValue = warning.getCode(); - return new TextAnalyticsWarning( - WarningCode.fromString(warningCodeValue == null ? null : warningCodeValue.toString()), - warning.getMessage()); - }).collect(Collectors.toList()); - - recognizeEntitiesResults.add(new RecognizePiiEntitiesResult( - documentEntities.getId(), - documentEntities.getStatistics() == null ? null - : toTextDocumentStatistics(documentEntities.getStatistics()), - null, - new PiiEntityCollection(new IterableStream<>(piiEntities), documentEntities.getRedactedText(), - new IterableStream<>(warnings)) - )); - }); - // Document errors - for (DocumentError documentError : piiEntitiesResult.getErrors()) { - recognizeEntitiesResults.add(new RecognizePiiEntitiesResult(documentError.getId(), null, - toTextAnalyticsError(documentError.getError()), null)); - } - - return new SimpleResponse<>(response, - new RecognizePiiEntitiesResultCollection(recognizeEntitiesResults, piiEntitiesResult.getModelVersion(), - piiEntitiesResult.getStatistics() == null ? null : toBatchStatistics(piiEntitiesResult.getStatistics()) - )); - } - - /** - * Call the service with REST response, convert to a {@link Mono} of {@link Response} that contains - * {@link RecognizePiiEntitiesResultCollection} from a {@link SimpleResponse} of {@link EntitiesResult}. - * - * @param documents The list of documents to recognize Personally Identifiable Information entities for. - * @param options The additional configurable {@link RecognizePiiEntityOptions options} that may be passed when - * recognizing PII entities. - * @param context Additional context that is passed through the Http pipeline during the service call. - * - * @return A mono {@link Response} that contains {@link RecognizePiiEntitiesResultCollection}. - */ - private Mono> getRecognizePiiEntitiesResponse( - Iterable documents, RecognizePiiEntityOptions options, Context context) { - String modelVersion = null; - Boolean includeStatistics = null; - String domainFilter = null; - if (options != null) { - modelVersion = options.getModelVersion(); - includeStatistics = options.isIncludeStatistics(); - final PiiEntityDomainType domainType = options.getDomainFilter(); - if (domainType != null) { - domainFilter = domainType.toString(); - } - } - return service.entitiesRecognitionPiiWithResponseAsync( - new MultiLanguageBatchInput().setDocuments(toMultiLanguageInput(documents)), - modelVersion, includeStatistics, domainFilter, StringIndexType.UTF16CODE_UNIT, - context.addData(AZ_TRACING_NAMESPACE_KEY, COGNITIVE_TRACING_NAMESPACE_VALUE)) - .doOnSubscribe(ignoredValue -> logger.info( - "Start recognizing Personally Identifiable Information entities for a batch of documents.")) - .doOnSuccess(response -> logger.info( - "Successfully recognized Personally Identifiable Information entities for a batch of documents.")) - .doOnError(error -> - logger.warning("Failed to recognize Personally Identifiable Information entities - {}", error)) - .map(this::toRecognizePiiEntitiesResultCollectionResponse) - .onErrorMap(throwable -> mapToHttpResponseExceptionIfExist(throwable)); - } -} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsAsyncClient.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsAsyncClient.java index 0453a2e026d55..82d0b23e456a6 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsAsyncClient.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsAsyncClient.java @@ -4,7 +4,6 @@ package com.azure.ai.textanalytics; import com.azure.ai.textanalytics.implementation.TextAnalyticsClientImpl; -import com.azure.ai.textanalytics.models.AnalyzeSentimentOptions; import com.azure.ai.textanalytics.models.AnalyzeSentimentResult; import com.azure.ai.textanalytics.models.CategorizedEntityCollection; import com.azure.ai.textanalytics.models.DetectLanguageInput; @@ -13,8 +12,6 @@ import com.azure.ai.textanalytics.models.DocumentSentiment; import com.azure.ai.textanalytics.models.KeyPhrasesCollection; import com.azure.ai.textanalytics.models.LinkedEntityCollection; -import com.azure.ai.textanalytics.models.PiiEntityCollection; -import com.azure.ai.textanalytics.models.RecognizePiiEntityOptions; import com.azure.ai.textanalytics.models.TextAnalyticsError; import com.azure.ai.textanalytics.models.TextAnalyticsException; import com.azure.ai.textanalytics.models.TextAnalyticsRequestOptions; @@ -24,7 +21,6 @@ import com.azure.ai.textanalytics.util.ExtractKeyPhrasesResultCollection; import com.azure.ai.textanalytics.util.RecognizeEntitiesResultCollection; import com.azure.ai.textanalytics.util.RecognizeLinkedEntitiesResultCollection; -import com.azure.ai.textanalytics.util.RecognizePiiEntitiesResultCollection; import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceClient; import com.azure.core.annotation.ServiceMethod; @@ -36,7 +32,6 @@ import java.util.Collections; import java.util.Objects; -import static com.azure.ai.textanalytics.implementation.Utility.inputDocumentsValidation; import static com.azure.ai.textanalytics.implementation.Utility.mapByIndex; import static com.azure.ai.textanalytics.implementation.Utility.toTextAnalyticsException; import static com.azure.core.util.FluxUtil.monoError; @@ -68,7 +63,6 @@ public final class TextAnalyticsAsyncClient { final AnalyzeSentimentAsyncClient analyzeSentimentAsyncClient; final ExtractKeyPhraseAsyncClient extractKeyPhraseAsyncClient; final RecognizeEntityAsyncClient recognizeEntityAsyncClient; - final RecognizePiiEntityAsyncClient recognizePiiEntityAsyncClient; final RecognizeLinkedEntityAsyncClient recognizeLinkedEntityAsyncClient; /** @@ -90,7 +84,6 @@ public final class TextAnalyticsAsyncClient { this.analyzeSentimentAsyncClient = new AnalyzeSentimentAsyncClient(service); this.extractKeyPhraseAsyncClient = new ExtractKeyPhraseAsyncClient(service); this.recognizeEntityAsyncClient = new RecognizeEntityAsyncClient(service); - this.recognizePiiEntityAsyncClient = new RecognizePiiEntityAsyncClient(service); this.recognizeLinkedEntityAsyncClient = new RecognizeLinkedEntityAsyncClient(service); } @@ -132,7 +125,7 @@ public String getDefaultLanguage() { * * @return A {@link Mono} containing the {@link DetectedLanguage detected language} of the document. * - * @throws NullPointerException if the document is null. + * @throws NullPointerException if the document is {@code null}. * @throws TextAnalyticsException if the response returned with an {@link TextAnalyticsError error}. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -159,7 +152,7 @@ public Mono detectLanguage(String document) { * * @return A {@link Mono} contains a {@link DetectedLanguage detected language} of the document. * - * @throws NullPointerException if the document is null. + * @throws NullPointerException if the document is {@code null}. * @throws TextAnalyticsException if the response returned with an {@link TextAnalyticsError error}. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -205,7 +198,7 @@ public Mono detectLanguage(String document, String countryHint * * @return A {@link Mono} contains a {@link DetectLanguageResultCollection}. * - * @throws NullPointerException if {@code documents} is null. + * @throws NullPointerException if {@code documents} is {@code null}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono detectLanguageBatch( @@ -241,7 +234,7 @@ public Mono detectLanguageBatch( * * @return A {@link Mono} contains a {@link Response} which contains a {@link DetectLanguageResultCollection}. * - * @throws NullPointerException if {@code documents} is null. + * @throws NullPointerException if {@code documents} is {@code null}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> detectLanguageBatchWithResponse( @@ -256,8 +249,7 @@ public Mono> detectLanguageBatchWithRes * * For a list of supported entity types, check: this. * For a list of enabled languages, check: this. - * - * This method will use the default language that can be set by using method + * This method will use the default language that sets up in * {@link TextAnalyticsClientBuilder#defaultLanguage(String)}. If none is specified, service will use 'en' as * the language. * @@ -273,7 +265,7 @@ public Mono> detectLanguageBatchWithRes * * @return A {@link Mono} contains a {@link CategorizedEntityCollection recognized categorized entities collection}. * - * @throws NullPointerException if {@code document} is null. + * @throws NullPointerException if {@code document} is {@code null}. * @throws TextAnalyticsException if the response returned with an {@link TextAnalyticsError error}. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -301,7 +293,7 @@ public Mono recognizeEntities(String document) { * * @return A {@link Mono} contains a {@link CategorizedEntityCollection recognized categorized entities collection}. * - * @throws NullPointerException if {@code document} is null. + * @throws NullPointerException if {@code document} is {@code null}. * @throws TextAnalyticsException if the response returned with an {@link TextAnalyticsError error}. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -329,7 +321,7 @@ public Mono recognizeEntities(String document, Stri * * @return A {@link Mono} contains a {@link RecognizeEntitiesResultCollection}. * - * @throws NullPointerException if {@code documents} is null. + * @throws NullPointerException if {@code documents} is {@code null}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono recognizeEntitiesBatch( @@ -364,7 +356,7 @@ public Mono recognizeEntitiesBatch( * * @return A {@link Mono} contains a {@link Response} which contains a {@link RecognizeEntitiesResultCollection}. * - * @throws NullPointerException if {@code documents} is null. + * @throws NullPointerException if {@code documents} is {@code null}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> recognizeEntitiesBatchWithResponse( @@ -372,169 +364,13 @@ public Mono> recognizeEntitiesBatchW return recognizeEntityAsyncClient.recognizeEntitiesBatch(documents, options); } - // PII Entity - - /** - * Returns a list of Personally Identifiable Information(PII) entities in the provided document. - * - * For a list of supported entity types, check: this. - * For a list of enabled languages, check: this. This method will use the - * default language that is set using {@link TextAnalyticsClientBuilder#defaultLanguage(String)}. If none is - * specified, service will use 'en' as the language. - * - *

Code sample

- *

Recognize the PII entities details in a document. - * Subscribes to the call asynchronously and prints out the recognized entity details when a response is - * received.

- * - * {@codesnippet com.azure.ai.textanalytics.TextAnalyticsAsyncClient.recognizePiiEntities#string} - * - * @param document The document to recognize PII entities details for. - * For text length limits, maximum batch size, and supported text encoding, see - * data limits. - * - * @return A {@link Mono} contains a {@link PiiEntityCollection recognized PII entities collection}. - * - * @throws NullPointerException if {@code document} is null. - * @throws TextAnalyticsException if the response returned with an {@link TextAnalyticsError error}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono recognizePiiEntities(String document) { - return recognizePiiEntities(document, defaultLanguage); - } - - /** - * Returns a list of Personally Identifiable Information(PII) entities in the provided document - * with provided language code. - * - * For a list of supported entity types, check: this. - * For a list of enabled languages, check: this. - * - *

Code sample

- *

Recognize the PII entities details in a document with provided language code. - * Subscribes to the call asynchronously and prints out the entity details when a response is received.

- * - * {@codesnippet com.azure.ai.textanalytics.TextAnalyticsAsyncClient.recognizePiiEntities#string-string} - * - * @param document the text to recognize PII entities details for. - * For text length limits, maximum batch size, and supported text encoding, see - * data limits. - * @param language The 2 letter ISO 639-1 representation of language. If not set, uses "en" for English as default. - * - * @return A {@link Mono} contains a {@link PiiEntityCollection recognized PII entities collection}. - * - * @throws NullPointerException if {@code document} is null. - * @throws TextAnalyticsException if the response returned with an {@link TextAnalyticsError error}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono recognizePiiEntities(String document, String language) { - return recognizePiiEntityAsyncClient.recognizePiiEntities(document, language, null); - } - - /** - * Returns a list of Personally Identifiable Information(PII) entities in the provided document - * with provided language code. - * - * For a list of supported entity types, check: this. - * For a list of enabled languages, check: this. - * - *

Code sample

- *

Recognize the PII entities details in a document with provided language code and RecognizePiiEntityOptions. - * Subscribes to the call asynchronously and prints out the entity details when a response is received.

- * - * {@codesnippet com.azure.ai.textanalytics.TextAnalyticsAsyncClient.recognizePiiEntities#string-string-RecognizePiiEntityOptions} - * - * @param document the text to recognize PII entities details for. - * For text length limits, maximum batch size, and supported text encoding, see - * data limits. - * @param language The 2 letter ISO 639-1 representation of language. If not set, uses "en" for English as default. - * @param options The additional configurable {@link RecognizePiiEntityOptions options} that may be passed when - * recognizing PII entities. - * - * @return A {@link Mono} contains a {@link PiiEntityCollection recognized PII entities collection}. - * - * @throws NullPointerException if {@code document} is null. - * @throws TextAnalyticsException if the response returned with an {@link TextAnalyticsError error}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono recognizePiiEntities(String document, String language, - RecognizePiiEntityOptions options) { - return recognizePiiEntityAsyncClient.recognizePiiEntities(document, language, options); - } - - /** - * Returns a list of Personally Identifiable Information(PII) entities for the provided list of documents with - * the provided language code and request options. - * - *

Code sample

- *

Recognize Personally Identifiable Information entities in a document with the provided language code. - * Subscribes to the call asynchronously and prints out the entity details when a response is received.

- * - * {@codesnippet com.azure.ai.textanalytics.TextAnalyticsAsyncClient.recognizePiiEntitiesBatch#Iterable-String-RecognizePiiEntityOptions} - * - * @param documents A list of documents to recognize PII entities for. - * For text length limits, maximum batch size, and supported text encoding, see - * data limits. - * @param language The 2 letter ISO 639-1 representation of language. If not set, uses "en" for English as default. - * @param options The additional configurable {@link RecognizePiiEntityOptions options} that may be passed when - * recognizing PII entities. - * - * @return A {@link Mono} contains a {@link RecognizePiiEntitiesResultCollection}. - * - * @throws NullPointerException if {@code documents} is null. - * @throws IllegalArgumentException if {@code documents} is empty. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono recognizePiiEntitiesBatch( - Iterable documents, String language, RecognizePiiEntityOptions options) { - try { - inputDocumentsValidation(documents); - return recognizePiiEntitiesBatchWithResponse( - mapByIndex(documents, (index, value) -> { - final TextDocumentInput textDocumentInput = new TextDocumentInput(index, value); - textDocumentInput.setLanguage(language); - return textDocumentInput; - }), options).flatMap(FluxUtil::toMono); - } catch (RuntimeException ex) { - return monoError(logger, ex); - } - } - - /** - * Returns a list of Personally Identifiable Information entities for the provided list of - * {@link TextDocumentInput document} with provided request options. - * - *

Code sample

- *

Recognize the PII entities details with http response in a list of {@link TextDocumentInput document} - * with provided request options. - * Subscribes to the call asynchronously and prints out the entity details when a response is received.

- * - * {@codesnippet com.azure.ai.textanalytics.TextAnalyticsAsyncClient.recognizePiiEntitiesBatch#Iterable-RecognizePiiEntityOptions} - * - * @param documents A list of {@link TextDocumentInput documents} to recognize PII entities for. - * For text length limits, maximum batch size, and supported text encoding, see - * data limits. - * @param options The additional configurable {@link RecognizePiiEntityOptions options} that may be passed when - * recognizing PII entities. - * - * @return A {@link Mono} contains a {@link Response} which contains a {@link RecognizePiiEntitiesResultCollection}. - * - * @throws NullPointerException if {@code documents} is null. - * @throws IllegalArgumentException if {@code documents} is empty. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> recognizePiiEntitiesBatchWithResponse( - Iterable documents, RecognizePiiEntityOptions options) { - return recognizePiiEntityAsyncClient.recognizePiiEntitiesBatch(documents, options); - } - - // Linked Entities + // Linked Entity /** * Returns a list of recognized entities with links to a well-known knowledge base for the provided document. See * this for supported languages in Text Analytics API. * - * This method will use the default language that can be set by using method + * This method will use the default language that sets up in * {@link TextAnalyticsClientBuilder#defaultLanguage(String)}. If none is specified, service will use 'en' as * the language. * @@ -549,7 +385,7 @@ public Mono> recognizePiiEntities * * @return A {@link Mono} contains a {@link LinkedEntityCollection recognized linked entities collection}. * - * @throws NullPointerException if {@code document} is null. + * @throws NullPointerException if {@code document} is {@code null}. * @throws TextAnalyticsException if the response returned with an {@link TextAnalyticsError error}. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -574,7 +410,7 @@ public Mono recognizeLinkedEntities(String document) { * * @return A {@link Mono} contains a {@link LinkedEntityCollection recognized linked entities collection}. * - * @throws NullPointerException if {@code document} is null. + * @throws NullPointerException if {@code document} is {@code null}. * @throws TextAnalyticsException if the response returned with an {@link TextAnalyticsError error}. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -603,7 +439,7 @@ public Mono recognizeLinkedEntities(String document, Str * * @return A {@link Mono} contains a {@link RecognizeLinkedEntitiesResultCollection}. * - * @throws NullPointerException if {@code documents} is null. + * @throws NullPointerException if {@code documents} is {@code null}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono recognizeLinkedEntitiesBatch( @@ -640,7 +476,7 @@ public Mono recognizeLinkedEntitiesBatc * @return A {@link Mono} contains a {@link Response} which contains a * {@link RecognizeLinkedEntitiesResultCollection}. * - * @throws NullPointerException if {@code documents} is null. + * @throws NullPointerException if {@code documents} is {@code null}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> @@ -654,7 +490,7 @@ public Mono recognizeLinkedEntitiesBatc /** * Returns a list of strings denoting the key phrases in the document. * - * This method will use the default language that can be set by using method + * This method will use the default language that sets up in * {@link TextAnalyticsClientBuilder#defaultLanguage(String)}. If none is specified, service will use 'en' as * the language. * @@ -669,7 +505,7 @@ public Mono recognizeLinkedEntitiesBatc * * @return A {@link Mono} contains a {@link KeyPhrasesCollection}. * - * @throws NullPointerException if {@code document} is null. + * @throws NullPointerException if {@code document} is {@code null}. * @throws TextAnalyticsException if the response returned with an {@link TextAnalyticsError error}. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -695,7 +531,7 @@ public Mono extractKeyPhrases(String document) { * * @return A {@link Mono} contains a {@link KeyPhrasesCollection} * - * @throws NullPointerException if {@code document} is null. + * @throws NullPointerException if {@code document} is {@code null}. * @throws TextAnalyticsException if the response returned with an {@link TextAnalyticsError error}. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -724,7 +560,7 @@ public Mono extractKeyPhrases(String document, String lang * * @return A {@link Mono} contains a {@link ExtractKeyPhrasesResultCollection}. * - * @throws NullPointerException if {@code documents} is null. + * @throws NullPointerException if {@code documents} is {@code null}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono extractKeyPhrasesBatch( @@ -759,7 +595,7 @@ public Mono extractKeyPhrasesBatch( * * @return A {@link Mono} contains a {@link Response} that contains a {@link ExtractKeyPhrasesResultCollection}. * - * @throws NullPointerException if {@code documents} is null. + * @throws NullPointerException if {@code documents} is {@code null}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> extractKeyPhrasesBatchWithResponse( @@ -773,12 +609,11 @@ public Mono> extractKeyPhrasesBatchW * Returns a sentiment prediction, as well as confidence scores for each sentiment label (Positive, Negative, and * Neutral) for the document and each sentence within it. * - * This method will use the default language that can be set by using method + * This method will use the default language that sets up in * {@link TextAnalyticsClientBuilder#defaultLanguage(String)}. If none is specified, service will use 'en' as * the language. * - *

Code Sample

- *

Analyze the sentiment in a document. Subscribes to the call asynchronously and prints out the + *

Analyze sentiment in a list of documents. Subscribes to the call asynchronously and prints out the * sentiment details when a response is received.

* * {@codesnippet com.azure.ai.textanalytics.TextAnalyticsAsyncClient.analyzeSentiment#string} @@ -789,7 +624,7 @@ public Mono> extractKeyPhrasesBatchW * * @return A {@link Mono} contains the {@link DocumentSentiment analyzed document sentiment} of the document. * - * @throws NullPointerException if {@code document} is null. + * @throws NullPointerException if {@code document} is {@code null}. * @throws TextAnalyticsException if the response returned with an {@link TextAnalyticsError error}. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -801,11 +636,10 @@ public Mono analyzeSentiment(String document) { * Returns a sentiment prediction, as well as confidence scores for each sentiment label (Positive, Negative, and * Neutral) for the document and each sentence within it. * - *

Code Sample

- *

Analyze the sentiments in a document with a provided language representation. Subscribes to the call - * asynchronously and prints out the sentiment details when a response is received.

+ *

Analyze sentiment in a list of documents. Subscribes to the call asynchronously and prints out the + * sentiment details when a response is received.

* - * {@codesnippet com.azure.ai.textanalytics.TextAnalyticsAsyncClient.analyzeSentiment#String-String} + * {@codesnippet com.azure.ai.textanalytics.TextAnalyticsAsyncClient.analyzeSentiment#string-string} * * @param document The document to be analyzed. * For text length limits, maximum batch size, and supported text encoding, see @@ -815,46 +649,14 @@ public Mono analyzeSentiment(String document) { * * @return A {@link Mono} contains the {@link DocumentSentiment analyzed document sentiment} of the document. * - * @throws NullPointerException if {@code document} is null. + * @throws NullPointerException if {@code document} is {@code null}. * @throws TextAnalyticsException if the response returned with an {@link TextAnalyticsError error}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono analyzeSentiment(String document, String language) { - return analyzeSentiment(document, language, null); - } - - /** - * Returns a sentiment prediction, as well as confidence scores for each sentiment label (Positive, Negative, and - * Neutral) for the document and each sentence within it. If the {@code includeOpinionMining} of - * {@link AnalyzeSentimentOptions} set to true, the output will include the opinion mining results. It mines the - * opinions of a sentence and conducts more granular analysis around the aspects in the text - * (also known as aspect-based sentiment analysis). - * - *

Code Sample

- *

Analyze the sentiment and mine the opinions for each sentence in a document with a provided language - * representation and {@link AnalyzeSentimentOptions} options. Subscribes to the call asynchronously and prints - * out the sentiment and mined opinions details when a response is received.

- * - * {@codesnippet com.azure.ai.textanalytics.TextAnalyticsAsyncClient.analyzeSentiment#String-String-AnalyzeSentimentOptions} - * - * @param document The document to be analyzed. - * For text length limits, maximum batch size, and supported text encoding, see - * data limits. - * @param language The 2 letter ISO 639-1 representation of language for the text. If not set, uses "en" for - * English as default. - * @param options The additional configurable {@link AnalyzeSentimentOptions options} that may be passed when - * analyzing sentiments. - * - * @return A {@link Mono} contains the {@link DocumentSentiment analyzed document sentiment} of the document. - * - * @throws NullPointerException if {@code document} is null. - * @throws TextAnalyticsException if the response returned with an {@link TextAnalyticsError error}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono analyzeSentiment(String document, String language, AnalyzeSentimentOptions options) { try { Objects.requireNonNull(document, "'document' cannot be null."); - return analyzeSentimentBatch(Collections.singletonList(document), language, options) + return analyzeSentimentBatch(Collections.singletonList(document), language, null) .map(sentimentResultCollection -> { DocumentSentiment documentSentiment = null; for (AnalyzeSentimentResult sentimentResult : sentimentResultCollection) { @@ -891,47 +693,11 @@ public Mono analyzeSentiment(String document, String language * * @return A {@link Mono} contains a {@link AnalyzeSentimentResultCollection}. * - * @throws NullPointerException if {@code documents} is null. - * @throws IllegalArgumentException if {@code documents} is empty. + * @throws NullPointerException if {@code documents} is {@code null}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono analyzeSentimentBatch( Iterable documents, String language, TextAnalyticsRequestOptions options) { - return analyzeSentimentBatch(documents, language, new AnalyzeSentimentOptions() - .setIncludeStatistics(options == null ? false : options.isIncludeStatistics()) - .setModelVersion(options == null ? null : options.getModelVersion())); - } - - /** - * Returns a sentiment prediction, as well as confidence scores for each sentiment label (Positive, Negative, and - * Neutral) for the document and each sentence within it. If the {@code includeOpinionMining} of - * {@link AnalyzeSentimentOptions} set to true, the output will include the opinion mining results. It mines the - * opinions of a sentence and conducts more granular analysis around the aspects in the text - * (also known as aspect-based sentiment analysis). - * - *

Code Sample

- *

Analyze the sentiments and mine the opinions for each sentence in a list of documents with a provided language - * representation and {@link AnalyzeSentimentOptions} options. Subscribes to the call asynchronously and prints out - * the sentiment and mined opinions details when a response is received.

- * - * {@codesnippet com.azure.ai.textanalytics.TextAnalyticsAsyncClient.analyzeSentimentBatch#Iterable-String-AnalyzeSentimentOptions} - * - * @param documents A list of documents to be analyzed. - * For text length limits, maximum batch size, and supported text encoding, see - * data limits. - * @param language The 2 letter ISO 639-1 representation of language for the document. If not set, uses "en" for - * English as default. - * @param options The additional configurable {@link AnalyzeSentimentOptions options} that may be passed when - * analyzing sentiments. - * - * @return A {@link Mono} contains a {@link AnalyzeSentimentResultCollection}. - * - * @throws NullPointerException if {@code documents} is null. - * @throws IllegalArgumentException if {@code documents} is empty. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono analyzeSentimentBatch(Iterable documents, - String language, AnalyzeSentimentOptions options) { try { return analyzeSentimentBatchWithResponse( mapByIndex(documents, (index, value) -> { @@ -961,45 +727,11 @@ public Mono analyzeSentimentBatch(Iterable> analyzeSentimentBatchWithResponse( Iterable documents, TextAnalyticsRequestOptions options) { - return analyzeSentimentAsyncClient.analyzeSentimentBatch(documents, new AnalyzeSentimentOptions() - .setIncludeStatistics(options == null ? false : options.isIncludeStatistics()) - .setModelVersion(options == null ? null : options.getModelVersion())); - } - - /** - * Returns a sentiment prediction, as well as confidence scores for each sentiment label (Positive, Negative, and - * Neutral) for the document and each sentence within it. If the {@code includeOpinionMining} of - * {@link AnalyzeSentimentOptions} set to true, the output will include the opinion mining results. It mines the - * opinions of a sentence and conducts more granular analysis around the aspects in the text - * (also known as aspect-based sentiment analysis). - * - *

Code Sample

- *

Analyze sentiment and mine the opinions for each sentence in a list of - * {@link TextDocumentInput document} with provided {@link AnalyzeSentimentOptions} options. Subscribes to the call - * asynchronously and prints out the sentiment and mined opinions details when a response is received.

- * - * {@codesnippet com.azure.ai.textanalytics.TextAnalyticsAsyncClient.analyzeSentimentBatch#Iterable-AnalyzeSentimentOptions} - * - * @param documents A list of {@link TextDocumentInput documents} to be analyzed. - * For text length limits, maximum batch size, and supported text encoding, see - * data limits. - * @param options The additional configurable {@link AnalyzeSentimentOptions options} that may be passed when - * analyzing sentiments. - * - * @return A {@link Mono} contains a {@link Response} that contains a {@link AnalyzeSentimentResultCollection}. - * - * @throws NullPointerException if {@code documents} is null. - * @throws IllegalArgumentException if {@code documents} is empty. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> analyzeSentimentBatchWithResponse( - Iterable documents, AnalyzeSentimentOptions options) { return analyzeSentimentAsyncClient.analyzeSentimentBatch(documents, options); } } diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsClient.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsClient.java index 194577388a9d2..71e2427f70c05 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsClient.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsClient.java @@ -3,27 +3,23 @@ package com.azure.ai.textanalytics; -import com.azure.ai.textanalytics.models.AnalyzeSentimentOptions; +import com.azure.ai.textanalytics.util.AnalyzeSentimentResultCollection; import com.azure.ai.textanalytics.models.CategorizedEntity; import com.azure.ai.textanalytics.models.CategorizedEntityCollection; import com.azure.ai.textanalytics.models.DetectLanguageInput; +import com.azure.ai.textanalytics.util.DetectLanguageResultCollection; import com.azure.ai.textanalytics.models.DetectedLanguage; import com.azure.ai.textanalytics.models.DocumentSentiment; +import com.azure.ai.textanalytics.util.ExtractKeyPhrasesResultCollection; import com.azure.ai.textanalytics.models.KeyPhrasesCollection; import com.azure.ai.textanalytics.models.LinkedEntity; import com.azure.ai.textanalytics.models.LinkedEntityCollection; -import com.azure.ai.textanalytics.models.PiiEntityCollection; -import com.azure.ai.textanalytics.models.RecognizePiiEntityOptions; +import com.azure.ai.textanalytics.util.RecognizeEntitiesResultCollection; +import com.azure.ai.textanalytics.util.RecognizeLinkedEntitiesResultCollection; import com.azure.ai.textanalytics.models.TextAnalyticsError; import com.azure.ai.textanalytics.models.TextAnalyticsException; import com.azure.ai.textanalytics.models.TextAnalyticsRequestOptions; import com.azure.ai.textanalytics.models.TextDocumentInput; -import com.azure.ai.textanalytics.util.AnalyzeSentimentResultCollection; -import com.azure.ai.textanalytics.util.DetectLanguageResultCollection; -import com.azure.ai.textanalytics.util.ExtractKeyPhrasesResultCollection; -import com.azure.ai.textanalytics.util.RecognizeEntitiesResultCollection; -import com.azure.ai.textanalytics.util.RecognizeLinkedEntitiesResultCollection; -import com.azure.ai.textanalytics.util.RecognizePiiEntitiesResultCollection; import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceClient; import com.azure.core.annotation.ServiceMethod; @@ -96,7 +92,7 @@ public String getDefaultLanguage() { * * @return The {@link DetectedLanguage detected language} of the document. * - * @throws NullPointerException if {@code document} is null. + * @throws NullPointerException if {@code document} is {@code null}. */ @ServiceMethod(returns = ReturnType.SINGLE) public DetectedLanguage detectLanguage(String document) { @@ -120,7 +116,7 @@ public DetectedLanguage detectLanguage(String document) { * * @return The {@link DetectedLanguage detected language} of the document. * - * @throws NullPointerException if {@code document} is null. + * @throws NullPointerException if {@code document} is {@code null}. */ @ServiceMethod(returns = ReturnType.SINGLE) public DetectedLanguage detectLanguage(String document, String countryHint) { @@ -145,7 +141,7 @@ public DetectedLanguage detectLanguage(String document, String countryHint) { * * @return A {@link DetectLanguageResultCollection}. * - * @throws NullPointerException if {@code documents} is null. + * @throws NullPointerException if {@code documents} is {@code null}. * @throws IllegalArgumentException if {@code documents} is empty. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -172,7 +168,7 @@ public DetectLanguageResultCollection detectLanguageBatch( * * @return A {@link Response} that contains a {@link DetectLanguageResultCollection}. * - * @throws NullPointerException if {@code documents} is null. + * @throws NullPointerException if {@code documents} is {@code null}. * @throws IllegalArgumentException if {@code documents} is empty. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -188,7 +184,7 @@ public Response detectLanguageBatchWithResponse( * * For a list of supported entity types, check: this * - * This method will use the default language that can be set by using method + * This method will use the default language that sets up in * {@link TextAnalyticsClientBuilder#defaultLanguage(String)}. If none is specified, service will use 'en' as * the language. * @@ -196,14 +192,14 @@ public Response detectLanguageBatchWithResponse( *

Recognize the entities of documents

* {@codesnippet com.azure.ai.textanalytics.TextAnalyticsClient.recognizeCategorizedEntities#String} * - * @param document The document to recognize entities for. + * @param document the document to recognize entities for. * For text length limits, maximum batch size, and supported text encoding, see * data limits. * * @return A {@link CategorizedEntityCollection} contains a list of * {@link CategorizedEntity recognized categorized entities} and warnings. * - * @throws NullPointerException if {@code document} is null. + * @throws NullPointerException if {@code document} is {@code null}. * @throws TextAnalyticsException if the response returned with an {@link TextAnalyticsError error}. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -229,11 +225,12 @@ public CategorizedEntityCollection recognizeEntities(String document) { * @return The {@link CategorizedEntityCollection} contains a list of * {@link CategorizedEntity recognized categorized entities} and warnings. * - * @throws NullPointerException if {@code document} is null. + * @throws NullPointerException if {@code document} is {@code null}. * @throws TextAnalyticsException if the response returned with an {@link TextAnalyticsError error}. */ @ServiceMethod(returns = ReturnType.SINGLE) public CategorizedEntityCollection recognizeEntities(String document, String language) { + Objects.requireNonNull(document, "'document' cannot be null."); return client.recognizeEntities(document, language).block(); } @@ -254,7 +251,7 @@ public CategorizedEntityCollection recognizeEntities(String document, String lan * * @return A {@link RecognizeEntitiesResultCollection}. * - * @throws NullPointerException if {@code documents} is null. + * @throws NullPointerException if {@code documents} is {@code null}. * @throws IllegalArgumentException if {@code documents} is empty. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -282,7 +279,7 @@ public RecognizeEntitiesResultCollection recognizeEntitiesBatch( * * @return A {@link Response} that contains a {@link RecognizeEntitiesResultCollection}. * - * @throws NullPointerException if {@code documents} is null. + * @throws NullPointerException if {@code documents} is {@code null}. * @throws IllegalArgumentException if {@code documents} is empty. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -292,155 +289,12 @@ public Response recognizeEntitiesBatchWithRes return client.recognizeEntityAsyncClient.recognizeEntitiesBatchWithContext(documents, options, context).block(); } - // PII Entity - /** - * Returns a list of Personally Identifiable Information(PII) entities in the provided document. - * - * For a list of supported entity types, check: this - * For a list of enabled languages, check: this. This method will use the - * default language that is set using {@link TextAnalyticsClientBuilder#defaultLanguage(String)}. If none is - * specified, service will use 'en' as the language. - * - *

Code Sample

- *

Recognize the PII entities details in a document.

- * - * {@codesnippet com.azure.ai.textanalytics.TextAnalyticsClient.recognizePiiEntities#String} - * - * @param document The document to recognize PII entities details for. - * For text length limits, maximum batch size, and supported text encoding, see - * data limits. - * - * @return A {@link PiiEntityCollection recognized PII entities collection}. - * - * @throws NullPointerException if {@code document} is null. - * @throws TextAnalyticsException if the response returned with an {@link TextAnalyticsError error}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public PiiEntityCollection recognizePiiEntities(String document) { - return recognizePiiEntities(document, client.getDefaultLanguage()); - } - - /** - * Returns a list of Personally Identifiable Information(PII) entities in the provided document - * with provided language code. - * - * For a list of supported entity types, check: this - * For a list of enabled languages, check: this - * - *

Code Sample

- *

Recognizes the PII entities details in a document with a provided language code.

- * - * {@codesnippet com.azure.ai.textanalytics.TextAnalyticsClient.recognizePiiEntities#String-String} - * - * @param document The document to recognize PII entities details for. - * For text length limits, maximum batch size, and supported text encoding, see - * data limits. - * @param language The 2 letter ISO 639-1 representation of language. If not set, uses "en" for English as default. - * - * @return The {@link PiiEntityCollection recognized PII entities collection}. - * - * @throws NullPointerException if {@code document} is null. - * @throws TextAnalyticsException if the response returned with an {@link TextAnalyticsError error}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public PiiEntityCollection recognizePiiEntities(String document, String language) { - return client.recognizePiiEntities(document, language).block(); - } - - /** - * Returns a list of Personally Identifiable Information(PII) entities in the provided document - * with provided language code. - * - * For a list of supported entity types, check: this - * For a list of enabled languages, check: this - * - *

Code Sample

- *

Recognizes the PII entities details in a document with a provided language code and - * RecognizePiiEntityOptions.

- * - * {@codesnippet com.azure.ai.textanalytics.TextAnalyticsClient.recognizePiiEntities#String-String-RecognizePiiEntityOptions} - * - * @param document The document to recognize PII entities details for. - * For text length limits, maximum batch size, and supported text encoding, see - * data limits. - * @param language The 2 letter ISO 639-1 representation of language. If not set, uses "en" for English as default. - * @param options The additional configurable {@link RecognizePiiEntityOptions options} that may be passed when - * recognizing PII entities. - * - * @return The {@link PiiEntityCollection recognized PII entities collection}. - * - * @throws NullPointerException if {@code document} is null. - * @throws TextAnalyticsException if the response returned with an {@link TextAnalyticsError error}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public PiiEntityCollection recognizePiiEntities(String document, String language, - RecognizePiiEntityOptions options) { - return client.recognizePiiEntities(document, language, options).block(); - } - - /** - * Returns a list of Personally Identifiable Information(PII) entities for the provided list of documents with - * provided language code and request options. - * - *

Code Sample

- *

Recognizes the PII entities details in a list of documents with a provided language code - * and request options.

- * - * {@codesnippet com.azure.ai.textanalytics.TextAnalyticsClient.recognizePiiEntitiesBatch#Iterable-String-RecognizePiiEntityOptions} - * - * @param documents A list of documents to recognize PII entities for. - * For text length limits, maximum batch size, and supported text encoding, see - * data limits. - * @param language The 2 letter ISO 639-1 representation of language. If not set, uses "en" for English as default. - * @param options The additional configurable {@link RecognizePiiEntityOptions options} that may be passed when - * recognizing PII entities. - * - * @return A {@link RecognizePiiEntitiesResultCollection}. - * - * @throws NullPointerException if {@code documents} is null. - * @throws IllegalArgumentException if {@code documents} is empty. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public RecognizePiiEntitiesResultCollection recognizePiiEntitiesBatch( - Iterable documents, String language, RecognizePiiEntityOptions options) { - return client.recognizePiiEntitiesBatch(documents, language, options).block(); - } - - /** - * Returns a list of Personally Identifiable Information(PII) entities for the provided list of - * {@link TextDocumentInput document} with provided request options. - * - *

Code Sample

- *

Recognizes the PII entities details with http response in a list of {@link TextDocumentInput document} - * with provided request options.

- * - * {@codesnippet com.azure.ai.textanalytics.TextAnalyticsClient.recognizePiiEntitiesBatch#Iterable-RecognizePiiEntityOptions-Context} - * - * @param documents A list of {@link TextDocumentInput documents} to recognize PII entities for. - * For text length limits, maximum batch size, and supported text encoding, see - * data limits. - * @param options The additional configurable {@link RecognizePiiEntityOptions options} that may be passed when - * recognizing PII entities. - * @param context Additional context that is passed through the Http pipeline during the service call. - * - * @return A {@link Response} that contains a {@link RecognizePiiEntitiesResultCollection}. - * - * @throws NullPointerException if {@code documents} is null. - * @throws IllegalArgumentException if {@code documents} is empty. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response recognizePiiEntitiesBatchWithResponse( - Iterable documents, RecognizePiiEntityOptions options, Context context) { - return client.recognizePiiEntityAsyncClient.recognizePiiEntitiesBatchWithContext(documents, options, - context).block(); - } - // Linked Entities /** * Returns a list of recognized entities with links to a well-known knowledge base for the provided document. * See this for supported languages in Text Analytics API. * - * This method will use the default language that can be set by using method + * This method will use the default language that sets up in * {@link TextAnalyticsClientBuilder#defaultLanguage(String)}. If none is specified, service will use 'en' as * the language. * @@ -448,13 +302,13 @@ public Response recognizePiiEntitiesBatchW *

Recognize the linked entities of documents

* {@codesnippet com.azure.ai.textanalytics.TextAnalyticsClient.recognizeLinkedEntities#String} * - * @param document The document to recognize linked entities for. + * @param document the document to recognize linked entities for. * For text length limits, maximum batch size, and supported text encoding, see * data limits. * * @return A {@link LinkedEntityCollection} contains a list of {@link LinkedEntity recognized linked entities}. * - * @throws NullPointerException if {@code document} is null. + * @throws NullPointerException if {@code document} is {@code null}. * @throws TextAnalyticsException if the response returned with an {@link TextAnalyticsError error}. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -480,7 +334,7 @@ public LinkedEntityCollection recognizeLinkedEntities(String document) { * * @return A {@link LinkedEntityCollection} contains a list of {@link LinkedEntity recognized linked entities}. * - * @throws NullPointerException if {@code document} is null. + * @throws NullPointerException if {@code document} is {@code null}. * @throws TextAnalyticsException if the response returned with an {@link TextAnalyticsError error}. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -510,7 +364,7 @@ public LinkedEntityCollection recognizeLinkedEntities(String document, String la * * @return A {@link RecognizeLinkedEntitiesResultCollection}. * - * @throws NullPointerException if {@code documents} is null. + * @throws NullPointerException if {@code documents} is {@code null}. * @throws IllegalArgumentException if {@code documents} is empty. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -540,7 +394,7 @@ public RecognizeLinkedEntitiesResultCollection recognizeLinkedEntitiesBatch( * * @return A {@link Response} that contains a {@link RecognizeLinkedEntitiesResultCollection}. * - * @throws NullPointerException if {@code documents} is null. + * @throws NullPointerException if {@code documents} is {@code null}. * @throws IllegalArgumentException if {@code documents} is empty. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -556,7 +410,7 @@ public RecognizeLinkedEntitiesResultCollection recognizeLinkedEntitiesBatch( /** * Returns a list of strings denoting the key phrases in the document. * - * This method will use the default language that can be set by using method + * This method will use the default language that sets up in * {@link TextAnalyticsClientBuilder#defaultLanguage(String)}. If none is specified, service will use 'en' as * the language. * @@ -570,7 +424,7 @@ public RecognizeLinkedEntitiesResultCollection recognizeLinkedEntitiesBatch( * * @return A {@link KeyPhrasesCollection} contains a list of extracted key phrases. * - * @throws NullPointerException if {@code document} is null. + * @throws NullPointerException if {@code document} is {@code null}. * @throws TextAnalyticsException if the response returned with an {@link TextAnalyticsError error}. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -594,7 +448,7 @@ public KeyPhrasesCollection extractKeyPhrases(String document) { * * @return A {@link KeyPhrasesCollection} contains a list of extracted key phrases. * - * @throws NullPointerException if {@code document} is null. + * @throws NullPointerException if {@code document} is {@code null}. * @throws TextAnalyticsException if the response returned with an {@link TextAnalyticsError error}. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -623,7 +477,7 @@ public KeyPhrasesCollection extractKeyPhrases(String document, String language) * * @return A {@link ExtractKeyPhrasesResultCollection}. * - * @throws NullPointerException if {@code documents} is null. + * @throws NullPointerException if {@code documents} is {@code null}. * @throws IllegalArgumentException if {@code documents} is empty. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -652,7 +506,7 @@ public ExtractKeyPhrasesResultCollection extractKeyPhrasesBatch( * * @return A {@link Response} that contains a {@link ExtractKeyPhrasesResultCollection}. * - * @throws NullPointerException if {@code documents} is null. + * @throws NullPointerException if {@code documents} is {@code null}. * @throws IllegalArgumentException if {@code documents} is empty. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -666,15 +520,14 @@ public Response extractKeyPhrasesBatchWithRes // Sentiment /** * Returns a sentiment prediction, as well as confidence scores for each sentiment label - * (Positive, Negative, and Neutral) for the document and each sentence within it. + * (Positive, Negative, and Neutral) for the document and each sentence within i * - * This method will use the default language that can be set by using method + * This method will use the default language that sets up in * {@link TextAnalyticsClientBuilder#defaultLanguage(String)}. If none is specified, service will use 'en' as * the language. * *

Code Sample

*

Analyze the sentiments of documents

- * * {@codesnippet com.azure.ai.textanalytics.TextAnalyticsClient.analyzeSentiment#String} * * @param document The document to be analyzed. @@ -683,7 +536,7 @@ public Response extractKeyPhrasesBatchWithRes * * @return A {@link DocumentSentiment analyzed document sentiment} of the document. * - * @throws NullPointerException if {@code document} is null. + * @throws NullPointerException if {@code document} is {@code null}. * @throws TextAnalyticsException if the response returned with an {@link TextAnalyticsError error}. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -693,11 +546,10 @@ public DocumentSentiment analyzeSentiment(String document) { /** * Returns a sentiment prediction, as well as confidence scores for each sentiment label - * (Positive, Negative, and Neutral) for the document and each sentence within it. + * (Positive, Negative, and Neutral) for the document and each sentence within i * *

Code Sample

*

Analyze the sentiments in a document with a provided language representation.

- * * {@codesnippet com.azure.ai.textanalytics.TextAnalyticsClient.analyzeSentiment#String-String} * * @param document The document to be analyzed. @@ -708,45 +560,15 @@ public DocumentSentiment analyzeSentiment(String document) { * * @return A {@link DocumentSentiment analyzed document sentiment} of the document. * - * @throws NullPointerException if {@code document} is null. + * @throws NullPointerException if {@code document} is {@code null}. * @throws TextAnalyticsException if the response returned with an {@link TextAnalyticsError error}. */ @ServiceMethod(returns = ReturnType.SINGLE) public DocumentSentiment analyzeSentiment(String document, String language) { + Objects.requireNonNull(document, "'document' cannot be null."); return client.analyzeSentiment(document, language).block(); } - /** - * Returns a sentiment prediction, as well as confidence scores for each sentiment label (Positive, Negative, and - * Neutral) for the document and each sentence within it. If the {@code includeOpinionMining} of - * {@link AnalyzeSentimentOptions} set to true, the output will include the opinion mining results. It mines the - * opinions of a sentence and conducts more granular analysis around the aspects in the text - * (also known as aspect-based sentiment analysis). - * - *

Code Sample

- *

Analyze the sentiment and mine the opinions for each sentence in a document with a provided language - * representation and {@link AnalyzeSentimentOptions} options.

- * - * {@codesnippet com.azure.ai.textanalytics.TextAnalyticsClient.analyzeSentiment#String-String-AnalyzeSentimentOptions} - * - * @param document The document to be analyzed. - * For text length limits, maximum batch size, and supported text encoding, see - * data limits. - * @param language The 2 letter ISO 639-1 representation of language for the document. If not set, uses "en" for - * English as default. - * @param options The additional configurable {@link AnalyzeSentimentOptions options} that may be passed when - * analyzing sentiments. - * - * @return A {@link DocumentSentiment analyzed document sentiment} of the document. - * - * @throws NullPointerException if {@code document} is null. - * @throws TextAnalyticsException if the response returned with an {@link TextAnalyticsError error}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public DocumentSentiment analyzeSentiment(String document, String language, AnalyzeSentimentOptions options) { - return client.analyzeSentiment(document, language, options).block(); - } - /** * Returns a sentiment prediction, as well as confidence scores for each sentiment label * (Positive, Negative, and Neutral) for the document and each sentence within it. @@ -765,44 +587,13 @@ public DocumentSentiment analyzeSentiment(String document, String language, Anal * * @return A {@link AnalyzeSentimentResultCollection}. * - * @throws NullPointerException if {@code documents} is null. + * @throws NullPointerException if {@code documents} is {@code null}. * @throws IllegalArgumentException if {@code documents} is empty. */ @ServiceMethod(returns = ReturnType.SINGLE) public AnalyzeSentimentResultCollection analyzeSentimentBatch( Iterable documents, String language, TextAnalyticsRequestOptions options) { - return client.analyzeSentimentBatch(documents, language, options).block(); - } - - /** - * Returns a sentiment prediction, as well as confidence scores for each sentiment label (Positive, Negative, and - * Neutral) for the document and each sentence within it. If the {@code includeOpinionMining} of - * {@link AnalyzeSentimentOptions} set to true, the output will include the opinion mining results. It mines the - * opinions of a sentence and conducts more granular analysis around the aspects in the text - * (also known as aspect-based sentiment analysis). - * - *

Code Sample

- *

Analyze the sentiments and mine the opinions for each sentence in a list of documents with a provided language - * representation and {@link AnalyzeSentimentOptions} options.

- * - * {@codesnippet com.azure.ai.textanalytics.TextAnalyticsClient.analyzeSentimentBatch#Iterable-String-AnalyzeSentimentOptions} - * - * @param documents A list of documents to be analyzed. - * For text length limits, maximum batch size, and supported text encoding, see - * data limits. - * @param language The 2 letter ISO 639-1 representation of language for the documents. If not set, uses "en" for - * English as default. - * @param options The additional configurable {@link AnalyzeSentimentOptions options} that may be passed when - * analyzing sentiments. - * - * @return A {@link AnalyzeSentimentResultCollection}. - * - * @throws NullPointerException if {@code documents} is null. - * @throws IllegalArgumentException if {@code documents} is empty. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public AnalyzeSentimentResultCollection analyzeSentimentBatch(Iterable documents, - String language, AnalyzeSentimentOptions options) { + inputDocumentsValidation(documents); return client.analyzeSentimentBatch(documents, language, options).block(); } @@ -811,8 +602,8 @@ public AnalyzeSentimentResultCollection analyzeSentimentBatch(Iterable d * (Positive, Negative, and Neutral) for the document and each sentence within it. * *

Code Sample

- *

Analyze sentiment in a list of {@link TextDocumentInput document} with provided request options.

- * + *

Analyze the sentiments with http response in a list of {@link TextDocumentInput documents} with request + * options.

* {@codesnippet com.azure.ai.textanalytics.TextAnalyticsClient.analyzeSentimentBatch#Iterable-TextAnalyticsRequestOptions-Context} * * @param documents A list of {@link TextDocumentInput documents} to be analyzed. @@ -824,46 +615,13 @@ public AnalyzeSentimentResultCollection analyzeSentimentBatch(Iterable d * * @return A {@link Response} that contains a {@link AnalyzeSentimentResultCollection}. * - * @throws NullPointerException if {@code documents} is null. + * @throws NullPointerException if {@code documents} is {@code null}. * @throws IllegalArgumentException if {@code documents} is empty. */ @ServiceMethod(returns = ReturnType.SINGLE) public Response analyzeSentimentBatchWithResponse( Iterable documents, TextAnalyticsRequestOptions options, Context context) { - return client.analyzeSentimentAsyncClient.analyzeSentimentBatchWithContext(documents, - new AnalyzeSentimentOptions() - .setIncludeStatistics(options == null ? false : options.isIncludeStatistics()) - .setModelVersion(options == null ? null : options.getModelVersion()), context).block(); - } - - /** - * Returns a sentiment prediction, as well as confidence scores for each sentiment label (Positive, Negative, and - * Neutral) for the document and each sentence within it. If the {@code includeOpinionMining} of - * {@link AnalyzeSentimentOptions} set to true, the output will include the opinion mining results. It mines the - * opinions of a sentence and conducts more granular analysis around the aspects in the text - * (also known as aspect-based sentiment analysis). - * - *

Code Sample

- *

Analyze sentiment and mine the opinions for each sentence in a list of - * {@link TextDocumentInput document} with provided {@link AnalyzeSentimentOptions} options.

- * - * {@codesnippet com.azure.ai.textanalytics.TextAnalyticsClient.analyzeSentimentBatch#Iterable-AnalyzeSentimentOptions-Context} - * - * @param documents A list of {@link TextDocumentInput documents} to be analyzed. - * For text length limits, maximum batch size, and supported text encoding, see - * data limits. - * @param options The additional configurable {@link AnalyzeSentimentOptions options} that may be passed when - * analyzing sentiments. - * @param context Additional context that is passed through the Http pipeline during the service call. - * - * @return A {@link Response} that contains a {@link AnalyzeSentimentResultCollection}. - * - * @throws NullPointerException if {@code documents} is null. - * @throws IllegalArgumentException if {@code documents} is empty. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response analyzeSentimentBatchWithResponse( - Iterable documents, AnalyzeSentimentOptions options, Context context) { + inputDocumentsValidation(documents); return client.analyzeSentimentAsyncClient.analyzeSentimentBatchWithContext(documents, options, context).block(); } } diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsClientBuilder.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsClientBuilder.java index 7b45936e81500..b78dfeac66104 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsClientBuilder.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsClientBuilder.java @@ -200,7 +200,7 @@ public TextAnalyticsAsyncClient buildAsyncClient() { final TextAnalyticsClientImpl textAnalyticsAPI = new TextAnalyticsClientImplBuilder() .endpoint(endpoint) .pipeline(pipeline) - .buildClient(); + .build(); return new TextAnalyticsAsyncClient(textAnalyticsAPI, serviceVersion, defaultCountryHint, defaultLanguage); } @@ -259,7 +259,7 @@ public TextAnalyticsClientBuilder endpoint(String endpoint) { * * @param keyCredential {@link AzureKeyCredential} API key credential * @return The updated {@link TextAnalyticsClientBuilder} object. - * @throws NullPointerException If {@code keyCredential} is null + * @throws NullPointerException If {@code keyCredential} is {@code null} */ public TextAnalyticsClientBuilder credential(AzureKeyCredential keyCredential) { this.credential = Objects.requireNonNull(keyCredential, "'keyCredential' cannot be null."); @@ -271,7 +271,7 @@ public TextAnalyticsClientBuilder credential(AzureKeyCredential keyCredential) { * * @param tokenCredential {@link TokenCredential} used to authenticate HTTP requests. * @return The updated {@link TextAnalyticsClientBuilder} object. - * @throws NullPointerException If {@code tokenCredential} is null. + * @throws NullPointerException If {@code tokenCredential} is {@code null}. */ public TextAnalyticsClientBuilder credential(TokenCredential tokenCredential) { Objects.requireNonNull(tokenCredential, "'tokenCredential' cannot be null."); @@ -297,7 +297,7 @@ public TextAnalyticsClientBuilder httpLogOptions(HttpLogOptions logOptions) { * * @param policy The retry policy for service requests. * @return The updated {@link TextAnalyticsClientBuilder} object. - * @throws NullPointerException If {@code policy} is null. + * @throws NullPointerException If {@code policy} is {@code null}. */ public TextAnalyticsClientBuilder addPolicy(HttpPipelinePolicy policy) { policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsServiceVersion.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsServiceVersion.java index d71d1b2bdf3d1..0dff36a6128a6 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsServiceVersion.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsServiceVersion.java @@ -9,8 +9,7 @@ * The versions of Azure Text Analytics supported by this client library. */ public enum TextAnalyticsServiceVersion implements ServiceVersion { - V3_0("v3.0"), - V3_1_PREVIEW_2("v3.1-preview.2"); + V3_0("v3.0"); private final String version; @@ -32,7 +31,7 @@ public String getVersion() { * @return the latest {@link TextAnalyticsServiceVersion} */ public static TextAnalyticsServiceVersion getLatest() { - return V3_1_PREVIEW_2; + return V3_0; } } diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/TextAnalyticsClientImpl.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/TextAnalyticsClientImpl.java index 358912b3727d0..858589603bdcc 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/TextAnalyticsClientImpl.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/TextAnalyticsClientImpl.java @@ -6,14 +6,12 @@ import com.azure.ai.textanalytics.implementation.models.EntitiesResult; import com.azure.ai.textanalytics.implementation.models.EntityLinkingResult; -import com.azure.ai.textanalytics.implementation.models.ErrorResponseException; import com.azure.ai.textanalytics.implementation.models.KeyPhraseResult; import com.azure.ai.textanalytics.implementation.models.LanguageBatchInput; import com.azure.ai.textanalytics.implementation.models.LanguageResult; import com.azure.ai.textanalytics.implementation.models.MultiLanguageBatchInput; -import com.azure.ai.textanalytics.implementation.models.PiiEntitiesResult; import com.azure.ai.textanalytics.implementation.models.SentimentResponse; -import com.azure.ai.textanalytics.implementation.models.StringIndexType; +import com.azure.ai.textanalytics.implementation.models.TextAnalyticsErrorException; import com.azure.core.annotation.BodyParam; import com.azure.core.annotation.ExpectedResponses; import com.azure.core.annotation.Host; @@ -29,298 +27,272 @@ import com.azure.core.http.policy.CookiePolicy; import com.azure.core.http.policy.RetryPolicy; import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.Response; import com.azure.core.http.rest.RestProxy; +import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; import reactor.core.publisher.Mono; -/** Initializes a new instance of the TextAnalyticsClient type. */ +/** + * Initializes a new instance of the TextAnalyticsClient type. + */ public final class TextAnalyticsClientImpl { - /** The proxy service used to perform REST calls. */ + /** + * The proxy service used to perform REST calls. + */ private final TextAnalyticsClientService service; /** - * Supported Cognitive Services endpoints (protocol and hostname, for example: - * https://westus.api.cognitive.microsoft.com). + * Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com). */ - private final String endpoint; + private String endpoint; /** - * Gets Supported Cognitive Services endpoints (protocol and hostname, for example: - * https://westus.api.cognitive.microsoft.com). - * + * Gets Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com). + * * @return the endpoint value. */ public String getEndpoint() { return this.endpoint; } - /** The HTTP pipeline to send requests through. */ + /** + * Sets Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com). + * + * @param endpoint the endpoint value. + * @return the service client itself. + */ + public TextAnalyticsClientImpl setEndpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /** + * The HTTP pipeline to send requests through. + */ private final HttpPipeline httpPipeline; /** * Gets The HTTP pipeline to send requests through. - * + * * @return the httpPipeline value. */ public HttpPipeline getHttpPipeline() { return this.httpPipeline; } - /** Initializes an instance of TextAnalyticsClient client. */ - TextAnalyticsClientImpl(String endpoint) { - this( - new HttpPipelineBuilder() - .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()) - .build(), - endpoint); + /** + * Initializes an instance of TextAnalyticsClient client. + */ + public TextAnalyticsClientImpl() { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()).build()); } /** * Initializes an instance of TextAnalyticsClient client. - * + * * @param httpPipeline The HTTP pipeline to send requests through. */ - TextAnalyticsClientImpl(HttpPipeline httpPipeline, String endpoint) { + public TextAnalyticsClientImpl(HttpPipeline httpPipeline) { this.httpPipeline = httpPipeline; - this.endpoint = endpoint; this.service = RestProxy.create(TextAnalyticsClientService.class, this.httpPipeline); } /** - * The interface defining all the services for TextAnalyticsClient to be used by the proxy service to perform REST - * calls. + * The interface defining all the services for TextAnalyticsClient to be + * used by the proxy service to perform REST calls. */ - @Host("{Endpoint}/text/analytics/v3.1-preview.2") + @Host("{Endpoint}/text/analytics/v3.0") @ServiceInterface(name = "TextAnalyticsClient") private interface TextAnalyticsClientService { @Post("/entities/recognition/general") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorResponseException.class) - Mono> entitiesRecognitionGeneral( - @HostParam("Endpoint") String endpoint, - @QueryParam("model-version") String modelVersion, - @QueryParam("showStats") Boolean showStats, - @QueryParam("stringIndexType") StringIndexType stringIndexType, - @BodyParam("application/json") MultiLanguageBatchInput input, - Context context); - - @Post("/entities/recognition/pii") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorResponseException.class) - Mono> entitiesRecognitionPii( - @HostParam("Endpoint") String endpoint, - @QueryParam("model-version") String modelVersion, - @QueryParam("showStats") Boolean showStats, - @QueryParam("domain") String domain, - @QueryParam("stringIndexType") StringIndexType stringIndexType, - @BodyParam("application/json") MultiLanguageBatchInput input, - Context context); + @UnexpectedResponseExceptionType(TextAnalyticsErrorException.class) + Mono> entitiesRecognitionGeneral(@HostParam("Endpoint") String endpoint, @QueryParam("model-version") String modelVersion, @QueryParam("showStats") Boolean showStats, @BodyParam("application/json") MultiLanguageBatchInput input, Context context); @Post("/entities/linking") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorResponseException.class) - Mono> entitiesLinking( - @HostParam("Endpoint") String endpoint, - @QueryParam("model-version") String modelVersion, - @QueryParam("showStats") Boolean showStats, - @QueryParam("stringIndexType") StringIndexType stringIndexType, - @BodyParam("application/json") MultiLanguageBatchInput input, - Context context); + @UnexpectedResponseExceptionType(TextAnalyticsErrorException.class) + Mono> entitiesLinking(@HostParam("Endpoint") String endpoint, @QueryParam("model-version") String modelVersion, @QueryParam("showStats") Boolean showStats, @BodyParam("application/json") MultiLanguageBatchInput input, Context context); @Post("/keyPhrases") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorResponseException.class) - Mono> keyPhrases( - @HostParam("Endpoint") String endpoint, - @QueryParam("model-version") String modelVersion, - @QueryParam("showStats") Boolean showStats, - @BodyParam("application/json") MultiLanguageBatchInput input, - Context context); + @UnexpectedResponseExceptionType(TextAnalyticsErrorException.class) + Mono> keyPhrases(@HostParam("Endpoint") String endpoint, @QueryParam("model-version") String modelVersion, @QueryParam("showStats") Boolean showStats, @BodyParam("application/json") MultiLanguageBatchInput input, Context context); @Post("/languages") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorResponseException.class) - Mono> languages( - @HostParam("Endpoint") String endpoint, - @QueryParam("model-version") String modelVersion, - @QueryParam("showStats") Boolean showStats, - @BodyParam("application/json") LanguageBatchInput input, - Context context); + @UnexpectedResponseExceptionType(TextAnalyticsErrorException.class) + Mono> languages(@HostParam("Endpoint") String endpoint, @QueryParam("model-version") String modelVersion, @QueryParam("showStats") Boolean showStats, @BodyParam("application/json") LanguageBatchInput input, Context context); @Post("/sentiment") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorResponseException.class) - Mono> sentiment( - @HostParam("Endpoint") String endpoint, - @QueryParam("model-version") String modelVersion, - @QueryParam("showStats") Boolean showStats, - @QueryParam("opinionMining") Boolean opinionMining, - @QueryParam("stringIndexType") StringIndexType stringIndexType, - @BodyParam("application/json") MultiLanguageBatchInput input, - Context context); + @UnexpectedResponseExceptionType(TextAnalyticsErrorException.class) + Mono> sentiment(@HostParam("Endpoint") String endpoint, @QueryParam("model-version") String modelVersion, @QueryParam("showStats") Boolean showStats, @BodyParam("application/json") MultiLanguageBatchInput input, Context context); } /** - * The API returns a list of general named entities in a given document. For the list of supported entity types, - * check <a href="https://aka.ms/taner">Supported Entity Types in Text Analytics API</a>. See the <a - * href="https://aka.ms/talangs">Supported languages in Text Analytics API</a> for the list of enabled - * languages. - * + * The API returns a list of general named entities in a given document. For the list of supported entity types, check <a href="https://aka.ms/taner">Supported Entity Types in Text Analytics API</a>. See the <a href="https://aka.ms/talangs">Supported languages in Text Analytics API</a> for the list of enabled languages. + * * @param input Contains a set of input documents to be analyzed by the service. - * @param modelVersion (Optional) This value indicates which model will be used for scoring. If a model-version is - * not specified, the API should default to the latest, non-preview version. - * @param showStats (Optional) if set to true, response will contain request and document level statistics. - * @param stringIndexType (Optional) Specifies the method used to interpret string offsets. Defaults to Text - * Elements (Graphemes) according to Unicode v8.0.0. For additional information see - * https://aka.ms/text-analytics-offsets. - * @param context The context to associate with this operation. + * @param modelVersion (Optional) This value indicates which model will be used for scoring. If a model-version is not specified, the API should default to the latest, non-preview version. + * @param showStats (Optional) if set to true, response will contain input and document level statistics. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws TextAnalyticsErrorException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> entitiesRecognitionGeneralWithResponseAsync( - MultiLanguageBatchInput input, - String modelVersion, - Boolean showStats, - StringIndexType stringIndexType, - Context context) { - return service.entitiesRecognitionGeneral( - this.getEndpoint(), modelVersion, showStats, stringIndexType, input, context); + public Mono> entitiesRecognitionGeneralWithResponseAsync(MultiLanguageBatchInput input, String modelVersion, Boolean showStats) { + return FluxUtil.withContext(context -> service.entitiesRecognitionGeneral(this.getEndpoint(), modelVersion, showStats, input, context)); } /** - * The API returns a list of entities with personal information (\"SSN\", \"Bank Account\" etc) in the document. For - * the list of supported entity types, check <a href="https://aka.ms/tanerpii">Supported Entity Types in Text - * Analytics API</a>. See the <a href="https://aka.ms/talangs">Supported languages in Text Analytics - * API</a> for the list of enabled languages. - * + * The API returns a list of general named entities in a given document. For the list of supported entity types, check <a href="https://aka.ms/taner">Supported Entity Types in Text Analytics API</a>. See the <a href="https://aka.ms/talangs">Supported languages in Text Analytics API</a> for the list of enabled languages. + * * @param input Contains a set of input documents to be analyzed by the service. - * @param modelVersion (Optional) This value indicates which model will be used for scoring. If a model-version is - * not specified, the API should default to the latest, non-preview version. - * @param showStats (Optional) if set to true, response will contain request and document level statistics. - * @param domain (Optional) if set to 'PHI', response will contain only PHI entities. - * @param stringIndexType (Optional) Specifies the method used to interpret string offsets. Defaults to Text - * Elements (Graphemes) according to Unicode v8.0.0. For additional information see - * https://aka.ms/text-analytics-offsets. * @param context The context to associate with this operation. + * @param modelVersion (Optional) This value indicates which model will be used for scoring. If a model-version is not specified, the API should default to the latest, non-preview version. + * @param showStats (Optional) if set to true, response will contain input and document level statistics. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws TextAnalyticsErrorException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> entitiesRecognitionPiiWithResponseAsync( - MultiLanguageBatchInput input, - String modelVersion, - Boolean showStats, - String domain, - StringIndexType stringIndexType, - Context context) { - return service.entitiesRecognitionPii( - this.getEndpoint(), modelVersion, showStats, domain, stringIndexType, input, context); + public Mono> entitiesRecognitionGeneralWithResponseAsync(MultiLanguageBatchInput input, Context context, String modelVersion, Boolean showStats) { + return service.entitiesRecognitionGeneral(this.getEndpoint(), modelVersion, showStats, input, context); } /** - * The API returns a list of recognized entities with links to a well-known knowledge base. See the <a - * href="https://aka.ms/talangs">Supported languages in Text Analytics API</a> for the list of enabled - * languages. - * + * The API returns a list of recognized entities with links to a well-known knowledge base. See the <a href="https://aka.ms/talangs">Supported languages in Text Analytics API</a> for the list of enabled languages. + * + * @param input Contains a set of input documents to be analyzed by the service. + * @param modelVersion (Optional) This value indicates which model will be used for scoring. If a model-version is not specified, the API should default to the latest, non-preview version. + * @param showStats (Optional) if set to true, response will contain input and document level statistics. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws TextAnalyticsErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> entitiesLinkingWithResponseAsync(MultiLanguageBatchInput input, String modelVersion, Boolean showStats) { + return FluxUtil.withContext(context -> service.entitiesLinking(this.getEndpoint(), modelVersion, showStats, input, context)); + } + + /** + * The API returns a list of recognized entities with links to a well-known knowledge base. See the <a href="https://aka.ms/talangs">Supported languages in Text Analytics API</a> for the list of enabled languages. + * * @param input Contains a set of input documents to be analyzed by the service. - * @param modelVersion (Optional) This value indicates which model will be used for scoring. If a model-version is - * not specified, the API should default to the latest, non-preview version. - * @param showStats (Optional) if set to true, response will contain request and document level statistics. - * @param stringIndexType (Optional) Specifies the method used to interpret string offsets. Defaults to Text - * Elements (Graphemes) according to Unicode v8.0.0. For additional information see - * https://aka.ms/text-analytics-offsets. * @param context The context to associate with this operation. + * @param modelVersion (Optional) This value indicates which model will be used for scoring. If a model-version is not specified, the API should default to the latest, non-preview version. + * @param showStats (Optional) if set to true, response will contain input and document level statistics. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws TextAnalyticsErrorException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> entitiesLinkingWithResponseAsync( - MultiLanguageBatchInput input, - String modelVersion, - Boolean showStats, - StringIndexType stringIndexType, - Context context) { - return service.entitiesLinking(this.getEndpoint(), modelVersion, showStats, stringIndexType, input, context); + public Mono> entitiesLinkingWithResponseAsync(MultiLanguageBatchInput input, Context context, String modelVersion, Boolean showStats) { + return service.entitiesLinking(this.getEndpoint(), modelVersion, showStats, input, context); } /** - * The API returns a list of strings denoting the key phrases in the input text. See the <a - * href="https://aka.ms/talangs">Supported languages in Text Analytics API</a> for the list of enabled - * languages. - * + * The API returns a list of strings denoting the key phrases in the input text. See the <a href="https://aka.ms/talangs">Supported languages in Text Analytics API</a> for the list of enabled languages. + * + * @param input Contains a set of input documents to be analyzed by the service. + * @param modelVersion (Optional) This value indicates which model will be used for scoring. If a model-version is not specified, the API should default to the latest, non-preview version. + * @param showStats (Optional) if set to true, response will contain input and document level statistics. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws TextAnalyticsErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> keyPhrasesWithResponseAsync(MultiLanguageBatchInput input, String modelVersion, Boolean showStats) { + return FluxUtil.withContext(context -> service.keyPhrases(this.getEndpoint(), modelVersion, showStats, input, context)); + } + + /** + * The API returns a list of strings denoting the key phrases in the input text. See the <a href="https://aka.ms/talangs">Supported languages in Text Analytics API</a> for the list of enabled languages. + * * @param input Contains a set of input documents to be analyzed by the service. - * @param modelVersion (Optional) This value indicates which model will be used for scoring. If a model-version is - * not specified, the API should default to the latest, non-preview version. - * @param showStats (Optional) if set to true, response will contain request and document level statistics. * @param context The context to associate with this operation. + * @param modelVersion (Optional) This value indicates which model will be used for scoring. If a model-version is not specified, the API should default to the latest, non-preview version. + * @param showStats (Optional) if set to true, response will contain input and document level statistics. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws TextAnalyticsErrorException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> keyPhrasesWithResponseAsync( - MultiLanguageBatchInput input, String modelVersion, Boolean showStats, Context context) { + public Mono> keyPhrasesWithResponseAsync(MultiLanguageBatchInput input, Context context, String modelVersion, Boolean showStats) { return service.keyPhrases(this.getEndpoint(), modelVersion, showStats, input, context); } /** - * The API returns the detected language and a numeric score between 0 and 1. Scores close to 1 indicate 100% - * certainty that the identified language is true. See the <a href="https://aka.ms/talangs">Supported - * languages in Text Analytics API</a> for the list of enabled languages. - * - * @param input Collection of documents to analyze for language endpoint. - * @param modelVersion (Optional) This value indicates which model will be used for scoring. If a model-version is - * not specified, the API should default to the latest, non-preview version. - * @param showStats (Optional) if set to true, response will contain request and document level statistics. + * The API returns the detected language and a numeric score between 0 and 1. Scores close to 1 indicate 100% certainty that the identified language is true. See the <a href="https://aka.ms/talangs">Supported languages in Text Analytics API</a> for the list of enabled languages. + * + * @param input Collection of documents to analyze. + * @param modelVersion (Optional) This value indicates which model will be used for scoring. If a model-version is not specified, the API should default to the latest, non-preview version. + * @param showStats (Optional) if set to true, response will contain input and document level statistics. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws TextAnalyticsErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> languagesWithResponseAsync(LanguageBatchInput input, String modelVersion, Boolean showStats) { + return FluxUtil.withContext(context -> service.languages(this.getEndpoint(), modelVersion, showStats, input, context)); + } + + /** + * The API returns the detected language and a numeric score between 0 and 1. Scores close to 1 indicate 100% certainty that the identified language is true. See the <a href="https://aka.ms/talangs">Supported languages in Text Analytics API</a> for the list of enabled languages. + * + * @param input Collection of documents to analyze. * @param context The context to associate with this operation. + * @param modelVersion (Optional) This value indicates which model will be used for scoring. If a model-version is not specified, the API should default to the latest, non-preview version. + * @param showStats (Optional) if set to true, response will contain input and document level statistics. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws TextAnalyticsErrorException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> languagesWithResponseAsync( - LanguageBatchInput input, String modelVersion, Boolean showStats, Context context) { + public Mono> languagesWithResponseAsync(LanguageBatchInput input, Context context, String modelVersion, Boolean showStats) { return service.languages(this.getEndpoint(), modelVersion, showStats, input, context); } /** - * The API returns a detailed sentiment analysis for the input text. The analysis is done in multiple levels of - * granularity, start from the a document level, down to sentence and key terms (aspects) and opinions. - * + * The API returns a sentiment prediction, as well as sentiment scores for each sentiment class (Positive, Negative, and Neutral) for the document and each sentence within it. See the <a href="https://aka.ms/talangs">Supported languages in Text Analytics API</a> for the list of enabled languages. + * + * @param input Contains a set of input documents to be analyzed by the service. + * @param modelVersion (Optional) This value indicates which model will be used for scoring. If a model-version is not specified, the API should default to the latest, non-preview version. + * @param showStats (Optional) if set to true, response will contain input and document level statistics. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws TextAnalyticsErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sentimentWithResponseAsync(MultiLanguageBatchInput input, String modelVersion, Boolean showStats) { + return FluxUtil.withContext(context -> service.sentiment(this.getEndpoint(), modelVersion, showStats, input, context)); + } + + /** + * The API returns a sentiment prediction, as well as sentiment scores for each sentiment class (Positive, Negative, and Neutral) for the document and each sentence within it. See the <a href="https://aka.ms/talangs">Supported languages in Text Analytics API</a> for the list of enabled languages. + * * @param input Contains a set of input documents to be analyzed by the service. - * @param modelVersion (Optional) This value indicates which model will be used for scoring. If a model-version is - * not specified, the API should default to the latest, non-preview version. - * @param showStats (Optional) if set to true, response will contain request and document level statistics. - * @param opinionMining (Optional) if set to true, response will contain input and document level statistics - * including aspect-based sentiment analysis results. - * @param stringIndexType (Optional) Specifies the method used to interpret string offsets. Defaults to Text - * Elements (Graphemes) according to Unicode v8.0.0. For additional information see - * https://aka.ms/text-analytics-offsets. * @param context The context to associate with this operation. + * @param modelVersion (Optional) This value indicates which model will be used for scoring. If a model-version is not specified, the API should default to the latest, non-preview version. + * @param showStats (Optional) if set to true, response will contain input and document level statistics. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws TextAnalyticsErrorException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> sentimentWithResponseAsync( - MultiLanguageBatchInput input, - String modelVersion, - Boolean showStats, - Boolean opinionMining, - StringIndexType stringIndexType, - Context context) { - return service.sentiment( - this.getEndpoint(), modelVersion, showStats, opinionMining, stringIndexType, input, context); + public Mono> sentimentWithResponseAsync(MultiLanguageBatchInput input, Context context, String modelVersion, Boolean showStats) { + return service.sentiment(this.getEndpoint(), modelVersion, showStats, input, context); } } diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/TextAnalyticsClientImplBuilder.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/TextAnalyticsClientImplBuilder.java index 340cd55b60a3d..dc59d2fc68aac 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/TextAnalyticsClientImplBuilder.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/TextAnalyticsClientImplBuilder.java @@ -11,18 +11,18 @@ import com.azure.core.http.policy.RetryPolicy; import com.azure.core.http.policy.UserAgentPolicy; -/** A builder for creating a new instance of the TextAnalyticsClient type. */ -@ServiceClientBuilder(serviceClients = {TextAnalyticsClientImpl.class}) +/** + * A builder for creating a new instance of the TextAnalyticsClient type. + */ +@ServiceClientBuilder(serviceClients = TextAnalyticsClientImpl.class) public final class TextAnalyticsClientImplBuilder { /* - * Supported Cognitive Services endpoints (protocol and hostname, for - * example: https://westus.api.cognitive.microsoft.com). + * Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com). */ private String endpoint; /** - * Sets Supported Cognitive Services endpoints (protocol and hostname, for example: - * https://westus.api.cognitive.microsoft.com). + * Sets Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com). * * @param endpoint the endpoint value. * @return the TextAnalyticsClientImplBuilder. @@ -53,14 +53,14 @@ public TextAnalyticsClientImplBuilder pipeline(HttpPipeline pipeline) { * * @return an instance of TextAnalyticsClientImpl. */ - public TextAnalyticsClientImpl buildClient() { + public TextAnalyticsClientImpl build() { if (pipeline == null) { - this.pipeline = - new HttpPipelineBuilder() - .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()) - .build(); + this.pipeline = new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()).build(); + } + TextAnalyticsClientImpl client = new TextAnalyticsClientImpl(pipeline); + if (this.endpoint != null) { + client.setEndpoint(this.endpoint); } - TextAnalyticsClientImpl client = new TextAnalyticsClientImpl(pipeline, endpoint); return client; } } diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/Utility.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/Utility.java index c6f4a9c25c356..9555c37106f6e 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/Utility.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/Utility.java @@ -5,13 +5,13 @@ import com.azure.ai.textanalytics.implementation.models.DocumentStatistics; import com.azure.ai.textanalytics.implementation.models.ErrorCodeValue; -import com.azure.ai.textanalytics.implementation.models.ErrorResponseException; import com.azure.ai.textanalytics.implementation.models.InnerError; import com.azure.ai.textanalytics.implementation.models.InnerErrorCodeValue; import com.azure.ai.textanalytics.implementation.models.LanguageInput; import com.azure.ai.textanalytics.implementation.models.MultiLanguageInput; import com.azure.ai.textanalytics.implementation.models.RequestStatistics; import com.azure.ai.textanalytics.implementation.models.TextAnalyticsError; +import com.azure.ai.textanalytics.implementation.models.TextAnalyticsErrorException; import com.azure.ai.textanalytics.models.DetectLanguageInput; import com.azure.ai.textanalytics.models.TextAnalyticsErrorCode; import com.azure.ai.textanalytics.models.TextAnalyticsException; @@ -46,7 +46,7 @@ private Utility() { * * @param documents A list of documents. * - * @throws NullPointerException if {@code documents} is null. + * @throws NullPointerException if {@code documents} is {@code null}. * @throws IllegalArgumentException if {@code documents} is empty. */ public static void inputDocumentsValidation(Iterable documents) { @@ -103,17 +103,17 @@ public Mono getBodyAsString(Charset charset) { } /** - * Mapping a {@link ErrorResponseException} to {@link HttpResponseException} if exist. Otherwise, return + * Mapping a {@link TextAnalyticsErrorException} to {@link HttpResponseException} if exist. Otherwise, return * original {@link Throwable}. * * @param throwable A {@link Throwable}. * @return A {@link HttpResponseException} or the original throwable type. */ public static Throwable mapToHttpResponseExceptionIfExist(Throwable throwable) { - if (throwable instanceof ErrorResponseException) { - ErrorResponseException errorException = (ErrorResponseException) throwable; + if (throwable instanceof TextAnalyticsErrorException) { + TextAnalyticsErrorException errorException = (TextAnalyticsErrorException) throwable; return new HttpResponseException(errorException.getMessage(), errorException.getResponse(), - toTextAnalyticsError(errorException.getValue().getError())); + toTextAnalyticsError(errorException.getValue())); } return throwable; } diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AspectConfidenceScoreLabel.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AspectConfidenceScoreLabel.java deleted file mode 100644 index 668ede14eb525..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AspectConfidenceScoreLabel.java +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.ai.textanalytics.implementation.models; - -import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** The AspectConfidenceScoreLabel model. */ -@Fluent -public final class AspectConfidenceScoreLabel { - /* - * The positive property. - */ - @JsonProperty(value = "positive", required = true) - private double positive; - - /* - * The negative property. - */ - @JsonProperty(value = "negative", required = true) - private double negative; - - /** - * Get the positive property: The positive property. - * - * @return the positive value. - */ - public double getPositive() { - return this.positive; - } - - /** - * Set the positive property: The positive property. - * - * @param positive the positive value to set. - * @return the AspectConfidenceScoreLabel object itself. - */ - public AspectConfidenceScoreLabel setPositive(double positive) { - this.positive = positive; - return this; - } - - /** - * Get the negative property: The negative property. - * - * @return the negative value. - */ - public double getNegative() { - return this.negative; - } - - /** - * Set the negative property: The negative property. - * - * @param negative the negative value to set. - * @return the AspectConfidenceScoreLabel object itself. - */ - public AspectConfidenceScoreLabel setNegative(double negative) { - this.negative = negative; - return this; - } -} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AspectRelation.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AspectRelation.java deleted file mode 100644 index 05ce364475299..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AspectRelation.java +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.ai.textanalytics.implementation.models; - -import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** The AspectRelation model. */ -@Fluent -public final class AspectRelation { - /* - * The type related to the aspect. - */ - @JsonProperty(value = "relationType", required = true) - private AspectRelationType relationType; - - /* - * The JSON pointer indicating the linked object. - */ - @JsonProperty(value = "ref", required = true) - private String ref; - - /** - * Get the relationType property: The type related to the aspect. - * - * @return the relationType value. - */ - public AspectRelationType getRelationType() { - return this.relationType; - } - - /** - * Set the relationType property: The type related to the aspect. - * - * @param relationType the relationType value to set. - * @return the AspectRelation object itself. - */ - public AspectRelation setRelationType(AspectRelationType relationType) { - this.relationType = relationType; - return this; - } - - /** - * Get the ref property: The JSON pointer indicating the linked object. - * - * @return the ref value. - */ - public String getRef() { - return this.ref; - } - - /** - * Set the ref property: The JSON pointer indicating the linked object. - * - * @param ref the ref value to set. - * @return the AspectRelation object itself. - */ - public AspectRelation setRef(String ref) { - this.ref = ref; - return this; - } -} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AspectRelationType.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AspectRelationType.java deleted file mode 100644 index c50d3d7043713..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AspectRelationType.java +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.ai.textanalytics.implementation.models; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -/** Defines values for AspectRelationType. */ -public enum AspectRelationType { - /** Enum value opinion. */ - OPINION("opinion"), - - /** Enum value aspect. */ - ASPECT("aspect"); - - /** The actual serialized value for a AspectRelationType instance. */ - private final String value; - - AspectRelationType(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a AspectRelationType instance. - * - * @param value the serialized value to parse. - * @return the parsed AspectRelationType object, or null if unable to parse. - */ - @JsonCreator - public static AspectRelationType fromString(String value) { - AspectRelationType[] items = AspectRelationType.values(); - for (AspectRelationType item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - @JsonValue - @Override - public String toString() { - return this.value; - } -} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DetectedLanguage.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DetectedLanguage.java index db9538d2c0043..bd031227091f8 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DetectedLanguage.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DetectedLanguage.java @@ -7,7 +7,9 @@ import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; -/** The DetectedLanguage model. */ +/** + * The DetectedLanguage model. + */ @Fluent public final class DetectedLanguage { /* @@ -31,8 +33,9 @@ public final class DetectedLanguage { private double confidenceScore; /** - * Get the name property: Long name of a detected language (e.g. English, French). - * + * Get the name property: Long name of a detected language (e.g. English, + * French). + * * @return the name value. */ public String getName() { @@ -40,8 +43,9 @@ public String getName() { } /** - * Set the name property: Long name of a detected language (e.g. English, French). - * + * Set the name property: Long name of a detected language (e.g. English, + * French). + * * @param name the name value to set. * @return the DetectedLanguage object itself. */ @@ -51,9 +55,9 @@ public DetectedLanguage setName(String name) { } /** - * Get the iso6391Name property: A two letter representation of the detected language according to the ISO 639-1 - * standard (e.g. en, fr). - * + * Get the iso6391Name property: A two letter representation of the + * detected language according to the ISO 639-1 standard (e.g. en, fr). + * * @return the iso6391Name value. */ public String getIso6391Name() { @@ -61,9 +65,9 @@ public String getIso6391Name() { } /** - * Set the iso6391Name property: A two letter representation of the detected language according to the ISO 639-1 - * standard (e.g. en, fr). - * + * Set the iso6391Name property: A two letter representation of the + * detected language according to the ISO 639-1 standard (e.g. en, fr). + * * @param iso6391Name the iso6391Name value to set. * @return the DetectedLanguage object itself. */ @@ -73,9 +77,10 @@ public DetectedLanguage setIso6391Name(String iso6391Name) { } /** - * Get the confidenceScore property: A confidence score between 0 and 1. Scores close to 1 indicate 100% certainty - * that the identified language is true. - * + * Get the confidenceScore property: A confidence score between 0 and 1. + * Scores close to 1 indicate 100% certainty that the identified language + * is true. + * * @return the confidenceScore value. */ public double getConfidenceScore() { @@ -83,9 +88,10 @@ public double getConfidenceScore() { } /** - * Set the confidenceScore property: A confidence score between 0 and 1. Scores close to 1 indicate 100% certainty - * that the identified language is true. - * + * Set the confidenceScore property: A confidence score between 0 and 1. + * Scores close to 1 indicate 100% certainty that the identified language + * is true. + * * @param confidenceScore the confidenceScore value to set. * @return the DetectedLanguage object itself. */ diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentEntities.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentEntities.java index 19f70d0823d81..dd1637927928f 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentEntities.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentEntities.java @@ -8,7 +8,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; -/** The DocumentEntities model. */ +/** + * The DocumentEntities model. + */ @Fluent public final class DocumentEntities { /* @@ -38,7 +40,7 @@ public final class DocumentEntities { /** * Get the id property: Unique, non-empty document identifier. - * + * * @return the id value. */ public String getId() { @@ -47,7 +49,7 @@ public String getId() { /** * Set the id property: Unique, non-empty document identifier. - * + * * @param id the id value to set. * @return the DocumentEntities object itself. */ @@ -58,7 +60,7 @@ public DocumentEntities setId(String id) { /** * Get the entities property: Recognized entities in the document. - * + * * @return the entities value. */ public List getEntities() { @@ -67,7 +69,7 @@ public List getEntities() { /** * Set the entities property: Recognized entities in the document. - * + * * @param entities the entities value to set. * @return the DocumentEntities object itself. */ @@ -77,8 +79,9 @@ public DocumentEntities setEntities(List entities) { } /** - * Get the warnings property: Warnings encountered while processing document. - * + * Get the warnings property: Warnings encountered while processing + * document. + * * @return the warnings value. */ public List getWarnings() { @@ -86,8 +89,9 @@ public List getWarnings() { } /** - * Set the warnings property: Warnings encountered while processing document. - * + * Set the warnings property: Warnings encountered while processing + * document. + * * @param warnings the warnings value to set. * @return the DocumentEntities object itself. */ @@ -97,9 +101,9 @@ public DocumentEntities setWarnings(List warnings) { } /** - * Get the statistics property: if showStats=true was specified in the request this field will contain information - * about the document payload. - * + * Get the statistics property: if showStats=true was specified in the + * request this field will contain information about the document payload. + * * @return the statistics value. */ public DocumentStatistics getStatistics() { @@ -107,9 +111,9 @@ public DocumentStatistics getStatistics() { } /** - * Set the statistics property: if showStats=true was specified in the request this field will contain information - * about the document payload. - * + * Set the statistics property: if showStats=true was specified in the + * request this field will contain information about the document payload. + * * @param statistics the statistics value to set. * @return the DocumentEntities object itself. */ diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentError.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentError.java index cdcc457d59e3e..7d1ac563e085b 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentError.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentError.java @@ -7,7 +7,9 @@ import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; -/** The DocumentError model. */ +/** + * The DocumentError model. + */ @Fluent public final class DocumentError { /* @@ -24,7 +26,7 @@ public final class DocumentError { /** * Get the id property: Document Id. - * + * * @return the id value. */ public String getId() { @@ -33,7 +35,7 @@ public String getId() { /** * Set the id property: Document Id. - * + * * @param id the id value to set. * @return the DocumentError object itself. */ @@ -44,7 +46,7 @@ public DocumentError setId(String id) { /** * Get the error property: Document Error. - * + * * @return the error value. */ public TextAnalyticsError getError() { @@ -53,7 +55,7 @@ public TextAnalyticsError getError() { /** * Set the error property: Document Error. - * + * * @param error the error value to set. * @return the DocumentError object itself. */ diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentKeyPhrases.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentKeyPhrases.java index 7246406feabd5..98c442b0fe7d7 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentKeyPhrases.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentKeyPhrases.java @@ -8,7 +8,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; -/** The DocumentKeyPhrases model. */ +/** + * The DocumentKeyPhrases model. + */ @Fluent public final class DocumentKeyPhrases { /* @@ -39,7 +41,7 @@ public final class DocumentKeyPhrases { /** * Get the id property: Unique, non-empty document identifier. - * + * * @return the id value. */ public String getId() { @@ -48,7 +50,7 @@ public String getId() { /** * Set the id property: Unique, non-empty document identifier. - * + * * @param id the id value to set. * @return the DocumentKeyPhrases object itself. */ @@ -58,9 +60,10 @@ public DocumentKeyPhrases setId(String id) { } /** - * Get the keyPhrases property: A list of representative words or phrases. The number of key phrases returned is - * proportional to the number of words in the input document. - * + * Get the keyPhrases property: A list of representative words or phrases. + * The number of key phrases returned is proportional to the number of + * words in the input document. + * * @return the keyPhrases value. */ public List getKeyPhrases() { @@ -68,9 +71,10 @@ public List getKeyPhrases() { } /** - * Set the keyPhrases property: A list of representative words or phrases. The number of key phrases returned is - * proportional to the number of words in the input document. - * + * Set the keyPhrases property: A list of representative words or phrases. + * The number of key phrases returned is proportional to the number of + * words in the input document. + * * @param keyPhrases the keyPhrases value to set. * @return the DocumentKeyPhrases object itself. */ @@ -80,8 +84,9 @@ public DocumentKeyPhrases setKeyPhrases(List keyPhrases) { } /** - * Get the warnings property: Warnings encountered while processing document. - * + * Get the warnings property: Warnings encountered while processing + * document. + * * @return the warnings value. */ public List getWarnings() { @@ -89,8 +94,9 @@ public List getWarnings() { } /** - * Set the warnings property: Warnings encountered while processing document. - * + * Set the warnings property: Warnings encountered while processing + * document. + * * @param warnings the warnings value to set. * @return the DocumentKeyPhrases object itself. */ @@ -100,9 +106,9 @@ public DocumentKeyPhrases setWarnings(List warnings) { } /** - * Get the statistics property: if showStats=true was specified in the request this field will contain information - * about the document payload. - * + * Get the statistics property: if showStats=true was specified in the + * request this field will contain information about the document payload. + * * @return the statistics value. */ public DocumentStatistics getStatistics() { @@ -110,9 +116,9 @@ public DocumentStatistics getStatistics() { } /** - * Set the statistics property: if showStats=true was specified in the request this field will contain information - * about the document payload. - * + * Set the statistics property: if showStats=true was specified in the + * request this field will contain information about the document payload. + * * @param statistics the statistics value to set. * @return the DocumentKeyPhrases object itself. */ diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentLanguage.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentLanguage.java index b195406d85350..80fa6fb3efab2 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentLanguage.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentLanguage.java @@ -8,7 +8,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; -/** The DocumentLanguage model. */ +/** + * The DocumentLanguage model. + */ @Fluent public final class DocumentLanguage { /* @@ -77,7 +79,8 @@ public DocumentLanguage setDetectedLanguage(DetectedLanguage detectedLanguage) { } /** - * Get the warnings property: Warnings encountered while processing document. + * Get the warnings property: Warnings encountered while processing + * document. * * @return the warnings value. */ @@ -86,7 +89,8 @@ public List getWarnings() { } /** - * Set the warnings property: Warnings encountered while processing document. + * Set the warnings property: Warnings encountered while processing + * document. * * @param warnings the warnings value to set. * @return the DocumentLanguage object itself. @@ -97,8 +101,8 @@ public DocumentLanguage setWarnings(List warnings) { } /** - * Get the statistics property: if showStats=true was specified in the request this field will contain information - * about the document payload. + * Get the statistics property: if showStats=true was specified in the + * request this field will contain information about the document payload. * * @return the statistics value. */ @@ -107,8 +111,8 @@ public DocumentStatistics getStatistics() { } /** - * Set the statistics property: if showStats=true was specified in the request this field will contain information - * about the document payload. + * Set the statistics property: if showStats=true was specified in the + * request this field will contain information about the document payload. * * @param statistics the statistics value to set. * @return the DocumentLanguage object itself. diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentLinkedEntities.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentLinkedEntities.java index 952b1f972ddc0..c6c548e484b84 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentLinkedEntities.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentLinkedEntities.java @@ -8,7 +8,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; -/** The DocumentLinkedEntities model. */ +/** + * The DocumentLinkedEntities model. + */ @Fluent public final class DocumentLinkedEntities { /* @@ -38,7 +40,7 @@ public final class DocumentLinkedEntities { /** * Get the id property: Unique, non-empty document identifier. - * + * * @return the id value. */ public String getId() { @@ -47,7 +49,7 @@ public String getId() { /** * Set the id property: Unique, non-empty document identifier. - * + * * @param id the id value to set. * @return the DocumentLinkedEntities object itself. */ @@ -57,8 +59,9 @@ public DocumentLinkedEntities setId(String id) { } /** - * Get the entities property: Recognized well-known entities in the document. - * + * Get the entities property: Recognized well-known entities in the + * document. + * * @return the entities value. */ public List getEntities() { @@ -66,8 +69,9 @@ public List getEntities() { } /** - * Set the entities property: Recognized well-known entities in the document. - * + * Set the entities property: Recognized well-known entities in the + * document. + * * @param entities the entities value to set. * @return the DocumentLinkedEntities object itself. */ @@ -77,8 +81,9 @@ public DocumentLinkedEntities setEntities(List entities) { } /** - * Get the warnings property: Warnings encountered while processing document. - * + * Get the warnings property: Warnings encountered while processing + * document. + * * @return the warnings value. */ public List getWarnings() { @@ -86,8 +91,9 @@ public List getWarnings() { } /** - * Set the warnings property: Warnings encountered while processing document. - * + * Set the warnings property: Warnings encountered while processing + * document. + * * @param warnings the warnings value to set. * @return the DocumentLinkedEntities object itself. */ @@ -97,9 +103,9 @@ public DocumentLinkedEntities setWarnings(List warnings) { } /** - * Get the statistics property: if showStats=true was specified in the request this field will contain information - * about the document payload. - * + * Get the statistics property: if showStats=true was specified in the + * request this field will contain information about the document payload. + * * @return the statistics value. */ public DocumentStatistics getStatistics() { @@ -107,9 +113,9 @@ public DocumentStatistics getStatistics() { } /** - * Set the statistics property: if showStats=true was specified in the request this field will contain information - * about the document payload. - * + * Set the statistics property: if showStats=true was specified in the + * request this field will contain information about the document payload. + * * @param statistics the statistics value to set. * @return the DocumentLinkedEntities object itself. */ diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentSentiment.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentSentiment.java index d029dc57e4b9b..80d62cfe0082f 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentSentiment.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentSentiment.java @@ -8,7 +8,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; -/** The DocumentSentiment model. */ +/** + * The DocumentSentiment model. + */ @Fluent public final class DocumentSentiment { /* @@ -52,7 +54,7 @@ public final class DocumentSentiment { /** * Get the id property: Unique, non-empty document identifier. - * + * * @return the id value. */ public String getId() { @@ -61,7 +63,7 @@ public String getId() { /** * Set the id property: Unique, non-empty document identifier. - * + * * @param id the id value to set. * @return the DocumentSentiment object itself. */ @@ -71,8 +73,9 @@ public DocumentSentiment setId(String id) { } /** - * Get the sentiment property: Predicted sentiment for document (Negative, Neutral, Positive, or Mixed). - * + * Get the sentiment property: Predicted sentiment for document (Negative, + * Neutral, Positive, or Mixed). + * * @return the sentiment value. */ public DocumentSentimentValue getSentiment() { @@ -80,8 +83,9 @@ public DocumentSentimentValue getSentiment() { } /** - * Set the sentiment property: Predicted sentiment for document (Negative, Neutral, Positive, or Mixed). - * + * Set the sentiment property: Predicted sentiment for document (Negative, + * Neutral, Positive, or Mixed). + * * @param sentiment the sentiment value to set. * @return the DocumentSentiment object itself. */ @@ -91,9 +95,9 @@ public DocumentSentiment setSentiment(DocumentSentimentValue sentiment) { } /** - * Get the statistics property: if showStats=true was specified in the request this field will contain information - * about the document payload. - * + * Get the statistics property: if showStats=true was specified in the + * request this field will contain information about the document payload. + * * @return the statistics value. */ public DocumentStatistics getStatistics() { @@ -101,9 +105,9 @@ public DocumentStatistics getStatistics() { } /** - * Set the statistics property: if showStats=true was specified in the request this field will contain information - * about the document payload. - * + * Set the statistics property: if showStats=true was specified in the + * request this field will contain information about the document payload. + * * @param statistics the statistics value to set. * @return the DocumentSentiment object itself. */ @@ -113,9 +117,9 @@ public DocumentSentiment setStatistics(DocumentStatistics statistics) { } /** - * Get the confidenceScores property: Document level sentiment confidence scores between 0 and 1 for each sentiment - * class. - * + * Get the confidenceScores property: Document level sentiment confidence + * scores between 0 and 1 for each sentiment class. + * * @return the confidenceScores value. */ public SentimentConfidenceScorePerLabel getConfidenceScores() { @@ -123,9 +127,9 @@ public SentimentConfidenceScorePerLabel getConfidenceScores() { } /** - * Set the confidenceScores property: Document level sentiment confidence scores between 0 and 1 for each sentiment - * class. - * + * Set the confidenceScores property: Document level sentiment confidence + * scores between 0 and 1 for each sentiment class. + * * @param confidenceScores the confidenceScores value to set. * @return the DocumentSentiment object itself. */ @@ -136,7 +140,7 @@ public DocumentSentiment setConfidenceScores(SentimentConfidenceScorePerLabel co /** * Get the sentences property: Sentence level sentiment analysis. - * + * * @return the sentences value. */ public List getSentences() { @@ -145,7 +149,7 @@ public List getSentences() { /** * Set the sentences property: Sentence level sentiment analysis. - * + * * @param sentences the sentences value to set. * @return the DocumentSentiment object itself. */ @@ -155,8 +159,9 @@ public DocumentSentiment setSentences(List sentences) { } /** - * Get the warnings property: Warnings encountered while processing document. - * + * Get the warnings property: Warnings encountered while processing + * document. + * * @return the warnings value. */ public List getWarnings() { @@ -164,8 +169,9 @@ public List getWarnings() { } /** - * Set the warnings property: Warnings encountered while processing document. - * + * Set the warnings property: Warnings encountered while processing + * document. + * * @param warnings the warnings value to set. * @return the DocumentSentiment object itself. */ diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentSentimentValue.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentSentimentValue.java index 0964d67bafe2d..3348780b91a96 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentSentimentValue.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentSentimentValue.java @@ -7,21 +7,33 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -/** Defines values for DocumentSentimentValue. */ +/** + * Defines values for DocumentSentimentValue. + */ public enum DocumentSentimentValue { - /** Enum value positive. */ + /** + * Enum value positive. + */ POSITIVE("positive"), - /** Enum value neutral. */ + /** + * Enum value neutral. + */ NEUTRAL("neutral"), - /** Enum value negative. */ + /** + * Enum value negative. + */ NEGATIVE("negative"), - /** Enum value mixed. */ + /** + * Enum value mixed. + */ MIXED("mixed"); - /** The actual serialized value for a DocumentSentimentValue instance. */ + /** + * The actual serialized value for a DocumentSentimentValue instance. + */ private final String value; DocumentSentimentValue(String value) { @@ -30,7 +42,7 @@ public enum DocumentSentimentValue { /** * Parses a serialized value to a DocumentSentimentValue instance. - * + * * @param value the serialized value to parse. * @return the parsed DocumentSentimentValue object, or null if unable to parse. */ diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentStatistics.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentStatistics.java index 93d26d27cfd03..ef73e3f47e57f 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentStatistics.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentStatistics.java @@ -7,7 +7,9 @@ import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; -/** The DocumentStatistics model. */ +/** + * The DocumentStatistics model. + */ @Fluent public final class DocumentStatistics { /* @@ -23,8 +25,9 @@ public final class DocumentStatistics { private int transactionsCount; /** - * Get the charactersCount property: Number of text elements recognized in the document. - * + * Get the charactersCount property: Number of text elements recognized in + * the document. + * * @return the charactersCount value. */ public int getCharactersCount() { @@ -32,8 +35,9 @@ public int getCharactersCount() { } /** - * Set the charactersCount property: Number of text elements recognized in the document. - * + * Set the charactersCount property: Number of text elements recognized in + * the document. + * * @param charactersCount the charactersCount value to set. * @return the DocumentStatistics object itself. */ @@ -43,8 +47,9 @@ public DocumentStatistics setCharactersCount(int charactersCount) { } /** - * Get the transactionsCount property: Number of transactions for the document. - * + * Get the transactionsCount property: Number of transactions for the + * document. + * * @return the transactionsCount value. */ public int getTransactionsCount() { @@ -52,8 +57,9 @@ public int getTransactionsCount() { } /** - * Set the transactionsCount property: Number of transactions for the document. - * + * Set the transactionsCount property: Number of transactions for the + * document. + * * @param transactionsCount the transactionsCount value to set. * @return the DocumentStatistics object itself. */ diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntitiesResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntitiesResult.java index 51baf6e747dff..e103245b3c997 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntitiesResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntitiesResult.java @@ -8,7 +8,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; -/** The EntitiesResult model. */ +/** + * The EntitiesResult model. + */ @Fluent public final class EntitiesResult { /* @@ -38,7 +40,7 @@ public final class EntitiesResult { /** * Get the documents property: Response by document. - * + * * @return the documents value. */ public List getDocuments() { @@ -47,7 +49,7 @@ public List getDocuments() { /** * Set the documents property: Response by document. - * + * * @param documents the documents value to set. * @return the EntitiesResult object itself. */ @@ -58,7 +60,7 @@ public EntitiesResult setDocuments(List documents) { /** * Get the errors property: Errors by document id. - * + * * @return the errors value. */ public List getErrors() { @@ -67,7 +69,7 @@ public List getErrors() { /** * Set the errors property: Errors by document id. - * + * * @param errors the errors value to set. * @return the EntitiesResult object itself. */ @@ -77,9 +79,9 @@ public EntitiesResult setErrors(List errors) { } /** - * Get the statistics property: if showStats=true was specified in the request this field will contain information - * about the request payload. - * + * Get the statistics property: if showStats=true was specified in the + * request this field will contain information about the request payload. + * * @return the statistics value. */ public RequestStatistics getStatistics() { @@ -87,9 +89,9 @@ public RequestStatistics getStatistics() { } /** - * Set the statistics property: if showStats=true was specified in the request this field will contain information - * about the request payload. - * + * Set the statistics property: if showStats=true was specified in the + * request this field will contain information about the request payload. + * * @param statistics the statistics value to set. * @return the EntitiesResult object itself. */ @@ -99,8 +101,9 @@ public EntitiesResult setStatistics(RequestStatistics statistics) { } /** - * Get the modelVersion property: This field indicates which model is used for scoring. - * + * Get the modelVersion property: This field indicates which model is used + * for scoring. + * * @return the modelVersion value. */ public String getModelVersion() { @@ -108,8 +111,9 @@ public String getModelVersion() { } /** - * Set the modelVersion property: This field indicates which model is used for scoring. - * + * Set the modelVersion property: This field indicates which model is used + * for scoring. + * * @param modelVersion the modelVersion value to set. * @return the EntitiesResult object itself. */ diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/Entity.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/Entity.java index bf46484caa80a..afb9da844ae36 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/Entity.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/Entity.java @@ -7,7 +7,9 @@ import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; -/** The Entity model. */ +/** + * The Entity model. + */ @Fluent public final class Entity { /* @@ -29,13 +31,13 @@ public final class Entity { private String subcategory; /* - * Start position for the entity text. + * Start position (in Unicode characters) for the entity text. */ @JsonProperty(value = "offset", required = true) private int offset; /* - * Length for the entity text. + * Length (in Unicode characters) for the entity text. */ @JsonProperty(value = "length", required = true) private int length; @@ -48,7 +50,7 @@ public final class Entity { /** * Get the text property: Entity text as appears in the request. - * + * * @return the text value. */ public String getText() { @@ -57,7 +59,7 @@ public String getText() { /** * Set the text property: Entity text as appears in the request. - * + * * @param text the text value to set. * @return the Entity object itself. */ @@ -67,8 +69,9 @@ public Entity setText(String text) { } /** - * Get the category property: Entity type, such as Person/Location/Org/SSN etc. - * + * Get the category property: Entity type, such as Person/Location/Org/SSN + * etc. + * * @return the category value. */ public String getCategory() { @@ -76,8 +79,9 @@ public String getCategory() { } /** - * Set the category property: Entity type, such as Person/Location/Org/SSN etc. - * + * Set the category property: Entity type, such as Person/Location/Org/SSN + * etc. + * * @param category the category value to set. * @return the Entity object itself. */ @@ -87,8 +91,9 @@ public Entity setCategory(String category) { } /** - * Get the subcategory property: Entity sub type, such as Age/Year/TimeRange etc. - * + * Get the subcategory property: Entity sub type, such as + * Age/Year/TimeRange etc. + * * @return the subcategory value. */ public String getSubcategory() { @@ -96,8 +101,9 @@ public String getSubcategory() { } /** - * Set the subcategory property: Entity sub type, such as Age/Year/TimeRange etc. - * + * Set the subcategory property: Entity sub type, such as + * Age/Year/TimeRange etc. + * * @param subcategory the subcategory value to set. * @return the Entity object itself. */ @@ -107,8 +113,9 @@ public Entity setSubcategory(String subcategory) { } /** - * Get the offset property: Start position for the entity text. - * + * Get the offset property: Start position (in Unicode characters) for the + * entity text. + * * @return the offset value. */ public int getOffset() { @@ -116,8 +123,9 @@ public int getOffset() { } /** - * Set the offset property: Start position for the entity text. - * + * Set the offset property: Start position (in Unicode characters) for the + * entity text. + * * @param offset the offset value to set. * @return the Entity object itself. */ @@ -127,8 +135,9 @@ public Entity setOffset(int offset) { } /** - * Get the length property: Length for the entity text. - * + * Get the length property: Length (in Unicode characters) for the entity + * text. + * * @return the length value. */ public int getLength() { @@ -136,8 +145,9 @@ public int getLength() { } /** - * Set the length property: Length for the entity text. - * + * Set the length property: Length (in Unicode characters) for the entity + * text. + * * @param length the length value to set. * @return the Entity object itself. */ @@ -147,8 +157,9 @@ public Entity setLength(int length) { } /** - * Get the confidenceScore property: Confidence score between 0 and 1 of the extracted entity. - * + * Get the confidenceScore property: Confidence score between 0 and 1 of + * the extracted entity. + * * @return the confidenceScore value. */ public double getConfidenceScore() { @@ -156,8 +167,9 @@ public double getConfidenceScore() { } /** - * Set the confidenceScore property: Confidence score between 0 and 1 of the extracted entity. - * + * Set the confidenceScore property: Confidence score between 0 and 1 of + * the extracted entity. + * * @param confidenceScore the confidenceScore value to set. * @return the Entity object itself. */ diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntityLinkingResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntityLinkingResult.java index 35b71cc3b8b05..ffadfa03a1188 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntityLinkingResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntityLinkingResult.java @@ -8,7 +8,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; -/** The EntityLinkingResult model. */ +/** + * The EntityLinkingResult model. + */ @Fluent public final class EntityLinkingResult { /* @@ -38,7 +40,7 @@ public final class EntityLinkingResult { /** * Get the documents property: Response by document. - * + * * @return the documents value. */ public List getDocuments() { @@ -47,7 +49,7 @@ public List getDocuments() { /** * Set the documents property: Response by document. - * + * * @param documents the documents value to set. * @return the EntityLinkingResult object itself. */ @@ -58,7 +60,7 @@ public EntityLinkingResult setDocuments(List documents) /** * Get the errors property: Errors by document id. - * + * * @return the errors value. */ public List getErrors() { @@ -67,7 +69,7 @@ public List getErrors() { /** * Set the errors property: Errors by document id. - * + * * @param errors the errors value to set. * @return the EntityLinkingResult object itself. */ @@ -77,9 +79,9 @@ public EntityLinkingResult setErrors(List errors) { } /** - * Get the statistics property: if showStats=true was specified in the request this field will contain information - * about the request payload. - * + * Get the statistics property: if showStats=true was specified in the + * request this field will contain information about the request payload. + * * @return the statistics value. */ public RequestStatistics getStatistics() { @@ -87,9 +89,9 @@ public RequestStatistics getStatistics() { } /** - * Set the statistics property: if showStats=true was specified in the request this field will contain information - * about the request payload. - * + * Set the statistics property: if showStats=true was specified in the + * request this field will contain information about the request payload. + * * @param statistics the statistics value to set. * @return the EntityLinkingResult object itself. */ @@ -99,8 +101,9 @@ public EntityLinkingResult setStatistics(RequestStatistics statistics) { } /** - * Get the modelVersion property: This field indicates which model is used for scoring. - * + * Get the modelVersion property: This field indicates which model is used + * for scoring. + * * @return the modelVersion value. */ public String getModelVersion() { @@ -108,8 +111,9 @@ public String getModelVersion() { } /** - * Set the modelVersion property: This field indicates which model is used for scoring. - * + * Set the modelVersion property: This field indicates which model is used + * for scoring. + * * @param modelVersion the modelVersion value to set. * @return the EntityLinkingResult object itself. */ diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ErrorCodeValue.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ErrorCodeValue.java index a6dca165182da..3431f8803c636 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ErrorCodeValue.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ErrorCodeValue.java @@ -4,37 +4,62 @@ package com.azure.ai.textanalytics.implementation.models; -import com.azure.core.util.ExpandableStringEnum; import com.fasterxml.jackson.annotation.JsonCreator; -import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonValue; -/** Defines values for ErrorCodeValue. */ -public final class ErrorCodeValue extends ExpandableStringEnum { - /** Static value InvalidRequest for ErrorCodeValue. */ - public static final ErrorCodeValue INVALID_REQUEST = fromString("InvalidRequest"); +/** + * Defines values for ErrorCodeValue. + */ +public enum ErrorCodeValue { + /** + * Enum value invalidRequest. + */ + INVALID_REQUEST("invalidRequest"), - /** Static value InvalidArgument for ErrorCodeValue. */ - public static final ErrorCodeValue INVALID_ARGUMENT = fromString("InvalidArgument"); + /** + * Enum value invalidArgument. + */ + INVALID_ARGUMENT("invalidArgument"), - /** Static value InternalServerError for ErrorCodeValue. */ - public static final ErrorCodeValue INTERNAL_SERVER_ERROR = fromString("InternalServerError"); + /** + * Enum value internalServerError. + */ + INTERNAL_SERVER_ERROR("internalServerError"), - /** Static value ServiceUnavailable for ErrorCodeValue. */ - public static final ErrorCodeValue SERVICE_UNAVAILABLE = fromString("ServiceUnavailable"); + /** + * Enum value serviceUnavailable. + */ + SERVICE_UNAVAILABLE("serviceUnavailable"); + + /** + * The actual serialized value for a ErrorCodeValue instance. + */ + private final String value; + + ErrorCodeValue(String value) { + this.value = value; + } /** - * Creates or finds a ErrorCodeValue from its string representation. - * - * @param name a name to look for. - * @return the corresponding ErrorCodeValue. + * Parses a serialized value to a ErrorCodeValue instance. + * + * @param value the serialized value to parse. + * @return the parsed ErrorCodeValue object, or null if unable to parse. */ @JsonCreator - public static ErrorCodeValue fromString(String name) { - return fromString(name, ErrorCodeValue.class); + public static ErrorCodeValue fromString(String value) { + ErrorCodeValue[] items = ErrorCodeValue.values(); + for (ErrorCodeValue item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; } - /** @return known ErrorCodeValue values. */ - public static Collection values() { - return values(ErrorCodeValue.class); + @JsonValue + @Override + public String toString() { + return this.value; } } diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ErrorResponse.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ErrorResponse.java deleted file mode 100644 index 2689490a7c97b..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ErrorResponse.java +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.ai.textanalytics.implementation.models; - -import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** The ErrorResponse model. */ -@Fluent -public final class ErrorResponse { - /* - * Document Error. - */ - @JsonProperty(value = "error", required = true) - private TextAnalyticsError error; - - /** - * Get the error property: Document Error. - * - * @return the error value. - */ - public TextAnalyticsError getError() { - return this.error; - } - - /** - * Set the error property: Document Error. - * - * @param error the error value to set. - * @return the ErrorResponse object itself. - */ - public ErrorResponse setError(TextAnalyticsError error) { - this.error = error; - return this; - } -} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/InnerError.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/InnerError.java index 554a5c86ddcc7..e2a97c1c062ee 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/InnerError.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/InnerError.java @@ -8,7 +8,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Map; -/** The InnerError model. */ +/** + * The InnerError model. + */ @Fluent public final class InnerError { /* @@ -43,7 +45,7 @@ public final class InnerError { /** * Get the code property: Error code. - * + * * @return the code value. */ public InnerErrorCodeValue getCode() { @@ -52,7 +54,7 @@ public InnerErrorCodeValue getCode() { /** * Set the code property: Error code. - * + * * @param code the code value to set. * @return the InnerError object itself. */ @@ -63,7 +65,7 @@ public InnerError setCode(InnerErrorCodeValue code) { /** * Get the message property: Error message. - * + * * @return the message value. */ public String getMessage() { @@ -72,7 +74,7 @@ public String getMessage() { /** * Set the message property: Error message. - * + * * @param message the message value to set. * @return the InnerError object itself. */ @@ -83,7 +85,7 @@ public InnerError setMessage(String message) { /** * Get the details property: Error details. - * + * * @return the details value. */ public Map getDetails() { @@ -92,7 +94,7 @@ public Map getDetails() { /** * Set the details property: Error details. - * + * * @param details the details value to set. * @return the InnerError object itself. */ @@ -103,7 +105,7 @@ public InnerError setDetails(Map details) { /** * Get the target property: Error target. - * + * * @return the target value. */ public String getTarget() { @@ -112,7 +114,7 @@ public String getTarget() { /** * Set the target property: Error target. - * + * * @param target the target value to set. * @return the InnerError object itself. */ @@ -122,8 +124,9 @@ public InnerError setTarget(String target) { } /** - * Get the innererror property: Inner error contains more specific information. - * + * Get the innererror property: Inner error contains more specific + * information. + * * @return the innererror value. */ public InnerError getInnererror() { @@ -131,8 +134,9 @@ public InnerError getInnererror() { } /** - * Set the innererror property: Inner error contains more specific information. - * + * Set the innererror property: Inner error contains more specific + * information. + * * @param innererror the innererror value to set. * @return the InnerError object itself. */ diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/InnerErrorCodeValue.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/InnerErrorCodeValue.java index 8231b7dbd6ec5..4294b1b886a1d 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/InnerErrorCodeValue.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/InnerErrorCodeValue.java @@ -4,52 +4,87 @@ package com.azure.ai.textanalytics.implementation.models; -import com.azure.core.util.ExpandableStringEnum; import com.fasterxml.jackson.annotation.JsonCreator; -import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonValue; -/** Defines values for InnerErrorCodeValue. */ -public final class InnerErrorCodeValue extends ExpandableStringEnum { - /** Static value InvalidParameterValue for InnerErrorCodeValue. */ - public static final InnerErrorCodeValue INVALID_PARAMETER_VALUE = fromString("InvalidParameterValue"); +/** + * Defines values for InnerErrorCodeValue. + */ +public enum InnerErrorCodeValue { + /** + * Enum value invalidParameterValue. + */ + INVALID_PARAMETER_VALUE("invalidParameterValue"), - /** Static value InvalidRequestBodyFormat for InnerErrorCodeValue. */ - public static final InnerErrorCodeValue INVALID_REQUEST_BODY_FORMAT = fromString("InvalidRequestBodyFormat"); + /** + * Enum value invalidRequestBodyFormat. + */ + INVALID_REQUEST_BODY_FORMAT("invalidRequestBodyFormat"), - /** Static value EmptyRequest for InnerErrorCodeValue. */ - public static final InnerErrorCodeValue EMPTY_REQUEST = fromString("EmptyRequest"); + /** + * Enum value emptyRequest. + */ + EMPTY_REQUEST("emptyRequest"), - /** Static value MissingInputRecords for InnerErrorCodeValue. */ - public static final InnerErrorCodeValue MISSING_INPUT_RECORDS = fromString("MissingInputRecords"); + /** + * Enum value missingInputRecords. + */ + MISSING_INPUT_RECORDS("missingInputRecords"), - /** Static value InvalidDocument for InnerErrorCodeValue. */ - public static final InnerErrorCodeValue INVALID_DOCUMENT = fromString("InvalidDocument"); + /** + * Enum value invalidDocument. + */ + INVALID_DOCUMENT("invalidDocument"), - /** Static value ModelVersionIncorrect for InnerErrorCodeValue. */ - public static final InnerErrorCodeValue MODEL_VERSION_INCORRECT = fromString("ModelVersionIncorrect"); + /** + * Enum value modelVersionIncorrect. + */ + MODEL_VERSION_INCORRECT("modelVersionIncorrect"), - /** Static value InvalidDocumentBatch for InnerErrorCodeValue. */ - public static final InnerErrorCodeValue INVALID_DOCUMENT_BATCH = fromString("InvalidDocumentBatch"); + /** + * Enum value invalidDocumentBatch. + */ + INVALID_DOCUMENT_BATCH("invalidDocumentBatch"), - /** Static value UnsupportedLanguageCode for InnerErrorCodeValue. */ - public static final InnerErrorCodeValue UNSUPPORTED_LANGUAGE_CODE = fromString("UnsupportedLanguageCode"); + /** + * Enum value unsupportedLanguageCode. + */ + UNSUPPORTED_LANGUAGE_CODE("unsupportedLanguageCode"), - /** Static value InvalidCountryHint for InnerErrorCodeValue. */ - public static final InnerErrorCodeValue INVALID_COUNTRY_HINT = fromString("InvalidCountryHint"); + /** + * Enum value invalidCountryHint. + */ + INVALID_COUNTRY_HINT("invalidCountryHint"); + + /** + * The actual serialized value for a InnerErrorCodeValue instance. + */ + private final String value; + + InnerErrorCodeValue(String value) { + this.value = value; + } /** - * Creates or finds a InnerErrorCodeValue from its string representation. - * - * @param name a name to look for. - * @return the corresponding InnerErrorCodeValue. + * Parses a serialized value to a InnerErrorCodeValue instance. + * + * @param value the serialized value to parse. + * @return the parsed InnerErrorCodeValue object, or null if unable to parse. */ @JsonCreator - public static InnerErrorCodeValue fromString(String name) { - return fromString(name, InnerErrorCodeValue.class); + public static InnerErrorCodeValue fromString(String value) { + InnerErrorCodeValue[] items = InnerErrorCodeValue.values(); + for (InnerErrorCodeValue item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; } - /** @return known InnerErrorCodeValue values. */ - public static Collection values() { - return values(InnerErrorCodeValue.class); + @JsonValue + @Override + public String toString() { + return this.value; } } diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/KeyPhraseResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/KeyPhraseResult.java index c849875792608..bd7223494fd27 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/KeyPhraseResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/KeyPhraseResult.java @@ -8,7 +8,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; -/** The KeyPhraseResult model. */ +/** + * The KeyPhraseResult model. + */ @Fluent public final class KeyPhraseResult { /* @@ -38,7 +40,7 @@ public final class KeyPhraseResult { /** * Get the documents property: Response by document. - * + * * @return the documents value. */ public List getDocuments() { @@ -47,7 +49,7 @@ public List getDocuments() { /** * Set the documents property: Response by document. - * + * * @param documents the documents value to set. * @return the KeyPhraseResult object itself. */ @@ -58,7 +60,7 @@ public KeyPhraseResult setDocuments(List documents) { /** * Get the errors property: Errors by document id. - * + * * @return the errors value. */ public List getErrors() { @@ -67,7 +69,7 @@ public List getErrors() { /** * Set the errors property: Errors by document id. - * + * * @param errors the errors value to set. * @return the KeyPhraseResult object itself. */ @@ -77,9 +79,9 @@ public KeyPhraseResult setErrors(List errors) { } /** - * Get the statistics property: if showStats=true was specified in the request this field will contain information - * about the request payload. - * + * Get the statistics property: if showStats=true was specified in the + * request this field will contain information about the request payload. + * * @return the statistics value. */ public RequestStatistics getStatistics() { @@ -87,9 +89,9 @@ public RequestStatistics getStatistics() { } /** - * Set the statistics property: if showStats=true was specified in the request this field will contain information - * about the request payload. - * + * Set the statistics property: if showStats=true was specified in the + * request this field will contain information about the request payload. + * * @param statistics the statistics value to set. * @return the KeyPhraseResult object itself. */ @@ -99,8 +101,9 @@ public KeyPhraseResult setStatistics(RequestStatistics statistics) { } /** - * Get the modelVersion property: This field indicates which model is used for scoring. - * + * Get the modelVersion property: This field indicates which model is used + * for scoring. + * * @return the modelVersion value. */ public String getModelVersion() { @@ -108,8 +111,9 @@ public String getModelVersion() { } /** - * Set the modelVersion property: This field indicates which model is used for scoring. - * + * Set the modelVersion property: This field indicates which model is used + * for scoring. + * * @param modelVersion the modelVersion value to set. * @return the KeyPhraseResult object itself. */ diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LanguageBatchInput.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LanguageBatchInput.java index 2e1bde460b170..4ff3423367c42 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LanguageBatchInput.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LanguageBatchInput.java @@ -8,7 +8,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; -/** The LanguageBatchInput model. */ +/** + * The LanguageBatchInput model. + */ @Fluent public final class LanguageBatchInput { /* @@ -19,7 +21,7 @@ public final class LanguageBatchInput { /** * Get the documents property: The documents property. - * + * * @return the documents value. */ public List getDocuments() { @@ -28,7 +30,7 @@ public List getDocuments() { /** * Set the documents property: The documents property. - * + * * @param documents the documents value to set. * @return the LanguageBatchInput object itself. */ diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LanguageInput.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LanguageInput.java index d81ea140b1a0c..2a9d7d3f91b55 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LanguageInput.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LanguageInput.java @@ -7,7 +7,9 @@ import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; -/** The LanguageInput model. */ +/** + * The LanguageInput model. + */ @Fluent public final class LanguageInput { /* @@ -30,7 +32,7 @@ public final class LanguageInput { /** * Get the id property: Unique, non-empty document identifier. - * + * * @return the id value. */ public String getId() { @@ -39,7 +41,7 @@ public String getId() { /** * Set the id property: Unique, non-empty document identifier. - * + * * @param id the id value to set. * @return the LanguageInput object itself. */ @@ -50,7 +52,7 @@ public LanguageInput setId(String id) { /** * Get the text property: The text property. - * + * * @return the text value. */ public String getText() { @@ -59,7 +61,7 @@ public String getText() { /** * Set the text property: The text property. - * + * * @param text the text value to set. * @return the LanguageInput object itself. */ @@ -70,7 +72,7 @@ public LanguageInput setText(String text) { /** * Get the countryHint property: The countryHint property. - * + * * @return the countryHint value. */ public String getCountryHint() { @@ -79,7 +81,7 @@ public String getCountryHint() { /** * Set the countryHint property: The countryHint property. - * + * * @param countryHint the countryHint value to set. * @return the LanguageInput object itself. */ diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LanguageResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LanguageResult.java index be55cd24b5d25..46515f53c93be 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LanguageResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LanguageResult.java @@ -8,7 +8,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; -/** The LanguageResult model. */ +/** + * The LanguageResult model. + */ @Fluent public final class LanguageResult { /* @@ -38,7 +40,7 @@ public final class LanguageResult { /** * Get the documents property: Response by document. - * + * * @return the documents value. */ public List getDocuments() { @@ -47,7 +49,7 @@ public List getDocuments() { /** * Set the documents property: Response by document. - * + * * @param documents the documents value to set. * @return the LanguageResult object itself. */ @@ -58,7 +60,7 @@ public LanguageResult setDocuments(List documents) { /** * Get the errors property: Errors by document id. - * + * * @return the errors value. */ public List getErrors() { @@ -67,7 +69,7 @@ public List getErrors() { /** * Set the errors property: Errors by document id. - * + * * @param errors the errors value to set. * @return the LanguageResult object itself. */ @@ -77,9 +79,9 @@ public LanguageResult setErrors(List errors) { } /** - * Get the statistics property: if showStats=true was specified in the request this field will contain information - * about the request payload. - * + * Get the statistics property: if showStats=true was specified in the + * request this field will contain information about the request payload. + * * @return the statistics value. */ public RequestStatistics getStatistics() { @@ -87,9 +89,9 @@ public RequestStatistics getStatistics() { } /** - * Set the statistics property: if showStats=true was specified in the request this field will contain information - * about the request payload. - * + * Set the statistics property: if showStats=true was specified in the + * request this field will contain information about the request payload. + * * @param statistics the statistics value to set. * @return the LanguageResult object itself. */ @@ -99,8 +101,9 @@ public LanguageResult setStatistics(RequestStatistics statistics) { } /** - * Get the modelVersion property: This field indicates which model is used for scoring. - * + * Get the modelVersion property: This field indicates which model is used + * for scoring. + * * @return the modelVersion value. */ public String getModelVersion() { @@ -108,8 +111,9 @@ public String getModelVersion() { } /** - * Set the modelVersion property: This field indicates which model is used for scoring. - * + * Set the modelVersion property: This field indicates which model is used + * for scoring. + * * @param modelVersion the modelVersion value to set. * @return the LanguageResult object itself. */ diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LinkedEntity.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LinkedEntity.java index 002c5a673e461..18df75ef5dafd 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LinkedEntity.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LinkedEntity.java @@ -8,7 +8,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; -/** The LinkedEntity model. */ +/** + * The LinkedEntity model. + */ @Fluent public final class LinkedEntity { /* @@ -47,16 +49,9 @@ public final class LinkedEntity { @JsonProperty(value = "dataSource", required = true) private String dataSource; - /* - * Bing unique identifier of the recognized entity. Use in conjunction with - * the Bing Entity Search API to fetch additional relevant information. - */ - @JsonProperty(value = "bingId") - private String bingId; - /** * Get the name property: Entity Linking formal name. - * + * * @return the name value. */ public String getName() { @@ -65,7 +60,7 @@ public String getName() { /** * Set the name property: Entity Linking formal name. - * + * * @param name the name value to set. * @return the LinkedEntity object itself. */ @@ -75,8 +70,9 @@ public LinkedEntity setName(String name) { } /** - * Get the matches property: List of instances this entity appears in the text. - * + * Get the matches property: List of instances this entity appears in the + * text. + * * @return the matches value. */ public List getMatches() { @@ -84,8 +80,9 @@ public List getMatches() { } /** - * Set the matches property: List of instances this entity appears in the text. - * + * Set the matches property: List of instances this entity appears in the + * text. + * * @param matches the matches value to set. * @return the LinkedEntity object itself. */ @@ -96,7 +93,7 @@ public LinkedEntity setMatches(List matches) { /** * Get the language property: Language used in the data source. - * + * * @return the language value. */ public String getLanguage() { @@ -105,7 +102,7 @@ public String getLanguage() { /** * Set the language property: Language used in the data source. - * + * * @param language the language value to set. * @return the LinkedEntity object itself. */ @@ -115,8 +112,9 @@ public LinkedEntity setLanguage(String language) { } /** - * Get the id property: Unique identifier of the recognized entity from the data source. - * + * Get the id property: Unique identifier of the recognized entity from the + * data source. + * * @return the id value. */ public String getId() { @@ -124,8 +122,9 @@ public String getId() { } /** - * Set the id property: Unique identifier of the recognized entity from the data source. - * + * Set the id property: Unique identifier of the recognized entity from the + * data source. + * * @param id the id value to set. * @return the LinkedEntity object itself. */ @@ -136,7 +135,7 @@ public LinkedEntity setId(String id) { /** * Get the url property: URL for the entity's page from the data source. - * + * * @return the url value. */ public String getUrl() { @@ -145,7 +144,7 @@ public String getUrl() { /** * Set the url property: URL for the entity's page from the data source. - * + * * @param url the url value to set. * @return the LinkedEntity object itself. */ @@ -155,8 +154,9 @@ public LinkedEntity setUrl(String url) { } /** - * Get the dataSource property: Data source used to extract entity linking, such as Wiki/Bing etc. - * + * Get the dataSource property: Data source used to extract entity linking, + * such as Wiki/Bing etc. + * * @return the dataSource value. */ public String getDataSource() { @@ -164,8 +164,9 @@ public String getDataSource() { } /** - * Set the dataSource property: Data source used to extract entity linking, such as Wiki/Bing etc. - * + * Set the dataSource property: Data source used to extract entity linking, + * such as Wiki/Bing etc. + * * @param dataSource the dataSource value to set. * @return the LinkedEntity object itself. */ @@ -173,26 +174,4 @@ public LinkedEntity setDataSource(String dataSource) { this.dataSource = dataSource; return this; } - - /** - * Get the bingId property: Bing unique identifier of the recognized entity. Use in conjunction with the Bing Entity - * Search API to fetch additional relevant information. - * - * @return the bingId value. - */ - public String getBingId() { - return this.bingId; - } - - /** - * Set the bingId property: Bing unique identifier of the recognized entity. Use in conjunction with the Bing Entity - * Search API to fetch additional relevant information. - * - * @param bingId the bingId value to set. - * @return the LinkedEntity object itself. - */ - public LinkedEntity setBingId(String bingId) { - this.bingId = bingId; - return this; - } } diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/Match.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/Match.java index 197feeb7ca037..19b4a45c097b2 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/Match.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/Match.java @@ -7,7 +7,9 @@ import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; -/** The Match model. */ +/** + * The Match model. + */ @Fluent public final class Match { /* @@ -24,21 +26,22 @@ public final class Match { private String text; /* - * Start position for the entity match text. + * Start position (in Unicode characters) for the entity match text. */ @JsonProperty(value = "offset", required = true) private int offset; /* - * Length for the entity match text. + * Length (in Unicode characters) for the entity match text. */ @JsonProperty(value = "length", required = true) private int length; /** - * Get the confidenceScore property: If a well-known item is recognized, a decimal number denoting the confidence - * level between 0 and 1 will be returned. - * + * Get the confidenceScore property: If a well-known item is recognized, a + * decimal number denoting the confidence level between 0 and 1 will be + * returned. + * * @return the confidenceScore value. */ public double getConfidenceScore() { @@ -46,9 +49,10 @@ public double getConfidenceScore() { } /** - * Set the confidenceScore property: If a well-known item is recognized, a decimal number denoting the confidence - * level between 0 and 1 will be returned. - * + * Set the confidenceScore property: If a well-known item is recognized, a + * decimal number denoting the confidence level between 0 and 1 will be + * returned. + * * @param confidenceScore the confidenceScore value to set. * @return the Match object itself. */ @@ -59,7 +63,7 @@ public Match setConfidenceScore(double confidenceScore) { /** * Get the text property: Entity text as appears in the request. - * + * * @return the text value. */ public String getText() { @@ -68,7 +72,7 @@ public String getText() { /** * Set the text property: Entity text as appears in the request. - * + * * @param text the text value to set. * @return the Match object itself. */ @@ -78,8 +82,9 @@ public Match setText(String text) { } /** - * Get the offset property: Start position for the entity match text. - * + * Get the offset property: Start position (in Unicode characters) for the + * entity match text. + * * @return the offset value. */ public int getOffset() { @@ -87,8 +92,9 @@ public int getOffset() { } /** - * Set the offset property: Start position for the entity match text. - * + * Set the offset property: Start position (in Unicode characters) for the + * entity match text. + * * @param offset the offset value to set. * @return the Match object itself. */ @@ -98,8 +104,9 @@ public Match setOffset(int offset) { } /** - * Get the length property: Length for the entity match text. - * + * Get the length property: Length (in Unicode characters) for the entity + * match text. + * * @return the length value. */ public int getLength() { @@ -107,8 +114,9 @@ public int getLength() { } /** - * Set the length property: Length for the entity match text. - * + * Set the length property: Length (in Unicode characters) for the entity + * match text. + * * @param length the length value to set. * @return the Match object itself. */ diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/MultiLanguageBatchInput.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/MultiLanguageBatchInput.java index 186e5923c357b..285b47ab9b3c0 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/MultiLanguageBatchInput.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/MultiLanguageBatchInput.java @@ -8,7 +8,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; -/** The MultiLanguageBatchInput model. */ +/** + * The MultiLanguageBatchInput model. + */ @Fluent public final class MultiLanguageBatchInput { /* @@ -18,8 +20,9 @@ public final class MultiLanguageBatchInput { private List documents; /** - * Get the documents property: The set of documents to process as part of this batch. - * + * Get the documents property: The set of documents to process as part of + * this batch. + * * @return the documents value. */ public List getDocuments() { @@ -27,8 +30,9 @@ public List getDocuments() { } /** - * Set the documents property: The set of documents to process as part of this batch. - * + * Set the documents property: The set of documents to process as part of + * this batch. + * * @param documents the documents value to set. * @return the MultiLanguageBatchInput object itself. */ diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/MultiLanguageInput.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/MultiLanguageInput.java index b69c017d068c9..f2ba9a4180365 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/MultiLanguageInput.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/MultiLanguageInput.java @@ -7,7 +7,9 @@ import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; -/** The MultiLanguageInput model. */ +/** + * The MultiLanguageInput model. + */ @Fluent public final class MultiLanguageInput { /* @@ -32,7 +34,7 @@ public final class MultiLanguageInput { /** * Get the id property: A unique, non-empty document identifier. - * + * * @return the id value. */ public String getId() { @@ -41,7 +43,7 @@ public String getId() { /** * Set the id property: A unique, non-empty document identifier. - * + * * @param id the id value to set. * @return the MultiLanguageInput object itself. */ @@ -52,7 +54,7 @@ public MultiLanguageInput setId(String id) { /** * Get the text property: The input text to process. - * + * * @return the text value. */ public String getText() { @@ -61,7 +63,7 @@ public String getText() { /** * Set the text property: The input text to process. - * + * * @param text the text value to set. * @return the MultiLanguageInput object itself. */ @@ -71,9 +73,10 @@ public MultiLanguageInput setText(String text) { } /** - * Get the language property: (Optional) This is the 2 letter ISO 639-1 representation of a language. For example, - * use "en" for English; "es" for Spanish etc. If not set, use "en" for English as default. - * + * Get the language property: (Optional) This is the 2 letter ISO 639-1 + * representation of a language. For example, use "en" for English; "es" + * for Spanish etc. If not set, use "en" for English as default. + * * @return the language value. */ public String getLanguage() { @@ -81,9 +84,10 @@ public String getLanguage() { } /** - * Set the language property: (Optional) This is the 2 letter ISO 639-1 representation of a language. For example, - * use "en" for English; "es" for Spanish etc. If not set, use "en" for English as default. - * + * Set the language property: (Optional) This is the 2 letter ISO 639-1 + * representation of a language. For example, use "en" for English; "es" + * for Spanish etc. If not set, use "en" for English as default. + * * @param language the language value to set. * @return the MultiLanguageInput object itself. */ diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/PiiDocumentEntities.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/PiiDocumentEntities.java deleted file mode 100644 index 60cc03b4e9422..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/PiiDocumentEntities.java +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.ai.textanalytics.implementation.models; - -import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; - -/** The PiiDocumentEntities model. */ -@Fluent -public final class PiiDocumentEntities { - /* - * Unique, non-empty document identifier. - */ - @JsonProperty(value = "id", required = true) - private String id; - - /* - * Recognized entities in the document. - */ - @JsonProperty(value = "entities", required = true) - private List entities; - - /* - * Warnings encountered while processing document. - */ - @JsonProperty(value = "warnings", required = true) - private List warnings; - - /* - * if showStats=true was specified in the request this field will contain - * information about the document payload. - */ - @JsonProperty(value = "statistics") - private DocumentStatistics statistics; - - /* - * Returns redacted text. - */ - @JsonProperty(value = "redactedText") - private String redactedText; - - /** - * Get the id property: Unique, non-empty document identifier. - * - * @return the id value. - */ - public String getId() { - return this.id; - } - - /** - * Set the id property: Unique, non-empty document identifier. - * - * @param id the id value to set. - * @return the PiiDocumentEntities object itself. - */ - public PiiDocumentEntities setId(String id) { - this.id = id; - return this; - } - - /** - * Get the entities property: Recognized entities in the document. - * - * @return the entities value. - */ - public List getEntities() { - return this.entities; - } - - /** - * Set the entities property: Recognized entities in the document. - * - * @param entities the entities value to set. - * @return the PiiDocumentEntities object itself. - */ - public PiiDocumentEntities setEntities(List entities) { - this.entities = entities; - return this; - } - - /** - * Get the warnings property: Warnings encountered while processing document. - * - * @return the warnings value. - */ - public List getWarnings() { - return this.warnings; - } - - /** - * Set the warnings property: Warnings encountered while processing document. - * - * @param warnings the warnings value to set. - * @return the PiiDocumentEntities object itself. - */ - public PiiDocumentEntities setWarnings(List warnings) { - this.warnings = warnings; - return this; - } - - /** - * Get the statistics property: if showStats=true was specified in the request this field will contain information - * about the document payload. - * - * @return the statistics value. - */ - public DocumentStatistics getStatistics() { - return this.statistics; - } - - /** - * Set the statistics property: if showStats=true was specified in the request this field will contain information - * about the document payload. - * - * @param statistics the statistics value to set. - * @return the PiiDocumentEntities object itself. - */ - public PiiDocumentEntities setStatistics(DocumentStatistics statistics) { - this.statistics = statistics; - return this; - } - - /** - * Get the redactedText property: Returns redacted text. - * - * @return the redactedText value. - */ - public String getRedactedText() { - return this.redactedText; - } - - /** - * Set the redactedText property: Returns redacted text. - * - * @param redactedText the redactedText value to set. - * @return the PiiDocumentEntities object itself. - */ - public PiiDocumentEntities setRedactedText(String redactedText) { - this.redactedText = redactedText; - return this; - } -} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/PiiEntitiesResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/PiiEntitiesResult.java deleted file mode 100644 index fade6eb5c72e2..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/PiiEntitiesResult.java +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.ai.textanalytics.implementation.models; - -import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; - -/** The PiiEntitiesResult model. */ -@Fluent -public final class PiiEntitiesResult { - /* - * Response by document - */ - @JsonProperty(value = "documents", required = true) - private List documents; - - /* - * Errors by document id. - */ - @JsonProperty(value = "errors", required = true) - private List errors; - - /* - * if showStats=true was specified in the request this field will contain - * information about the request payload. - */ - @JsonProperty(value = "statistics") - private RequestStatistics statistics; - - /* - * This field indicates which model is used for scoring. - */ - @JsonProperty(value = "modelVersion", required = true) - private String modelVersion; - - /** - * Get the documents property: Response by document. - * - * @return the documents value. - */ - public List getDocuments() { - return this.documents; - } - - /** - * Set the documents property: Response by document. - * - * @param documents the documents value to set. - * @return the PiiEntitiesResult object itself. - */ - public PiiEntitiesResult setDocuments(List documents) { - this.documents = documents; - return this; - } - - /** - * Get the errors property: Errors by document id. - * - * @return the errors value. - */ - public List getErrors() { - return this.errors; - } - - /** - * Set the errors property: Errors by document id. - * - * @param errors the errors value to set. - * @return the PiiEntitiesResult object itself. - */ - public PiiEntitiesResult setErrors(List errors) { - this.errors = errors; - return this; - } - - /** - * Get the statistics property: if showStats=true was specified in the request this field will contain information - * about the request payload. - * - * @return the statistics value. - */ - public RequestStatistics getStatistics() { - return this.statistics; - } - - /** - * Set the statistics property: if showStats=true was specified in the request this field will contain information - * about the request payload. - * - * @param statistics the statistics value to set. - * @return the PiiEntitiesResult object itself. - */ - public PiiEntitiesResult setStatistics(RequestStatistics statistics) { - this.statistics = statistics; - return this; - } - - /** - * Get the modelVersion property: This field indicates which model is used for scoring. - * - * @return the modelVersion value. - */ - public String getModelVersion() { - return this.modelVersion; - } - - /** - * Set the modelVersion property: This field indicates which model is used for scoring. - * - * @param modelVersion the modelVersion value to set. - * @return the PiiEntitiesResult object itself. - */ - public PiiEntitiesResult setModelVersion(String modelVersion) { - this.modelVersion = modelVersion; - return this; - } -} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/RequestStatistics.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/RequestStatistics.java index 653a40960b82b..ceb0be002998e 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/RequestStatistics.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/RequestStatistics.java @@ -7,7 +7,9 @@ import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; -/** The RequestStatistics model. */ +/** + * The RequestStatistics model. + */ @Fluent public final class RequestStatistics { /* @@ -37,8 +39,9 @@ public final class RequestStatistics { private long transactionsCount; /** - * Get the documentsCount property: Number of documents submitted in the request. - * + * Get the documentsCount property: Number of documents submitted in the + * request. + * * @return the documentsCount value. */ public int getDocumentsCount() { @@ -46,8 +49,9 @@ public int getDocumentsCount() { } /** - * Set the documentsCount property: Number of documents submitted in the request. - * + * Set the documentsCount property: Number of documents submitted in the + * request. + * * @param documentsCount the documentsCount value to set. * @return the RequestStatistics object itself. */ @@ -57,9 +61,9 @@ public RequestStatistics setDocumentsCount(int documentsCount) { } /** - * Get the validDocumentsCount property: Number of valid documents. This excludes empty, over-size limit or - * non-supported languages documents. - * + * Get the validDocumentsCount property: Number of valid documents. This + * excludes empty, over-size limit or non-supported languages documents. + * * @return the validDocumentsCount value. */ public int getValidDocumentsCount() { @@ -67,9 +71,9 @@ public int getValidDocumentsCount() { } /** - * Set the validDocumentsCount property: Number of valid documents. This excludes empty, over-size limit or - * non-supported languages documents. - * + * Set the validDocumentsCount property: Number of valid documents. This + * excludes empty, over-size limit or non-supported languages documents. + * * @param validDocumentsCount the validDocumentsCount value to set. * @return the RequestStatistics object itself. */ @@ -79,9 +83,10 @@ public RequestStatistics setValidDocumentsCount(int validDocumentsCount) { } /** - * Get the erroneousDocumentsCount property: Number of invalid documents. This includes empty, over-size limit or - * non-supported languages documents. - * + * Get the erroneousDocumentsCount property: Number of invalid documents. + * This includes empty, over-size limit or non-supported languages + * documents. + * * @return the erroneousDocumentsCount value. */ public int getErroneousDocumentsCount() { @@ -89,9 +94,10 @@ public int getErroneousDocumentsCount() { } /** - * Set the erroneousDocumentsCount property: Number of invalid documents. This includes empty, over-size limit or - * non-supported languages documents. - * + * Set the erroneousDocumentsCount property: Number of invalid documents. + * This includes empty, over-size limit or non-supported languages + * documents. + * * @param erroneousDocumentsCount the erroneousDocumentsCount value to set. * @return the RequestStatistics object itself. */ @@ -101,8 +107,9 @@ public RequestStatistics setErroneousDocumentsCount(int erroneousDocumentsCount) } /** - * Get the transactionsCount property: Number of transactions for the request. - * + * Get the transactionsCount property: Number of transactions for the + * request. + * * @return the transactionsCount value. */ public long getTransactionsCount() { @@ -110,8 +117,9 @@ public long getTransactionsCount() { } /** - * Set the transactionsCount property: Number of transactions for the request. - * + * Set the transactionsCount property: Number of transactions for the + * request. + * * @param transactionsCount the transactionsCount value to set. * @return the RequestStatistics object itself. */ diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentenceAspect.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentenceAspect.java deleted file mode 100644 index d7489460660a8..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentenceAspect.java +++ /dev/null @@ -1,170 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.ai.textanalytics.implementation.models; - -import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; - -/** The SentenceAspect model. */ -@Fluent -public final class SentenceAspect { - /* - * Aspect level sentiment for the aspect in the sentence. - */ - @JsonProperty(value = "sentiment", required = true) - private TokenSentimentValue sentiment; - - /* - * Aspect level sentiment confidence scores for the aspect in the sentence. - */ - @JsonProperty(value = "confidenceScores", required = true) - private AspectConfidenceScoreLabel confidenceScores; - - /* - * The aspect offset from the start of the sentence. - */ - @JsonProperty(value = "offset", required = true) - private int offset; - - /* - * The length of the aspect. - */ - @JsonProperty(value = "length", required = true) - private int length; - - /* - * The aspect text detected. - */ - @JsonProperty(value = "text", required = true) - private String text; - - /* - * The array of either opinion or aspect object which is related to the - * aspect. - */ - @JsonProperty(value = "relations", required = true) - private List relations; - - /** - * Get the sentiment property: Aspect level sentiment for the aspect in the sentence. - * - * @return the sentiment value. - */ - public TokenSentimentValue getSentiment() { - return this.sentiment; - } - - /** - * Set the sentiment property: Aspect level sentiment for the aspect in the sentence. - * - * @param sentiment the sentiment value to set. - * @return the SentenceAspect object itself. - */ - public SentenceAspect setSentiment(TokenSentimentValue sentiment) { - this.sentiment = sentiment; - return this; - } - - /** - * Get the confidenceScores property: Aspect level sentiment confidence scores for the aspect in the sentence. - * - * @return the confidenceScores value. - */ - public AspectConfidenceScoreLabel getConfidenceScores() { - return this.confidenceScores; - } - - /** - * Set the confidenceScores property: Aspect level sentiment confidence scores for the aspect in the sentence. - * - * @param confidenceScores the confidenceScores value to set. - * @return the SentenceAspect object itself. - */ - public SentenceAspect setConfidenceScores(AspectConfidenceScoreLabel confidenceScores) { - this.confidenceScores = confidenceScores; - return this; - } - - /** - * Get the offset property: The aspect offset from the start of the sentence. - * - * @return the offset value. - */ - public int getOffset() { - return this.offset; - } - - /** - * Set the offset property: The aspect offset from the start of the sentence. - * - * @param offset the offset value to set. - * @return the SentenceAspect object itself. - */ - public SentenceAspect setOffset(int offset) { - this.offset = offset; - return this; - } - - /** - * Get the length property: The length of the aspect. - * - * @return the length value. - */ - public int getLength() { - return this.length; - } - - /** - * Set the length property: The length of the aspect. - * - * @param length the length value to set. - * @return the SentenceAspect object itself. - */ - public SentenceAspect setLength(int length) { - this.length = length; - return this; - } - - /** - * Get the text property: The aspect text detected. - * - * @return the text value. - */ - public String getText() { - return this.text; - } - - /** - * Set the text property: The aspect text detected. - * - * @param text the text value to set. - * @return the SentenceAspect object itself. - */ - public SentenceAspect setText(String text) { - this.text = text; - return this; - } - - /** - * Get the relations property: The array of either opinion or aspect object which is related to the aspect. - * - * @return the relations value. - */ - public List getRelations() { - return this.relations; - } - - /** - * Set the relations property: The array of either opinion or aspect object which is related to the aspect. - * - * @param relations the relations value to set. - * @return the SentenceAspect object itself. - */ - public SentenceAspect setRelations(List relations) { - this.relations = relations; - return this; - } -} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentenceAspectSentiment.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentenceAspectSentiment.java deleted file mode 100644 index efb6a08ee97e4..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentenceAspectSentiment.java +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.ai.textanalytics.implementation.models; - -import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import java.util.Collection; - -/** Defines values for SentenceAspectSentiment. */ -public final class SentenceAspectSentiment extends ExpandableStringEnum { - /** Static value positive for SentenceAspectSentiment. */ - public static final SentenceAspectSentiment POSITIVE = fromString("positive"); - - /** Static value mixed for SentenceAspectSentiment. */ - public static final SentenceAspectSentiment MIXED = fromString("mixed"); - - /** Static value negative for SentenceAspectSentiment. */ - public static final SentenceAspectSentiment NEGATIVE = fromString("negative"); - - /** - * Creates or finds a SentenceAspectSentiment from its string representation. - * - * @param name a name to look for. - * @return the corresponding SentenceAspectSentiment. - */ - @JsonCreator - public static SentenceAspectSentiment fromString(String name) { - return fromString(name, SentenceAspectSentiment.class); - } - - /** @return known SentenceAspectSentiment values. */ - public static Collection values() { - return values(SentenceAspectSentiment.class); - } -} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentenceOpinion.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentenceOpinion.java deleted file mode 100644 index d54d20f27272d..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentenceOpinion.java +++ /dev/null @@ -1,169 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.ai.textanalytics.implementation.models; - -import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** The SentenceOpinion model. */ -@Fluent -public final class SentenceOpinion { - /* - * Opinion level sentiment for the aspect in the sentence. - */ - @JsonProperty(value = "sentiment", required = true) - private TokenSentimentValue sentiment; - - /* - * Opinion level sentiment confidence scores for the aspect in the - * sentence. - */ - @JsonProperty(value = "confidenceScores", required = true) - private AspectConfidenceScoreLabel confidenceScores; - - /* - * The opinion offset from the start of the sentence. - */ - @JsonProperty(value = "offset", required = true) - private int offset; - - /* - * The length of the opinion. - */ - @JsonProperty(value = "length", required = true) - private int length; - - /* - * The aspect text detected. - */ - @JsonProperty(value = "text", required = true) - private String text; - - /* - * The indicator representing if the opinion is negated. - */ - @JsonProperty(value = "isNegated", required = true) - private boolean isNegated; - - /** - * Get the sentiment property: Opinion level sentiment for the aspect in the sentence. - * - * @return the sentiment value. - */ - public TokenSentimentValue getSentiment() { - return this.sentiment; - } - - /** - * Set the sentiment property: Opinion level sentiment for the aspect in the sentence. - * - * @param sentiment the sentiment value to set. - * @return the SentenceOpinion object itself. - */ - public SentenceOpinion setSentiment(TokenSentimentValue sentiment) { - this.sentiment = sentiment; - return this; - } - - /** - * Get the confidenceScores property: Opinion level sentiment confidence scores for the aspect in the sentence. - * - * @return the confidenceScores value. - */ - public AspectConfidenceScoreLabel getConfidenceScores() { - return this.confidenceScores; - } - - /** - * Set the confidenceScores property: Opinion level sentiment confidence scores for the aspect in the sentence. - * - * @param confidenceScores the confidenceScores value to set. - * @return the SentenceOpinion object itself. - */ - public SentenceOpinion setConfidenceScores(AspectConfidenceScoreLabel confidenceScores) { - this.confidenceScores = confidenceScores; - return this; - } - - /** - * Get the offset property: The opinion offset from the start of the sentence. - * - * @return the offset value. - */ - public int getOffset() { - return this.offset; - } - - /** - * Set the offset property: The opinion offset from the start of the sentence. - * - * @param offset the offset value to set. - * @return the SentenceOpinion object itself. - */ - public SentenceOpinion setOffset(int offset) { - this.offset = offset; - return this; - } - - /** - * Get the length property: The length of the opinion. - * - * @return the length value. - */ - public int getLength() { - return this.length; - } - - /** - * Set the length property: The length of the opinion. - * - * @param length the length value to set. - * @return the SentenceOpinion object itself. - */ - public SentenceOpinion setLength(int length) { - this.length = length; - return this; - } - - /** - * Get the text property: The aspect text detected. - * - * @return the text value. - */ - public String getText() { - return this.text; - } - - /** - * Set the text property: The aspect text detected. - * - * @param text the text value to set. - * @return the SentenceOpinion object itself. - */ - public SentenceOpinion setText(String text) { - this.text = text; - return this; - } - - /** - * Get the isNegated property: The indicator representing if the opinion is negated. - * - * @return the isNegated value. - */ - public boolean isNegated() { - return this.isNegated; - } - - /** - * Set the isNegated property: The indicator representing if the opinion is negated. - * - * @param isNegated the isNegated value to set. - * @return the SentenceOpinion object itself. - */ - public SentenceOpinion setIsNegated(boolean isNegated) { - this.isNegated = isNegated; - return this; - } -} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentenceOpinionSentiment.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentenceOpinionSentiment.java deleted file mode 100644 index 976677a4f2e50..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentenceOpinionSentiment.java +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.ai.textanalytics.implementation.models; - -import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import java.util.Collection; - -/** Defines values for SentenceOpinionSentiment. */ -public final class SentenceOpinionSentiment extends ExpandableStringEnum { - /** Static value positive for SentenceOpinionSentiment. */ - public static final SentenceOpinionSentiment POSITIVE = fromString("positive"); - - /** Static value mixed for SentenceOpinionSentiment. */ - public static final SentenceOpinionSentiment MIXED = fromString("mixed"); - - /** Static value negative for SentenceOpinionSentiment. */ - public static final SentenceOpinionSentiment NEGATIVE = fromString("negative"); - - /** - * Creates or finds a SentenceOpinionSentiment from its string representation. - * - * @param name a name to look for. - * @return the corresponding SentenceOpinionSentiment. - */ - @JsonCreator - public static SentenceOpinionSentiment fromString(String name) { - return fromString(name, SentenceOpinionSentiment.class); - } - - /** @return known SentenceOpinionSentiment values. */ - public static Collection values() { - return values(SentenceOpinionSentiment.class); - } -} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentenceSentiment.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentenceSentiment.java index 5bdd3283c6808..600f1e838c8c7 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentenceSentiment.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentenceSentiment.java @@ -6,15 +6,16 @@ import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; -/** The SentenceSentiment model. */ +/** + * The SentenceSentiment model. + */ @Fluent public final class SentenceSentiment { /* * The sentence text. */ - @JsonProperty(value = "text", required = true) + @JsonProperty(value = "text") private String text; /* @@ -37,26 +38,14 @@ public final class SentenceSentiment { private int offset; /* - * The length of the sentence. + * The length of the sentence by Unicode standard. */ @JsonProperty(value = "length", required = true) private int length; - /* - * The array of aspect object for the sentence. - */ - @JsonProperty(value = "aspects") - private List aspects; - - /* - * The array of opinion object for the sentence. - */ - @JsonProperty(value = "opinions") - private List opinions; - /** * Get the text property: The sentence text. - * + * * @return the text value. */ public String getText() { @@ -65,7 +54,7 @@ public String getText() { /** * Set the text property: The sentence text. - * + * * @param text the text value to set. * @return the SentenceSentiment object itself. */ @@ -76,7 +65,7 @@ public SentenceSentiment setText(String text) { /** * Get the sentiment property: The predicted Sentiment for the sentence. - * + * * @return the sentiment value. */ public SentenceSentimentValue getSentiment() { @@ -85,7 +74,7 @@ public SentenceSentimentValue getSentiment() { /** * Set the sentiment property: The predicted Sentiment for the sentence. - * + * * @param sentiment the sentiment value to set. * @return the SentenceSentiment object itself. */ @@ -95,9 +84,9 @@ public SentenceSentiment setSentiment(SentenceSentimentValue sentiment) { } /** - * Get the confidenceScores property: The sentiment confidence score between 0 and 1 for the sentence for all - * classes. - * + * Get the confidenceScores property: The sentiment confidence score + * between 0 and 1 for the sentence for all classes. + * * @return the confidenceScores value. */ public SentimentConfidenceScorePerLabel getConfidenceScores() { @@ -105,9 +94,9 @@ public SentimentConfidenceScorePerLabel getConfidenceScores() { } /** - * Set the confidenceScores property: The sentiment confidence score between 0 and 1 for the sentence for all - * classes. - * + * Set the confidenceScores property: The sentiment confidence score + * between 0 and 1 for the sentence for all classes. + * * @param confidenceScores the confidenceScores value to set. * @return the SentenceSentiment object itself. */ @@ -117,8 +106,9 @@ public SentenceSentiment setConfidenceScores(SentimentConfidenceScorePerLabel co } /** - * Get the offset property: The sentence offset from the start of the document. - * + * Get the offset property: The sentence offset from the start of the + * document. + * * @return the offset value. */ public int getOffset() { @@ -126,8 +116,9 @@ public int getOffset() { } /** - * Set the offset property: The sentence offset from the start of the document. - * + * Set the offset property: The sentence offset from the start of the + * document. + * * @param offset the offset value to set. * @return the SentenceSentiment object itself. */ @@ -137,8 +128,8 @@ public SentenceSentiment setOffset(int offset) { } /** - * Get the length property: The length of the sentence. - * + * Get the length property: The length of the sentence by Unicode standard. + * * @return the length value. */ public int getLength() { @@ -146,8 +137,8 @@ public int getLength() { } /** - * Set the length property: The length of the sentence. - * + * Set the length property: The length of the sentence by Unicode standard. + * * @param length the length value to set. * @return the SentenceSentiment object itself. */ @@ -155,44 +146,4 @@ public SentenceSentiment setLength(int length) { this.length = length; return this; } - - /** - * Get the aspects property: The array of aspect object for the sentence. - * - * @return the aspects value. - */ - public List getAspects() { - return this.aspects; - } - - /** - * Set the aspects property: The array of aspect object for the sentence. - * - * @param aspects the aspects value to set. - * @return the SentenceSentiment object itself. - */ - public SentenceSentiment setAspects(List aspects) { - this.aspects = aspects; - return this; - } - - /** - * Get the opinions property: The array of opinion object for the sentence. - * - * @return the opinions value. - */ - public List getOpinions() { - return this.opinions; - } - - /** - * Set the opinions property: The array of opinion object for the sentence. - * - * @param opinions the opinions value to set. - * @return the SentenceSentiment object itself. - */ - public SentenceSentiment setOpinions(List opinions) { - this.opinions = opinions; - return this; - } } diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentenceSentimentValue.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentenceSentimentValue.java index 5be87d8a7036f..c80b516477d59 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentenceSentimentValue.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentenceSentimentValue.java @@ -7,18 +7,28 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -/** Defines values for SentenceSentimentValue. */ +/** + * Defines values for SentenceSentimentValue. + */ public enum SentenceSentimentValue { - /** Enum value positive. */ + /** + * Enum value positive. + */ POSITIVE("positive"), - /** Enum value neutral. */ + /** + * Enum value neutral. + */ NEUTRAL("neutral"), - /** Enum value negative. */ + /** + * Enum value negative. + */ NEGATIVE("negative"); - /** The actual serialized value for a SentenceSentimentValue instance. */ + /** + * The actual serialized value for a SentenceSentimentValue instance. + */ private final String value; SentenceSentimentValue(String value) { @@ -27,7 +37,7 @@ public enum SentenceSentimentValue { /** * Parses a serialized value to a SentenceSentimentValue instance. - * + * * @param value the serialized value to parse. * @return the parsed SentenceSentimentValue object, or null if unable to parse. */ diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentimentConfidenceScorePerLabel.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentimentConfidenceScorePerLabel.java index 94da963ed515a..9c7561cf86b60 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentimentConfidenceScorePerLabel.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentimentConfidenceScorePerLabel.java @@ -7,7 +7,9 @@ import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; -/** The SentimentConfidenceScorePerLabel model. */ +/** + * The SentimentConfidenceScorePerLabel model. + */ @Fluent public final class SentimentConfidenceScorePerLabel { /* @@ -30,7 +32,7 @@ public final class SentimentConfidenceScorePerLabel { /** * Get the positive property: The positive property. - * + * * @return the positive value. */ public double getPositive() { @@ -39,7 +41,7 @@ public double getPositive() { /** * Set the positive property: The positive property. - * + * * @param positive the positive value to set. * @return the SentimentConfidenceScorePerLabel object itself. */ @@ -50,7 +52,7 @@ public SentimentConfidenceScorePerLabel setPositive(double positive) { /** * Get the neutral property: The neutral property. - * + * * @return the neutral value. */ public double getNeutral() { @@ -59,7 +61,7 @@ public double getNeutral() { /** * Set the neutral property: The neutral property. - * + * * @param neutral the neutral value to set. * @return the SentimentConfidenceScorePerLabel object itself. */ @@ -70,7 +72,7 @@ public SentimentConfidenceScorePerLabel setNeutral(double neutral) { /** * Get the negative property: The negative property. - * + * * @return the negative value. */ public double getNegative() { @@ -79,7 +81,7 @@ public double getNegative() { /** * Set the negative property: The negative property. - * + * * @param negative the negative value to set. * @return the SentimentConfidenceScorePerLabel object itself. */ diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentimentResponse.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentimentResponse.java index f2b2394796892..b9175434c7200 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentimentResponse.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentimentResponse.java @@ -8,7 +8,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; -/** The SentimentResponse model. */ +/** + * The SentimentResponse model. + */ @Fluent public final class SentimentResponse { /* @@ -38,7 +40,7 @@ public final class SentimentResponse { /** * Get the documents property: Sentiment analysis per document. - * + * * @return the documents value. */ public List getDocuments() { @@ -47,7 +49,7 @@ public List getDocuments() { /** * Set the documents property: Sentiment analysis per document. - * + * * @param documents the documents value to set. * @return the SentimentResponse object itself. */ @@ -58,7 +60,7 @@ public SentimentResponse setDocuments(List documents) { /** * Get the errors property: Errors by document id. - * + * * @return the errors value. */ public List getErrors() { @@ -67,7 +69,7 @@ public List getErrors() { /** * Set the errors property: Errors by document id. - * + * * @param errors the errors value to set. * @return the SentimentResponse object itself. */ @@ -77,9 +79,9 @@ public SentimentResponse setErrors(List errors) { } /** - * Get the statistics property: if showStats=true was specified in the request this field will contain information - * about the request payload. - * + * Get the statistics property: if showStats=true was specified in the + * request this field will contain information about the request payload. + * * @return the statistics value. */ public RequestStatistics getStatistics() { @@ -87,9 +89,9 @@ public RequestStatistics getStatistics() { } /** - * Set the statistics property: if showStats=true was specified in the request this field will contain information - * about the request payload. - * + * Set the statistics property: if showStats=true was specified in the + * request this field will contain information about the request payload. + * * @param statistics the statistics value to set. * @return the SentimentResponse object itself. */ @@ -99,8 +101,9 @@ public SentimentResponse setStatistics(RequestStatistics statistics) { } /** - * Get the modelVersion property: This field indicates which model is used for scoring. - * + * Get the modelVersion property: This field indicates which model is used + * for scoring. + * * @return the modelVersion value. */ public String getModelVersion() { @@ -108,8 +111,9 @@ public String getModelVersion() { } /** - * Set the modelVersion property: This field indicates which model is used for scoring. - * + * Set the modelVersion property: This field indicates which model is used + * for scoring. + * * @param modelVersion the modelVersion value to set. * @return the SentimentResponse object itself. */ diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/StringIndexType.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/StringIndexType.java deleted file mode 100644 index 208af0412a484..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/StringIndexType.java +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.ai.textanalytics.implementation.models; - -import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import java.util.Collection; - -/** Defines values for StringIndexType. */ -public final class StringIndexType extends ExpandableStringEnum { - /** Static value TextElements_v8 for StringIndexType. */ - public static final StringIndexType TEXT_ELEMENTS_V8 = fromString("TextElements_v8"); - - /** Static value UnicodeCodePoint for StringIndexType. */ - public static final StringIndexType UNICODE_CODE_POINT = fromString("UnicodeCodePoint"); - - /** Static value Utf16CodeUnit for StringIndexType. */ - public static final StringIndexType UTF16CODE_UNIT = fromString("Utf16CodeUnit"); - - /** - * Creates or finds a StringIndexType from its string representation. - * - * @param name a name to look for. - * @return the corresponding StringIndexType. - */ - @JsonCreator - public static StringIndexType fromString(String name) { - return fromString(name, StringIndexType.class); - } - - /** @return known StringIndexType values. */ - public static Collection values() { - return values(StringIndexType.class); - } -} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TextAnalyticsError.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TextAnalyticsError.java index e3da62cd7a965..5e5d1a837d602 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TextAnalyticsError.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TextAnalyticsError.java @@ -8,7 +8,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; -/** The TextAnalyticsError model. */ +/** + * The TextAnalyticsError model. + */ @Fluent public final class TextAnalyticsError { /* @@ -43,7 +45,7 @@ public final class TextAnalyticsError { /** * Get the code property: Error code. - * + * * @return the code value. */ public ErrorCodeValue getCode() { @@ -52,7 +54,7 @@ public ErrorCodeValue getCode() { /** * Set the code property: Error code. - * + * * @param code the code value to set. * @return the TextAnalyticsError object itself. */ @@ -63,7 +65,7 @@ public TextAnalyticsError setCode(ErrorCodeValue code) { /** * Get the message property: Error message. - * + * * @return the message value. */ public String getMessage() { @@ -72,7 +74,7 @@ public String getMessage() { /** * Set the message property: Error message. - * + * * @param message the message value to set. * @return the TextAnalyticsError object itself. */ @@ -83,7 +85,7 @@ public TextAnalyticsError setMessage(String message) { /** * Get the target property: Error target. - * + * * @return the target value. */ public String getTarget() { @@ -92,7 +94,7 @@ public String getTarget() { /** * Set the target property: Error target. - * + * * @param target the target value to set. * @return the TextAnalyticsError object itself. */ @@ -102,8 +104,9 @@ public TextAnalyticsError setTarget(String target) { } /** - * Get the innererror property: Inner error contains more specific information. - * + * Get the innererror property: Inner error contains more specific + * information. + * * @return the innererror value. */ public InnerError getInnererror() { @@ -111,8 +114,9 @@ public InnerError getInnererror() { } /** - * Set the innererror property: Inner error contains more specific information. - * + * Set the innererror property: Inner error contains more specific + * information. + * * @param innererror the innererror value to set. * @return the TextAnalyticsError object itself. */ @@ -122,8 +126,9 @@ public TextAnalyticsError setInnererror(InnerError innererror) { } /** - * Get the details property: Details about specific errors that led to this reported error. - * + * Get the details property: Details about specific errors that led to this + * reported error. + * * @return the details value. */ public List getDetails() { @@ -131,8 +136,9 @@ public List getDetails() { } /** - * Set the details property: Details about specific errors that led to this reported error. - * + * Set the details property: Details about specific errors that led to this + * reported error. + * * @param details the details value to set. * @return the TextAnalyticsError object itself. */ diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ErrorResponseException.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TextAnalyticsErrorException.java similarity index 56% rename from sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ErrorResponseException.java rename to sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TextAnalyticsErrorException.java index 4d335f2abf876..64537e34050e4 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ErrorResponseException.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TextAnalyticsErrorException.java @@ -7,31 +7,33 @@ import com.azure.core.exception.HttpResponseException; import com.azure.core.http.HttpResponse; -/** Exception thrown for an invalid response with ErrorResponse information. */ -public final class ErrorResponseException extends HttpResponseException { +/** + * Exception thrown for an invalid response with TextAnalyticsError information. + */ +public final class TextAnalyticsErrorException extends HttpResponseException { /** - * Initializes a new instance of the ErrorResponseException class. - * + * Initializes a new instance of the TextAnalyticsErrorException class. + * * @param message the exception message or the response content if a message is not available. * @param response the HTTP response. */ - public ErrorResponseException(String message, HttpResponse response) { + public TextAnalyticsErrorException(String message, HttpResponse response) { super(message, response); } /** - * Initializes a new instance of the ErrorResponseException class. - * + * Initializes a new instance of the TextAnalyticsErrorException class. + * * @param message the exception message or the response content if a message is not available. * @param response the HTTP response. * @param value the deserialized response value. */ - public ErrorResponseException(String message, HttpResponse response, ErrorResponse value) { + public TextAnalyticsErrorException(String message, HttpResponse response, TextAnalyticsError value) { super(message, response, value); } @Override - public ErrorResponse getValue() { - return (ErrorResponse) super.getValue(); + public TextAnalyticsError getValue() { + return (TextAnalyticsError) super.getValue(); } } diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TextAnalyticsWarning.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TextAnalyticsWarning.java index bbd1e6c2b6fc1..50318f1fbc3ae 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TextAnalyticsWarning.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TextAnalyticsWarning.java @@ -7,7 +7,9 @@ import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; -/** The TextAnalyticsWarning model. */ +/** + * The TextAnalyticsWarning model. + */ @Fluent public final class TextAnalyticsWarning { /* @@ -30,7 +32,7 @@ public final class TextAnalyticsWarning { /** * Get the code property: Error code. - * + * * @return the code value. */ public WarningCodeValue getCode() { @@ -39,7 +41,7 @@ public WarningCodeValue getCode() { /** * Set the code property: Error code. - * + * * @param code the code value to set. * @return the TextAnalyticsWarning object itself. */ @@ -50,7 +52,7 @@ public TextAnalyticsWarning setCode(WarningCodeValue code) { /** * Get the message property: Warning message. - * + * * @return the message value. */ public String getMessage() { @@ -59,7 +61,7 @@ public String getMessage() { /** * Set the message property: Warning message. - * + * * @param message the message value to set. * @return the TextAnalyticsWarning object itself. */ @@ -69,8 +71,9 @@ public TextAnalyticsWarning setMessage(String message) { } /** - * Get the targetRef property: A JSON pointer reference indicating the target object. - * + * Get the targetRef property: A JSON pointer reference indicating the + * target object. + * * @return the targetRef value. */ public String getTargetRef() { @@ -78,8 +81,9 @@ public String getTargetRef() { } /** - * Set the targetRef property: A JSON pointer reference indicating the target object. - * + * Set the targetRef property: A JSON pointer reference indicating the + * target object. + * * @param targetRef the targetRef value to set. * @return the TextAnalyticsWarning object itself. */ diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TokenSentimentValue.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TokenSentimentValue.java deleted file mode 100644 index 553364d3720c5..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TokenSentimentValue.java +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.ai.textanalytics.implementation.models; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -/** Defines values for TokenSentimentValue. */ -public enum TokenSentimentValue { - /** Enum value positive. */ - POSITIVE("positive"), - - /** Enum value mixed. */ - MIXED("mixed"), - - /** Enum value negative. */ - NEGATIVE("negative"); - - /** The actual serialized value for a TokenSentimentValue instance. */ - private final String value; - - TokenSentimentValue(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a TokenSentimentValue instance. - * - * @param value the serialized value to parse. - * @return the parsed TokenSentimentValue object, or null if unable to parse. - */ - @JsonCreator - public static TokenSentimentValue fromString(String value) { - TokenSentimentValue[] items = TokenSentimentValue.values(); - for (TokenSentimentValue item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - @JsonValue - @Override - public String toString() { - return this.value; - } -} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/WarningCodeValue.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/WarningCodeValue.java index d196cf67b357c..d620e009cacfb 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/WarningCodeValue.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/WarningCodeValue.java @@ -4,31 +4,52 @@ package com.azure.ai.textanalytics.implementation.models; -import com.azure.core.util.ExpandableStringEnum; import com.fasterxml.jackson.annotation.JsonCreator; -import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonValue; -/** Defines values for WarningCodeValue. */ -public final class WarningCodeValue extends ExpandableStringEnum { - /** Static value LongWordsInDocument for WarningCodeValue. */ - public static final WarningCodeValue LONG_WORDS_IN_DOCUMENT = fromString("LongWordsInDocument"); +/** + * Defines values for WarningCodeValue. + */ +public enum WarningCodeValue { + /** + * Enum value LongWordsInDocument. + */ + LONG_WORDS_IN_DOCUMENT("LongWordsInDocument"), + + /** + * Enum value DocumentTruncated. + */ + DOCUMENT_TRUNCATED("DocumentTruncated"); - /** Static value DocumentTruncated for WarningCodeValue. */ - public static final WarningCodeValue DOCUMENT_TRUNCATED = fromString("DocumentTruncated"); + /** + * The actual serialized value for a WarningCodeValue instance. + */ + private final String value; + + WarningCodeValue(String value) { + this.value = value; + } /** - * Creates or finds a WarningCodeValue from its string representation. - * - * @param name a name to look for. - * @return the corresponding WarningCodeValue. + * Parses a serialized value to a WarningCodeValue instance. + * + * @param value the serialized value to parse. + * @return the parsed WarningCodeValue object, or null if unable to parse. */ @JsonCreator - public static WarningCodeValue fromString(String name) { - return fromString(name, WarningCodeValue.class); + public static WarningCodeValue fromString(String value) { + WarningCodeValue[] items = WarningCodeValue.values(); + for (WarningCodeValue item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; } - /** @return known WarningCodeValue values. */ - public static Collection values() { - return values(WarningCodeValue.class); + @JsonValue + @Override + public String toString() { + return this.value; } } diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/package-info.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/package-info.java index 99e5843b9cc75..3e23bae65d862 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/package-info.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/package-info.java @@ -3,11 +3,14 @@ // Code generated by Microsoft (R) AutoRest Code Generator. /** - * Package containing the data models for TextAnalyticsClient. 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 extraction and language detection. No training data is needed - * to use this API; just bring your text data. This API uses advanced natural language processing techniques to deliver - * best in class predictions. Further documentation can be found in + * Package containing the data models for TextAnalyticsClient. + * 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 + * extraction and language detection. No training data is needed to use this + * API; just bring your text data. This API uses advanced natural language + * processing techniques to deliver best in class predictions. Further + * documentation can be found in * https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview. */ package com.azure.ai.textanalytics.implementation.models; diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/package-info.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/package-info.java index 583ec2fb820b2..14f77f46074d6 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/package-info.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/package-info.java @@ -3,11 +3,15 @@ // Code generated by Microsoft (R) AutoRest Code Generator. /** - * Package containing the implementations and inner classes for TextAnalyticsClient. 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 extraction and language detection. No - * training data is needed to use this API; just bring your text data. This API uses advanced natural language - * processing techniques to deliver best in class predictions. Further documentation can be found in + * Package containing the implementations and inner classes for + * TextAnalyticsClient. + * 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 + * extraction and language detection. No training data is needed to use this + * API; just bring your text data. This API uses advanced natural language + * processing techniques to deliver best in class predictions. Further + * documentation can be found in * https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview. */ package com.azure.ai.textanalytics.implementation; diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/AnalyzeSentimentOptions.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/AnalyzeSentimentOptions.java deleted file mode 100644 index 5c38135d5a1cb..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/AnalyzeSentimentOptions.java +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.textanalytics.models; - -import com.azure.core.annotation.Fluent; - -/** - * The {@link AnalyzeSentimentOptions} model. - */ -@Fluent -public final class AnalyzeSentimentOptions extends TextAnalyticsRequestOptions { - - /* - * The boolean indicator to include opinion mining data in the returned result. If this - * flag is specified, you'll get a {@code minedOpinions} property on SentenceSentiment. It is provided by service - * v3.1-preview.1 and later. - */ - private boolean includeOpinionMining; - - /** - * Set the model version. This value indicates which model will be used for scoring, e.g. "latest", "2019-10-01". - * If a model-version is not specified, the API will default to the latest, non-preview version. - * - * @param modelVersion The model version. - * - * @return The {@link AnalyzeSentimentOptions} object itself. - */ - @Override - public AnalyzeSentimentOptions setModelVersion(String modelVersion) { - super.setModelVersion(modelVersion); - return this; - } - - /** - * Set the value of {@code includeStatistics}. - * - * @param includeStatistics If a boolean value was specified in the request this field will contain - * information about the document payload. - * - * @return the {@link AnalyzeSentimentOptions} object itself. - */ - @Override - public AnalyzeSentimentOptions setIncludeStatistics(boolean includeStatistics) { - super.setIncludeStatistics(includeStatistics); - return this; - } - - /** - * Get the value of {@code includeOpinionMining}. The boolean indicator to include opinion mining data in the - * returned result. If this flag is specified, you'll get a {@code minedOpinions} property on SentenceSentiment. - * It is provided by service v3.1-preview.1 and later. - * - * @return the value of {@code includeOpinionMining}. - */ - public boolean isIncludeOpinionMining() { - return includeOpinionMining; - } - - /** - * Set the value of {@code includeOpinionMining}. The boolean indicator to include opinion mining data in the - * returned result. If this flag is specified, you'll get a {@code minedOpinions} property on SentenceSentiment. - * It is provided by service v3.1-preview.1 and later. - * - * @param includeOpinionMining The boolean indicator to include opinion mining data in the returned result. - * - * @return the AnalyzeSentimentOptions object itself. - */ - public AnalyzeSentimentOptions setIncludeOpinionMining(boolean includeOpinionMining) { - this.includeOpinionMining = includeOpinionMining; - return this; - } -} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/AnalyzeSentimentResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/AnalyzeSentimentResult.java index 0c89a8535903a..82fe9ac988d03 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/AnalyzeSentimentResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/AnalyzeSentimentResult.java @@ -30,9 +30,6 @@ public AnalyzeSentimentResult(String id, TextDocumentStatistics textDocumentStat * Get the document sentiment. * * @return The document sentiment. - * - * @throws TextAnalyticsException if result has {@code isError} equals to true and when a non-error property - * was accessed. */ public DocumentSentiment getDocumentSentiment() { throwExceptionIfError(); diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/AspectSentiment.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/AspectSentiment.java deleted file mode 100644 index 56c9acec63194..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/AspectSentiment.java +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.textanalytics.models; - -import com.azure.core.annotation.Immutable; - -/** - * The {@link AspectSentiment} model. - */ -@Immutable -public final class AspectSentiment { - private final String text; - private final TextSentiment sentiment; - private final SentimentConfidenceScores confidenceScores; - private final int offset; - - /** - * Create an {@link AspectSentiment} model that describes aspect. - * - * @param text The aspect text property. - * @param sentiment The text sentiment label: POSITIVE, NEGATIVE, MIXED. {@link TextSentiment} has - * NEUTRAL sentiment type additionally, but aspect sentiment can only be POSITIVE, NEGATIVE, or MIXED. - * @param offset The aspect text offset from the start of document. - * @param confidenceScores The {@link SentimentConfidenceScores}. - */ - public AspectSentiment(String text, TextSentiment sentiment, int offset, - SentimentConfidenceScores confidenceScores) { - this.text = text; - this.sentiment = sentiment; - this.confidenceScores = confidenceScores; - this.offset = offset; - } - - /** - * Get the aspect text property. - * - * @return The text value. - */ - public String getText() { - return text; - } - - /** - * Get the aspect text sentiment label: POSITIVE, NEGATIVE, MIXED. {@link TextSentiment} has - * NEUTRAL sentiment type additionally, but aspect sentiment can only be POSITIVE, NEGATIVE, or MIXED. - * - * @return The sentiment value. - */ - public TextSentiment getSentiment() { - return sentiment; - } - - - /** - * Get the aspect text offset from the start of document. - * - * @return The aspect text offset from the start of document. - */ - public int getOffset() { - return offset; - } - - /** - * Get the confidence score of the sentiment label. All score values sum up to 1, the higher the score, the - * higher the confidence in the sentiment. AspectSentiment only has positive or negative confidence score value - * because there is no neutral sentiment label in the AspectSentiment. - * - * @return The {@link SentimentConfidenceScores}. - */ - public SentimentConfidenceScores getConfidenceScores() { - return confidenceScores; - } -} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/CategorizedEntity.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/CategorizedEntity.java index af9fb8c6ac43f..fd666be4127f8 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/CategorizedEntity.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/CategorizedEntity.java @@ -10,28 +10,25 @@ */ @Immutable public final class CategorizedEntity { + /* + * CategorizedEntity text as appears in the request. + */ private final String text; + + /* + * CategorizedEntity category, such as Person/Location/Org/SSN etc + */ private final EntityCategory category; + + /* + * CategorizedEntity sub category, such as Age/Year/TimeRange etc + */ private final String subcategory; - private final double confidenceScore; - private final int offset; - /** - * Creates a {@link CategorizedEntity} model that describes entity. - * - * @param text The entity text as appears in the request. - * @param category The entity category, such as Person/Location/Org/SSN etc. - * @param subcategory The entity subcategory, such as Age/Year/TimeRange etc. - * @param confidenceScore If a well-known item is recognized, a decimal number denoting the confidence level - * between 0 and 1 will be returned. + /* + * Confidence score between 0 and 1 of the extracted entity. */ - public CategorizedEntity(String text, EntityCategory category, String subcategory, double confidenceScore) { - this.text = text; - this.category = category; - this.subcategory = subcategory; - this.confidenceScore = confidenceScore; - this.offset = 0; - } + private final double confidenceScore; /** * Creates a {@link CategorizedEntity} model that describes entity. @@ -39,17 +36,13 @@ public CategorizedEntity(String text, EntityCategory category, String subcategor * @param text The entity text as appears in the request. * @param category The entity category, such as Person/Location/Org/SSN etc. * @param subcategory The entity subcategory, such as Age/Year/TimeRange etc. - * @param confidenceScore If a well-known item is recognized, a decimal number denoting the confidence level - * between 0 and 1 will be returned. - * @param offset The start position for the entity text. + * @param confidenceScore A confidence score between 0 and 1 of the extracted entity. */ - public CategorizedEntity(String text, EntityCategory category, String subcategory, double confidenceScore, - int offset) { + public CategorizedEntity(String text, EntityCategory category, String subcategory, double confidenceScore) { this.text = text; this.category = category; this.subcategory = subcategory; this.confidenceScore = confidenceScore; - this.offset = offset; } /** @@ -80,21 +73,11 @@ public String getSubcategory() { } /** - * Get the score property: If a well-known item is recognized, a decimal - * number denoting the confidence level between 0 and 1 will be returned. + * Get the score property: Confidence score between 0 and 1 of the extracted entity. * * @return The score value. */ public double getConfidenceScore() { return this.confidenceScore; } - - /** - * Get the offset of entity text. The start position for the entity text in a document. - * - * @return The offset of entity text. - */ - public int getOffset() { - return offset; - } } diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/DetectLanguageResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/DetectLanguageResult.java index 49ab2a4a0feec..1636b1093230c 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/DetectLanguageResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/DetectLanguageResult.java @@ -29,9 +29,6 @@ public DetectLanguageResult(String id, TextDocumentStatistics textDocumentStatis * Get the detected primary language. * * @return The detected language. - * - * @throws TextAnalyticsException if result has {@code isError} equals to true and when a non-error property - * was accessed. */ public DetectedLanguage getPrimaryLanguage() { throwExceptionIfError(); diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/ExtractKeyPhraseResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/ExtractKeyPhraseResult.java index e2aa9fdf51145..7b472d40764d7 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/ExtractKeyPhraseResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/ExtractKeyPhraseResult.java @@ -30,9 +30,6 @@ public ExtractKeyPhraseResult(String id, TextDocumentStatistics textDocumentStat * Get a {@link KeyPhrasesCollection} contains a list of key phrases and warnings. * * @return A {@link KeyPhrasesCollection} contains a list of key phrases and warnings. - * - * @throws TextAnalyticsException if result has {@code isError} equals to true and when a non-error property - * was accessed. */ public KeyPhrasesCollection getKeyPhrases() { throwExceptionIfError(); diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/LinkedEntity.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/LinkedEntity.java index fb8595e635b8b..de01b414b9222 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/LinkedEntity.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/LinkedEntity.java @@ -41,13 +41,6 @@ public final class LinkedEntity { */ private final String dataSource; - /* - * Bing Entity Search unique identifier of the recognized entity. Use in conjunction with - * the Bing Entity Search API to fetch additional relevant information. Only available for API version - * v3.1-preview.2 and up. - */ - private final String bingEntitySearchApiId; - /** * Creates a {@link LinkedEntity} model that describes linked entity. * @@ -66,31 +59,6 @@ public LinkedEntity(String name, IterableStream matches, Stri this.dataSourceEntityId = dataSourceEntityId; this.url = url; this.dataSource = dataSource; - this.bingEntitySearchApiId = null; - } - - /** - * Creates a {@link LinkedEntity} model that describes linked entity. - * - * @param name The entity Linking formal name. - * @param matches A list of instances this entity appears in the text. - * @param language The language used in the data source. - * @param dataSourceEntityId Unique identifier of the recognized entity from the data source. - * @param url URL for the entity's page from the data source. - * @param dataSource The data source used to extract entity linking, such as Wiki/Bing etc. - * @param bingEntitySearchApiId Bing Entity Search unique identifier of the recognized entity. Use in conjunction - * with the Bing Entity Search SDK to fetch additional relevant information. Only available for API version - * v3.1-preview.2 and up. - */ - public LinkedEntity(String name, IterableStream matches, String language, - String dataSourceEntityId, String url, String dataSource, String bingEntitySearchApiId) { - this.name = name; - this.matches = matches; - this.language = language; - this.dataSourceEntityId = dataSourceEntityId; - this.url = url; - this.dataSource = dataSource; - this.bingEntitySearchApiId = bingEntitySearchApiId; } /** @@ -146,15 +114,4 @@ public String getUrl() { public String getDataSource() { return this.dataSource; } - - /** - * Get the bingEntitySearchApiId property: Bing Entity Search unique identifier of the recognized entity. - * Use in conjunction with the Bing Entity Search SDK to fetch additional relevant information. Only available - * for API version v3.1-preview.2 and up. - * - * @return The bingEntitySearchApiId value. - */ - public String getBingEntitySearchApiId() { - return this.bingEntitySearchApiId; - } } diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/LinkedEntityMatch.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/LinkedEntityMatch.java index 33ddf20d39953..19e69b190c404 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/LinkedEntityMatch.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/LinkedEntityMatch.java @@ -10,46 +10,29 @@ */ @Immutable public final class LinkedEntityMatch { - private final String text; + /* + * If a well-known item is recognized, a decimal number denoting the + * confidence level between 0 and 1 will be returned. + */ private final double confidenceScore; - private final int offset; - /** - * Creates a {@link LinkedEntityMatch} model that describes linked entity match. - * - * @param text The linked entity match text as appears in the request. - * @param confidenceScore If a well-known item is recognized, a decimal number denoting the - * confidence level between 0 and 1 will be returned. + /* + * Entity text as appears in the request. */ - public LinkedEntityMatch(String text, double confidenceScore) { - this.text = text; - this.confidenceScore = confidenceScore; - this.offset = 0; - } + private final String text; /** * Creates a {@link LinkedEntityMatch} model that describes linked entity match. * - * @param text The linked entity match text as appears in the request. + * @param text The entity text as appears in the request. * @param confidenceScore If a well-known item is recognized, a decimal number denoting the * confidence level between 0 and 1 will be returned. - * @param offset The start position for the linked entity match text in a document. */ - public LinkedEntityMatch(String text, double confidenceScore, int offset) { + public LinkedEntityMatch(String text, double confidenceScore) { this.text = text; - this.offset = offset; this.confidenceScore = confidenceScore; } - /** - * Get the linked entity match text property: linked entity text as appears in the request. - * - * @return The text value. - */ - public String getText() { - return this.text; - } - /** * Get the score property: If a well-known item is recognized, a decimal * number denoting the confidence level between 0 and 1 will be returned. @@ -61,11 +44,11 @@ public double getConfidenceScore() { } /** - * Get the offset of linked entity match text. The start position for the linked entity match text in a document. + * Get the text property: Entity text as appears in the request. * - * @return The offset of linked entity match text. + * @return The text value. */ - public int getOffset() { - return offset; + public String getText() { + return this.text; } } diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/MinedOpinion.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/MinedOpinion.java deleted file mode 100644 index ce300ff9d0624..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/MinedOpinion.java +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.textanalytics.models; - -import com.azure.core.util.IterableStream; - -/** - * The {@link MinedOpinion} model. - */ -public final class MinedOpinion { - private final AspectSentiment aspect; - private final IterableStream opinions; - - /** - * Create an {@link MinedOpinion} model that describes the mined opinions. - * - * @param aspect The aspect of a product/service that the opinions is about. - * @param opinions The opinions of the aspect text. - */ - public MinedOpinion(AspectSentiment aspect, IterableStream opinions) { - this.aspect = aspect; - this.opinions = opinions; - } - - /** - * Get the aspect in text, such as the attributes of products or services. For example, if a customer leaves - * feedback about a hotel such as "the room was great, but the staff was unfriendly", opinion mining will locate - * aspects in the text. The "room" and "staff" are two aspects recognized. - * - * @return The aspect in text. - */ - public AspectSentiment getAspect() { - return this.aspect; - } - - /** - * Get the opinions of aspect text. - * - * @return The opinions of aspect text. - */ - public IterableStream getOpinions() { - return opinions; - } -} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/OpinionSentiment.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/OpinionSentiment.java deleted file mode 100644 index 249430ea2a3a0..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/OpinionSentiment.java +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.textanalytics.models; - -import com.azure.core.annotation.Immutable; - -/** - * The {@link OpinionSentiment} model. - */ -@Immutable -public final class OpinionSentiment { - private final String text; - private final TextSentiment sentiment; - private final SentimentConfidenceScores confidenceScores; - private final boolean isNegated; - private final int offset; - - /** - * Create an {@link OpinionSentiment} model that describes opinion sentiment. - * - * @param text The opinion text property. - * @param sentiment The text sentiment label: POSITIVE, NEGATIVE, MIXED. {@link TextSentiment} has - * {@code neutral} sentiment type additionally, but opinion sentiment can only be positive, negative, or mixed. - * @param offset The offset of opinion text. - * @param isNegated The boolean indicator to show if the opinion text negated or not. - * @param confidenceScores The {@link SentimentConfidenceScores}. - */ - public OpinionSentiment(String text, TextSentiment sentiment, int offset, - boolean isNegated, SentimentConfidenceScores confidenceScores) { - this.text = text; - this.sentiment = sentiment; - this.offset = offset; - this.isNegated = isNegated; - this.confidenceScores = confidenceScores; - } - - /** - * Get the opinion text property. - * - * @return The text value. - */ - public String getText() { - return text; - } - - /** - * Get the opinion text sentiment label: POSITIVE, NEGATIVE, MIXED. {@link TextSentiment} has - * {@code neutral} sentiment type additionally, but aspect sentiment can only be positive, negative, or mixed. - * - * @return The sentiment value. - */ - public TextSentiment getSentiment() { - return sentiment; - } - - /** - * Get the offset of opinion text. - * - * @return The offset of opinion text. - */ - public int getOffset() { - return offset; - } - - /** - * Get the boolean indicator to show if the text is negative. - * - * @return The boolean indicator to show if the text is negative. - */ - public boolean isNegated() { - return isNegated; - } - - /** - * Get the confidence score of the sentiment label. All score values sum up to 1, the higher the score, the - * higher the confidence in the sentiment. OpinionSentiment only has positive or negative confidence score value - * because there is no neutral sentiment label in the OpinionSentiment. - * - * @return The {@link SentimentConfidenceScores}. - */ - public SentimentConfidenceScores getConfidenceScores() { - return confidenceScores; - } -} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/PiiEntity.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/PiiEntity.java deleted file mode 100644 index 7060d96928d98..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/PiiEntity.java +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.textanalytics.models; - -import com.azure.core.annotation.Immutable; - -/** - * The {@link PiiEntity} model. - */ -@Immutable -public final class PiiEntity { - /* - * PiiEntity text as appears in the request. - */ - private final String text; - - /* - * PiiEntity category, such as Person/Location/Org/SSN etc - */ - private final EntityCategory category; - - /* - * PiiEntity sub category, such as Medical/Stock exchange/Sports etc - */ - private final String subcategory; - - /* - * Confidence score between 0 and 1 of the extracted entity. - */ - private final double confidenceScore; - - /* - * Start position for the entity text. - */ - private final int offset; - - /** - * Creates a {@link PiiEntity} model that describes entity. - * @param text The entity text as appears in the request. - * @param category The entity category, such as Person/Location/Org/SSN etc. - * @param subcategory The entity subcategory, such as Medical/Stock exchange/Sports etc. - * @param confidenceScore A confidence score between 0 and 1 of the recognized entity. - * @param offset The start position for the entity text - */ - public PiiEntity(String text, EntityCategory category, String subcategory, double confidenceScore, int offset) { - this.text = text; - this.category = category; - this.subcategory = subcategory; - this.confidenceScore = confidenceScore; - this.offset = offset; - } - - /** - * Get the text property: PII entity text as appears in the request. - * - * @return The {@code text} value. - */ - public String getText() { - return this.text; - } - - /** - * Get the category property: Categorized entity category, such as Person/Location/Org/SSN etc. - * - * @return The {@code category} value. - */ - public EntityCategory getCategory() { - return this.category; - } - - /** - * Get the subcategory property: Categorized entity subcategory, such as Medical/Stock exchange/Sports etc. - * - * @return The {@code subcategory} value. - */ - public String getSubcategory() { - return this.subcategory; - } - - /** - * Get the score property: Confidence score between 0 and 1 of the recognized entity. - * - * @return The {@code confidenceScore} value. - */ - public double getConfidenceScore() { - return this.confidenceScore; - } - - /** - * Get the offset property: the start position for the entity text. - * - * @return The {@code offset} value. - */ - public int getOffset() { - return this.offset; - } -} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/PiiEntityCollection.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/PiiEntityCollection.java deleted file mode 100644 index e0161ac10805e..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/PiiEntityCollection.java +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.textanalytics.models; - -import com.azure.core.annotation.Immutable; -import com.azure.core.util.IterableStream; - -/** - * The {@link PiiEntityCollection} model. - */ -@Immutable -public final class PiiEntityCollection extends IterableStream { - private final String redactedText; - private final IterableStream warnings; - - /** - * Creates a {@link PiiEntityCollection} model that describes a entities collection including warnings. - * - * @param entities An {@link IterableStream} of {@link PiiEntity Personally Identifiable Information entities}. - * @param redactedText The text of the input document with all of the PII information redacted out. - * @param warnings An {@link IterableStream} of {@link TextAnalyticsWarning warnings}. - */ - public PiiEntityCollection(IterableStream entities, String redactedText, - IterableStream warnings) { - super(entities); - this.redactedText = redactedText; - this.warnings = warnings; - } - - /** - * Get the {@link IterableStream} of {@link TextAnalyticsWarning Text Analytics warnings}. - * - * @return {@link IterableStream} of {@link TextAnalyticsWarning}. - */ - public IterableStream getWarnings() { - return this.warnings; - } - - - /** - * Get the property redactedText value. The text of the input document with all of the PII information redacted out. - * Only returned for API version v3.1-preview.2 and up. - * - * @return The text of the input document with all of the PII information redacted out. - */ - public String getRedactedText() { - return redactedText; - } -} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/PiiEntityDomainType.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/PiiEntityDomainType.java deleted file mode 100644 index 14ecd715bc674..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/PiiEntityDomainType.java +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.textanalytics.models; - -import com.azure.core.annotation.Immutable; -import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; - -/** - * Defines values for PiiEntityDomainType. - */ -@Immutable -public final class PiiEntityDomainType extends ExpandableStringEnum { - /** - * Protected health information (PHI) as the PiiEntityDomainType. - */ - public static final PiiEntityDomainType PROTECTED_HEALTH_INFORMATION = fromString("PHI"); - - /** - * Creates or finds a {@link EntityCategory} from its string representation. - * - * @param name The string name to look for. - * @return The corresponding {@link EntityCategory}. - */ - @JsonCreator - public static PiiEntityDomainType fromString(String name) { - return fromString(name, PiiEntityDomainType.class); - } -} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/RecognizeEntitiesResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/RecognizeEntitiesResult.java index ac360e8581233..12e0c94a13188 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/RecognizeEntitiesResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/RecognizeEntitiesResult.java @@ -31,9 +31,6 @@ public RecognizeEntitiesResult(String id, TextDocumentStatistics textDocumentSta * Get an {@link IterableStream} of {@link CategorizedEntity}. * * @return An {@link IterableStream} of {@link CategorizedEntity}. - * - * @throws TextAnalyticsException if result has {@code isError} equals to true and when a non-error property - * was accessed. */ public CategorizedEntityCollection getEntities() { throwExceptionIfError(); diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/RecognizeLinkedEntitiesResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/RecognizeLinkedEntitiesResult.java index f8b373dd10a74..a6721ef5f0181 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/RecognizeLinkedEntitiesResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/RecognizeLinkedEntitiesResult.java @@ -31,9 +31,6 @@ public RecognizeLinkedEntitiesResult(String id, TextDocumentStatistics textDocum * Get an {@link IterableStream} of {@link LinkedEntity}. * * @return An {@link IterableStream} of {@link LinkedEntity}. - * - * @throws TextAnalyticsException if result has {@code isError} equals to true and when a non-error property - * was accessed. */ public LinkedEntityCollection getEntities() { throwExceptionIfError(); diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/RecognizePiiEntitiesResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/RecognizePiiEntitiesResult.java deleted file mode 100644 index a27d37d5b7ac4..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/RecognizePiiEntitiesResult.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.textanalytics.models; - -import com.azure.core.annotation.Immutable; -import com.azure.core.util.IterableStream; - -/** - * The {@link RecognizePiiEntitiesResult} model. - */ -@Immutable -public final class RecognizePiiEntitiesResult extends TextAnalyticsResult { - private final PiiEntityCollection entities; - - /** - * Creates a {@link RecognizePiiEntitiesResult} model that describes recognized PII entities result. - * - * @param id Unique, non-empty document identifier. - * @param textDocumentStatistics The text document statistics. - * @param error The document error. - * @param entities A {@link PiiEntityCollection} contains entities and warnings. - */ - public RecognizePiiEntitiesResult(String id, TextDocumentStatistics textDocumentStatistics, - TextAnalyticsError error, PiiEntityCollection entities) { - super(id, textDocumentStatistics, error); - this.entities = entities; - } - - /** - * Get an {@link IterableStream} of {@link PiiEntity}. - * - * @return An {@link IterableStream} of {@link PiiEntity}. - * - * @throws TextAnalyticsException if result has {@code isError} equals to true and when a non-error property - * was accessed. - */ - public PiiEntityCollection getEntities() { - throwExceptionIfError(); - return entities; - } -} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/RecognizePiiEntityOptions.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/RecognizePiiEntityOptions.java deleted file mode 100644 index 0de35c0c888cb..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/RecognizePiiEntityOptions.java +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.textanalytics.models; - -import com.azure.core.annotation.Fluent; - -/** - * The {@link RecognizePiiEntityOptions} model. - */ -@Fluent -public class RecognizePiiEntityOptions extends TextAnalyticsRequestOptions { - private PiiEntityDomainType domainFilter; - - /** - * Set the model version. This value indicates which model will be used for scoring, e.g. "latest", "2019-10-01". - * If a model-version is not specified, the API will default to the latest, non-preview version. - * - * @param modelVersion The model version. - * - * @return The {@link RecognizePiiEntityOptions} object itself. - */ - @Override - public RecognizePiiEntityOptions setModelVersion(String modelVersion) { - super.setModelVersion(modelVersion); - return this; - } - - /** - * Set the value of {@code includeStatistics}. - * - * @param includeStatistics If a boolean value was specified in the request this field will contain - * information about the document payload. - * - * @return the {@link RecognizePiiEntityOptions} object itself. - */ - @Override - public RecognizePiiEntityOptions setIncludeStatistics(boolean includeStatistics) { - super.setIncludeStatistics(includeStatistics); - return this; - } - - /** - * Get the value of domainFilter. It filters the response entities to ones only included in the specified domain. - * I.e., if set to 'PHI', will only return entities in the Protected Healthcare Information domain. - * See https://aka.ms/tanerpii for more information. - * - * @return The value of domainFilter. - */ - public PiiEntityDomainType getDomainFilter() { - return domainFilter; - } - - /** - * Set the value of domainFilter. It filters the response entities to ones only included in the specified domain. - * I.e., if set to 'PHI', will only return entities in the Protected Healthcare Information domain. - * See https://aka.ms/tanerpii for more information. - * - * @param domainFilter It filters the response entities to ones only included in the specified domain. - * - * @return The RecognizePiiEntityOptions object itself. - */ - public RecognizePiiEntityOptions setDomainFilter(PiiEntityDomainType domainFilter) { - this.domainFilter = domainFilter; - return this; - } -} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/SentenceSentiment.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/SentenceSentiment.java index 6f516b022c3c8..636739209fe96 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/SentenceSentiment.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/SentenceSentiment.java @@ -4,60 +4,35 @@ package com.azure.ai.textanalytics.models; import com.azure.core.annotation.Immutable; -import com.azure.core.util.IterableStream; /** - * The {@link SentenceSentiment} model that contains a sentiment label of a sentence, confidence scores of the - * sentiment label, mined opinions, and offset of sentence within a document. + * The {@link SentenceSentiment} model that contains a sentiment label of a sentence, confidence score of the + * sentiment label, length of the sentence and offset of the sentence within a document. */ @Immutable public final class SentenceSentiment { private final String text; - private final TextSentiment sentiment; private final SentimentConfidenceScores confidenceScores; - private final IterableStream minedOpinions; - private final int offset; + private final TextSentiment sentiment; /** * Creates a {@link SentenceSentiment} model that describes the sentiment analysis of sentence. * - * @param text The sentence text. + * @param text The sentence text * @param sentiment The sentiment label of the sentence. * @param confidenceScores The sentiment confidence score (Softmax score) between 0 and 1, for each sentiment label. - * Higher values signify higher confidence. + * Higher values signify higher confidence. */ public SentenceSentiment(String text, TextSentiment sentiment, SentimentConfidenceScores confidenceScores) { this.text = text; this.sentiment = sentiment; this.confidenceScores = confidenceScores; - this.minedOpinions = null; - this.offset = 0; - } - - /** - * Creates a {@link SentenceSentiment} model that describes the sentiment analysis of sentence. - * - * @param text The sentence text. - * @param sentiment The sentiment label of the sentence. - * @param confidenceScores The sentiment confidence score (Softmax score) between 0 and 1, for each sentiment label. - * Higher values signify higher confidence. - * @param minedOpinions The mined opinions of the sentence sentiment. This is only returned if you pass the - * opinion mining parameter to the analyze sentiment APIs. - * @param offset The start position for the sentence in a document. - */ - public SentenceSentiment(String text, TextSentiment sentiment, SentimentConfidenceScores confidenceScores, - IterableStream minedOpinions, int offset) { - this.text = text; - this.sentiment = sentiment; - this.minedOpinions = minedOpinions; - this.confidenceScores = confidenceScores; - this.offset = offset; } /** * Get the sentence text property. * - * @return The text property value. + * @return the text value. */ public String getText() { return this.text; @@ -73,31 +48,12 @@ public TextSentiment getSentiment() { } /** - * Get the confidence score of the sentiment label. All score values sum up to 1, the higher the score, the - * higher the confidence in the sentiment. + * Get the confidence score of the sentiment label. All score values sum up to 1, higher the score value means + * higher confidence the sentiment label represents. * * @return The {@link SentimentConfidenceScores}. */ public SentimentConfidenceScores getConfidenceScores() { return confidenceScores; } - - /** - * Get the mined opinions of sentence sentiment. - * This is only returned if you pass the opinion mining parameter to the analyze sentiment APIs. - * - * @return The mined opinions of sentence sentiment. - */ - public IterableStream getMinedOpinions() { - return minedOpinions; - } - - /** - * Get the offset of sentence. The start position for the sentence in a document. - * - * @return The offset of sentence. - */ - public int getOffset() { - return offset; - } } diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/TextAnalyticsErrorCode.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/TextAnalyticsErrorCode.java index 6d158379d4f2e..3fcc2276b383e 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/TextAnalyticsErrorCode.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/TextAnalyticsErrorCode.java @@ -17,69 +17,69 @@ public final class TextAnalyticsErrorCode extends ExpandableStringEnum { - private final String modelVersion; - private final TextDocumentBatchStatistics statistics; - - /** - * Create a {@link RecognizePiiEntitiesResultCollection} model that maintains a list of - * {@link RecognizePiiEntitiesResult} along with model version and batch's statistics. - * - * @param documentResults A list of {@link RecognizePiiEntitiesResult}. - * @param modelVersion The model version trained in service for the request. - * @param statistics The batch statistics of response. - */ - public RecognizePiiEntitiesResultCollection(Iterable documentResults, - String modelVersion, TextDocumentBatchStatistics statistics) { - super(documentResults); - this.modelVersion = modelVersion; - this.statistics = statistics; - } - - /** - * Get the model version trained in service for the request. - * - * @return The model version trained in service for the request. - */ - public String getModelVersion() { - return modelVersion; - } - - /** - * Get the batch statistics of response. - * - * @return The batch statistics of response. - */ - public TextDocumentBatchStatistics getStatistics() { - return statistics; - } -} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/README.md b/sdk/textanalytics/azure-ai-textanalytics/src/samples/README.md index 4f30dd0c0572d..8331b0b9f0644 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/samples/README.md +++ b/sdk/textanalytics/azure-ai-textanalytics/src/samples/README.md @@ -27,16 +27,12 @@ The following sections provide several code snippets covering some of the most c - [Detect language in a document with asynchronous client][async_sample_detect_language] - [Recognize entities in a document][sample_entities] - [Recognize entities in a document with asynchronous client][async_sample_entities] -- [Recognize Personally Identifiable Information in a document][sample_pii_entities] -- [Recognize Personally Identifiable Information in a document with asynchronous client][async_sample_pii_entities] - [Recognize linked entities in a document][sample_linked_entities] - [Recognize linked entities in a document with asynchronous client][async_sample_linked_entities] - [Extract key phrases in a document][sample_key_phrases] - [Extract key phrases in a document with asynchronous client][async_sample_key_phrases] - [Analyze sentiment in a document][sample_sentiment] - [Analyze sentiment in a document with asynchronous client][async_sample_sentiment] -- [Analyze sentiment with opinion mining in a document][sample_sentiment_opinion_mining] -- [Analyze sentiment with opinion mining in a document with asynchronous client][async_sample_sentiment_opinion_mining] - [Rotate key credential][sample_rotate_key] - [Rotate key credential with asynchronous client][async_sample_rotate_key] @@ -49,10 +45,6 @@ Batch Samples: - [Recognize entities in a batch of documents(Convenience)][sample_entities_batch_convenience] - [Recognize entities in a batch of documents with asynchronous client][async_sample_entities_batch] - [Recognize entities in a batch of documents with asynchronous client(Convenience)][async_sample_entities_batch_convenience] -- [Recognize Personally Identifiable Information in a batch of documents][sample_pii_entities_batch] -- [Recognize Personally Identifiable Information in a batch of documents(Convenience)][sample_pii_entities_batch_convenience] -- [Recognize Personally Identifiable Information in a batch of documents with asynchronous client][async_sample_pii_entities_batch] -- [Recognize Personally Identifiable Information in a batch of documents with asynchronous client(Convenience)][async_sample_pii_entities_batch_convenience] - [Recognize linked entities in a batch of documents][sample_linked_entities_batch] - [Recognize linked entities in a batch of documents(Convenience)][sample_linked_entities_batch_convenience] - [Recognize linked entities in a batch of documents with asynchronous client][async_sample_linked_entities_batch] @@ -65,6 +57,7 @@ Batch Samples: - [Analyze sentiment in a batch of documents(Convenience)][sample_sentiment_batch_convenience] - [Analyze sentiment in a batch of documents with asynchronous client][async_sample_sentiment_batch] - [Analyze sentiment in a batch of documents with asynchronous client(Convenience)][async_sample_sentiment_batch_convenience] + ## Troubleshooting Troubleshooting steps can be found [here][SDK_README_TROUBLESHOOTING]. @@ -89,9 +82,6 @@ This project welcomes contributions and suggestions. Find [more contributing][SD [async_sample_entities]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/RecognizeEntitiesAsync.java [async_sample_entities_batch]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizeEntitiesBatchDocumentsAsync.java [async_sample_entities_batch_convenience]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizeEntitiesBatchStringDocumentsAsync.java -[async_sample_pii_entities]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/RecognizePiiEntitiesAsync.java -[async_sample_pii_entities_batch]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizePiiEntitiesBatchDocumentsAsync.java -[async_sample_pii_entities_batch_convenience]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizeEntitiesBatchStringDocumentsAsync.java [async_sample_linked_entities]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/RecognizeLinkedEntitiesAsync.java [async_sample_linked_entities_batch]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizeLinkedEntitiesBatchDocumentsAsync.java [async_sample_linked_entities_batch_convenience]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizeLinkedEntitiesBatchStringDocumentsAsync.java @@ -102,7 +92,6 @@ This project welcomes contributions and suggestions. Find [more contributing][SD [async_sample_sentiment]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/AnalyzeSentimentAsync.java [async_sample_sentiment_batch]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/AnalyzeSentimentBatchDocumentsAsync.java [async_sample_sentiment_batch_convenience]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/AnalyzeSentimentBatchStringDocumentsAsync.java -[async_sample_sentiment_opinion_mining]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/AnalyzeSentimentWithOpinionMiningAsync.java [sample_detect_language]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/DetectLanguage.java [sample_detect_language_batch]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/DetectLanguageBatchDocuments.java @@ -110,9 +99,6 @@ This project welcomes contributions and suggestions. Find [more contributing][SD [sample_entities]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/RecognizeEntities.java [sample_entities_batch]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizeEntitiesBatchDocuments.java [sample_entities_batch_convenience]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizeEntitiesBatchStringDocuments.java -[sample_pii_entities]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/RecognizePiiEntities.java -[sample_pii_entities_batch]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizePiiEntitiesBatchDocuments.java -[sample_pii_entities_batch_convenience]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizePiiEntitiesBatchStringDocuments.java [sample_linked_entities]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/RecognizeLinkedEntities.java [sample_linked_entities_batch]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizeLinkedEntitiesBatchDocuments.java [sample_linked_entities_batch_convenience]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizeLinkedEntitiesBatchStringDocuments.java @@ -123,6 +109,5 @@ This project welcomes contributions and suggestions. Find [more contributing][SD [sample_sentiment]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/AnalyzeSentiment.java [sample_sentiment_batch]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/AnalyzeSentimentBatchDocuments.java [sample_sentiment_batch_convenience]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/AnalyzeSentimentBatchStringDocuments.java -[sample_sentiment_opinion_mining]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/AnalyzeSentimentWithOpinionMining.java ![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Ftextanalytics%2Fazure-ai-textanalytics%2FREADME.png) diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/AnalyzeSentimentWithOpinionMining.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/AnalyzeSentimentWithOpinionMining.java deleted file mode 100644 index 702908b70abcd..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/AnalyzeSentimentWithOpinionMining.java +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.textanalytics; - -import com.azure.ai.textanalytics.models.AnalyzeSentimentOptions; -import com.azure.ai.textanalytics.models.AspectSentiment; -import com.azure.ai.textanalytics.models.DocumentSentiment; -import com.azure.ai.textanalytics.models.OpinionSentiment; -import com.azure.ai.textanalytics.models.SentimentConfidenceScores; -import com.azure.core.credential.AzureKeyCredential; - -/** - * Sample demonstrates how to synchronously analyze the sentiment of document with opinion mining. - */ -public class AnalyzeSentimentWithOpinionMining { - /** - * Main method to invoke this demo about how to analyze the sentiment of document. - * - * @param args Unused arguments to the program. - */ - public static void main(String[] args) { - // Instantiate a client that will be used to call the service. - TextAnalyticsClient client = new TextAnalyticsClientBuilder() - .credential(new AzureKeyCredential("{key}")) - .endpoint("{endpoint}") - .buildClient(); - - // The text that needs be analyzed. - String document = "Bad atmosphere. Not close to plenty of restaurants, hotels, and transit! Staff are not friendly and helpful."; - - System.out.printf("Text = %s%n", document); - - AnalyzeSentimentOptions options = new AnalyzeSentimentOptions().setIncludeOpinionMining(true); - final DocumentSentiment documentSentiment = client.analyzeSentiment(document, "en", options); - SentimentConfidenceScores scores = documentSentiment.getConfidenceScores(); - System.out.printf( - "Recognized document sentiment: %s, positive score: %f, neutral score: %f, negative score: %f.%n", - documentSentiment.getSentiment(), scores.getPositive(), scores.getNeutral(), scores.getNegative()); - - documentSentiment.getSentences().forEach(sentenceSentiment -> { - SentimentConfidenceScores sentenceScores = sentenceSentiment.getConfidenceScores(); - System.out.printf("\tSentence sentiment: %s, positive score: %f, neutral score: %f, negative score: %f.%n", - sentenceSentiment.getSentiment(), sentenceScores.getPositive(), sentenceScores.getNeutral(), sentenceScores.getNegative()); - sentenceSentiment.getMinedOpinions().forEach(minedOpinions -> { - AspectSentiment aspectSentiment = minedOpinions.getAspect(); - System.out.printf("\t\tAspect sentiment: %s, aspect text: %s%n", aspectSentiment.getSentiment(), - aspectSentiment.getText()); - for (OpinionSentiment opinionSentiment : minedOpinions.getOpinions()) { - System.out.printf("\t\t\t'%s' opinion sentiment because of \"%s\". Is the opinion negated: %s.%n", - opinionSentiment.getSentiment(), opinionSentiment.getText(), opinionSentiment.isNegated()); - } - }); - }); - } -} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/AnalyzeSentimentWithOpinionMiningAsync.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/AnalyzeSentimentWithOpinionMiningAsync.java deleted file mode 100644 index 83e7e682aaa12..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/AnalyzeSentimentWithOpinionMiningAsync.java +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.textanalytics; - -import com.azure.ai.textanalytics.models.AnalyzeSentimentOptions; -import com.azure.ai.textanalytics.models.AspectSentiment; -import com.azure.ai.textanalytics.models.OpinionSentiment; -import com.azure.ai.textanalytics.models.SentimentConfidenceScores; -import com.azure.core.credential.AzureKeyCredential; - -import java.util.concurrent.TimeUnit; - -/** - * Sample demonstrates how to asynchronously analyze the sentiment of document with opinion mining. - */ -public class AnalyzeSentimentWithOpinionMiningAsync { - /** - * Main method to invoke this demo about how to analyze the sentiment of document. - * - * @param args Unused arguments to the program. - */ - public static void main(String[] args) { - // Instantiate a client that will be used to call the service. - TextAnalyticsAsyncClient client = new TextAnalyticsClientBuilder() - .credential(new AzureKeyCredential("{key}")) - .endpoint("{endpoint}") - .buildAsyncClient(); - - // The document that needs be analyzed. - String document = "Bad atmosphere. Not close to plenty of restaurants, hotels, and transit! Staff are not friendly and helpful."; - - AnalyzeSentimentOptions options = new AnalyzeSentimentOptions().setIncludeOpinionMining(true); - client.analyzeSentiment(document, "en", options).subscribe( - documentSentiment -> { - SentimentConfidenceScores scores = documentSentiment.getConfidenceScores(); - System.out.printf( - "Recognized document sentiment: %s, positive score: %f, neutral score: %f, negative score: %f.%n", - documentSentiment.getSentiment(), scores.getPositive(), scores.getNeutral(), scores.getNegative()); - - documentSentiment.getSentences().forEach(sentenceSentiment -> { - SentimentConfidenceScores sentenceScores = sentenceSentiment.getConfidenceScores(); - System.out.printf("\tSentence sentiment: %s, positive score: %f, neutral score: %f, negative score: %f.%n", - sentenceSentiment.getSentiment(), sentenceScores.getPositive(), sentenceScores.getNeutral(), sentenceScores.getNegative()); - - sentenceSentiment.getMinedOpinions().forEach(minedOpinions -> { - AspectSentiment aspectSentiment = minedOpinions.getAspect(); - System.out.printf("\t\tAspect sentiment: %s, aspect text: %s%n", aspectSentiment.getSentiment(), - aspectSentiment.getText()); - for (OpinionSentiment opinionSentiment : minedOpinions.getOpinions()) { - System.out.printf("\t\t\t'%s' opinion sentiment because of \"%s\". Is the opinion negated: %s.%n", - opinionSentiment.getSentiment(), opinionSentiment.getText(), opinionSentiment.isNegated()); - } - }); - }); - }, - error -> System.err.println("There was an error analyzing sentiment of the text." + error), - () -> System.out.println("Sentiment analyzed.")); - - // The .subscribe() creation and assignment is not a blocking call. For the purpose of this example, we sleep - // the thread so the program does not end before the send operation is complete. Using .block() instead of - // .subscribe() will turn this into a synchronous call. - try { - TimeUnit.SECONDS.sleep(5); - } catch (InterruptedException ignored) { - } - } -} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/ReadmeSamples.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/ReadmeSamples.java index ec4818124ca9b..ef79896a7b636 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/ReadmeSamples.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/ReadmeSamples.java @@ -6,7 +6,6 @@ import com.azure.ai.textanalytics.models.DetectLanguageInput; import com.azure.ai.textanalytics.models.DetectedLanguage; import com.azure.ai.textanalytics.models.DocumentSentiment; -import com.azure.ai.textanalytics.models.PiiEntityCollection; import com.azure.core.credential.AzureKeyCredential; import com.azure.core.credential.TokenCredential; import com.azure.core.exception.HttpResponseException; @@ -151,17 +150,4 @@ public void extractKeyPhrases() { System.out.println("Extracted phrases:"); textAnalyticsClient.extractKeyPhrases(document).forEach(keyPhrase -> System.out.printf("%s.%n", keyPhrase)); } - - /** - * Code snippet for recognizing Personally Identifiable Information entity in a document. - */ - public void recognizePiiEntity() { - String document = "My SSN is 859-98-0987"; - PiiEntityCollection piiEntityCollection = textAnalyticsClient.recognizePiiEntities(document); - System.out.printf("Redacted Text: %s%n", piiEntityCollection.getRedactedText()); - piiEntityCollection.forEach(entity -> System.out.printf( - "Recognized Personally Identifiable Information entity: %s, entity category: %s, entity subcategory: %s," - + " confidence score: %f.%n", - entity.getText(), entity.getCategory(), entity.getSubcategory(), entity.getConfidenceScore())); - } } diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/RecognizeLinkedEntities.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/RecognizeLinkedEntities.java index 0bded73e5eff6..382b0bf44fd67 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/RecognizeLinkedEntities.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/RecognizeLinkedEntities.java @@ -26,10 +26,9 @@ public static void main(String[] args) { client.recognizeLinkedEntities(document).forEach(linkedEntity -> { System.out.println("Linked Entities:"); - System.out.printf("Name: %s, entity ID in data source: %s, URL: %s, data source: %s," - + " Bing Entity Search API ID: %s.%n", + System.out.printf("Name: %s, entity ID in data source: %s, URL: %s, data source: %s.%n", linkedEntity.getName(), linkedEntity.getDataSourceEntityId(), linkedEntity.getUrl(), - linkedEntity.getDataSource(), linkedEntity.getBingEntitySearchApiId()); + linkedEntity.getDataSource()); linkedEntity.getMatches().forEach(entityMatch -> System.out.printf( "Matched entity: %s, confidence score: %f.%n", entityMatch.getText(), entityMatch.getConfidenceScore())); diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/RecognizeLinkedEntitiesAsync.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/RecognizeLinkedEntitiesAsync.java index 6142ebaa41615..4365a11684c4e 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/RecognizeLinkedEntitiesAsync.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/RecognizeLinkedEntitiesAsync.java @@ -29,10 +29,9 @@ public static void main(String[] args) { client.recognizeLinkedEntities(document).subscribe( linkedEntityCollection -> linkedEntityCollection.forEach(linkedEntity -> { System.out.println("Linked Entities:"); - System.out.printf("Name: %s, entity ID in data source: %s, URL: %s, data source: %s, " - + "Bing Entity Search API ID: %s.%n", + System.out.printf("Name: %s, entity ID in data source: %s, URL: %s, data source: %s.%n", linkedEntity.getName(), linkedEntity.getDataSourceEntityId(), linkedEntity.getUrl(), - linkedEntity.getDataSource(), linkedEntity.getBingEntitySearchApiId()); + linkedEntity.getDataSource()); linkedEntity.getMatches().forEach(entityMatch -> System.out.printf( "Matched entity: %s, confidence score: %f.%n", entityMatch.getText(), entityMatch.getConfidenceScore())); diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/RecognizePiiEntities.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/RecognizePiiEntities.java deleted file mode 100644 index 8c6a48cdc3a13..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/RecognizePiiEntities.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.textanalytics; - - -import com.azure.ai.textanalytics.models.PiiEntityCollection; -import com.azure.core.credential.AzureKeyCredential; - -/** - * Sample demonstrates how to recognize the Personally Identifiable Information entities of document. - */ -public class RecognizePiiEntities { - /** - * Main method to invoke this demo about how to recognize the Personally Identifiable Information entities of - * document. - * - * @param args Unused arguments to the program. - */ - public static void main(String[] args) { - // Instantiate a client that will be used to call the service. - TextAnalyticsClient client = new TextAnalyticsClientBuilder() - .credential(new AzureKeyCredential("{key}")) - .endpoint("{endpoint}") - .buildClient(); - - // The document that needs be analyzed. - String document = "My SSN is 859-98-0987"; - - PiiEntityCollection piiEntityCollection = client.recognizePiiEntities(document); - System.out.printf("Redacted Text: %s%n", piiEntityCollection.getRedactedText()); - piiEntityCollection.forEach(entity -> System.out.printf( - "Recognized Personal Identifiable Information entity: %s, entity category: %s, entity sub-category: %s, score: %f.%n", - entity.getText(), entity.getCategory(), entity.getSubcategory(), entity.getConfidenceScore())); - } -} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/RecognizePiiEntitiesAsync.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/RecognizePiiEntitiesAsync.java deleted file mode 100644 index ac3a9ce7bbb7e..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/RecognizePiiEntitiesAsync.java +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.textanalytics; - -import com.azure.core.credential.AzureKeyCredential; - -import java.util.concurrent.TimeUnit; - -/** - * Sample demonstrates how to recognize the Personally Identifiable Information entities of document. - */ -public class RecognizePiiEntitiesAsync { - /** - * Main method to invoke this demo about how to recognize the Personally Identifiable Information entities of document. - * - * @param args Unused arguments to the program. - */ - public static void main(String[] args) { - // Instantiate a client that will be used to call the service. - TextAnalyticsAsyncClient client = new TextAnalyticsClientBuilder() - .credential(new AzureKeyCredential("{key}")) - .endpoint("{endpoint}") - .buildAsyncClient(); - - // The document that needs be analyzed. - String document = "My SSN is 859-98-0987"; - - client.recognizePiiEntities(document).subscribe( - entityCollection -> { - System.out.printf("Redacted Text: %s%n", entityCollection.getRedactedText()); - entityCollection.forEach(entity -> System.out.printf( - "Recognized Personal Identifiable Information entity: %s, entity category: %s, entity sub-category: %s, score: %f.%n", - entity.getText(), entity.getCategory(), entity.getSubcategory(), entity.getConfidenceScore())); - }, - error -> System.err.println("There was an error recognizing PII entities of the text." + error), - () -> System.out.println("Entities recognized.") - ); - - // The .subscribe() creation and assignment is not a blocking call. For the purpose of this example, we sleep - // the thread so the program does not end before the send operation is complete. Using .block() instead of - // .subscribe() will turn this into a synchronous call. - try { - TimeUnit.SECONDS.sleep(5); - } catch (InterruptedException ignored) { - } - } -} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/TextAnalyticsAsyncClientJavaDocCodeSnippets.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/TextAnalyticsAsyncClientJavaDocCodeSnippets.java index 5dc10185aaa58..fcb6645a8b327 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/TextAnalyticsAsyncClientJavaDocCodeSnippets.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/TextAnalyticsAsyncClientJavaDocCodeSnippets.java @@ -3,27 +3,20 @@ package com.azure.ai.textanalytics; -import com.azure.ai.textanalytics.models.AnalyzeSentimentOptions; -import com.azure.ai.textanalytics.models.AspectSentiment; +import com.azure.ai.textanalytics.util.AnalyzeSentimentResultCollection; import com.azure.ai.textanalytics.models.DetectLanguageInput; import com.azure.ai.textanalytics.models.DetectLanguageResult; +import com.azure.ai.textanalytics.util.DetectLanguageResultCollection; import com.azure.ai.textanalytics.models.DetectedLanguage; import com.azure.ai.textanalytics.models.DocumentSentiment; import com.azure.ai.textanalytics.models.ExtractKeyPhraseResult; -import com.azure.ai.textanalytics.models.OpinionSentiment; -import com.azure.ai.textanalytics.models.PiiEntityCollection; -import com.azure.ai.textanalytics.models.PiiEntityDomainType; -import com.azure.ai.textanalytics.models.RecognizePiiEntityOptions; +import com.azure.ai.textanalytics.util.ExtractKeyPhrasesResultCollection; +import com.azure.ai.textanalytics.util.RecognizeEntitiesResultCollection; +import com.azure.ai.textanalytics.util.RecognizeLinkedEntitiesResultCollection; import com.azure.ai.textanalytics.models.SentenceSentiment; import com.azure.ai.textanalytics.models.TextAnalyticsRequestOptions; import com.azure.ai.textanalytics.models.TextDocumentBatchStatistics; import com.azure.ai.textanalytics.models.TextDocumentInput; -import com.azure.ai.textanalytics.util.AnalyzeSentimentResultCollection; -import com.azure.ai.textanalytics.util.DetectLanguageResultCollection; -import com.azure.ai.textanalytics.util.ExtractKeyPhrasesResultCollection; -import com.azure.ai.textanalytics.util.RecognizeEntitiesResultCollection; -import com.azure.ai.textanalytics.util.RecognizeLinkedEntitiesResultCollection; -import com.azure.ai.textanalytics.util.RecognizePiiEntitiesResultCollection; import com.azure.core.credential.AzureKeyCredential; import java.util.Arrays; @@ -241,127 +234,6 @@ public void recognizeBatchEntitiesMaxOverload() { // END: com.azure.ai.textanalytics.TextAnalyticsAsyncClient.recognizeCategorizedEntitiesBatch#Iterable-TextAnalyticsRequestOptions } - // Personally Identifiable Information Entity - - /** - * Code snippet for {@link TextAnalyticsAsyncClient#recognizePiiEntities(String)} - */ - public void recognizePiiEntities() { - // BEGIN: com.azure.ai.textanalytics.TextAnalyticsAsyncClient.recognizePiiEntities#string - String document = "My SSN is 859-98-0987"; - textAnalyticsAsyncClient.recognizePiiEntities(document).subscribe(piiEntityCollection -> { - System.out.printf("Redacted Text: %s%n", piiEntityCollection.getRedactedText()); - piiEntityCollection.forEach(entity -> System.out.printf( - "Recognized Personally Identifiable Information entity: %s, entity category: %s," - + " entity subcategory: %s, confidence score: %f.%n", - entity.getText(), entity.getCategory(), entity.getSubcategory(), entity.getConfidenceScore())); - }); - // END: com.azure.ai.textanalytics.TextAnalyticsAsyncClient.recognizePiiEntities#string - } - - /** - * Code snippet for {@link TextAnalyticsAsyncClient#recognizePiiEntities(String, String)} - */ - public void recognizePiiEntitiesWithLanguage() { - // BEGIN: com.azure.ai.textanalytics.TextAnalyticsAsyncClient.recognizePiiEntities#string-string - String document = "My SSN is 859-98-0987"; - textAnalyticsAsyncClient.recognizePiiEntities(document, "en") - .subscribe(piiEntityCollection -> { - System.out.printf("Redacted Text: %s%n", piiEntityCollection.getRedactedText()); - piiEntityCollection.forEach(entity -> System.out.printf( - "Recognized Personally Identifiable Information entity: %s, entity category: %s," - + " entity subcategory: %s, confidence score: %f.%n", - entity.getText(), entity.getCategory(), entity.getSubcategory(), entity.getConfidenceScore())); - }); - // END: com.azure.ai.textanalytics.TextAnalyticsAsyncClient.recognizePiiEntities#string-string - } - - /** - * Code snippet for {@link TextAnalyticsAsyncClient#recognizePiiEntities(String, String, RecognizePiiEntityOptions)} - */ - public void recognizePiiEntitiesWithRecognizePiiEntityOptions() { - // BEGIN: com.azure.ai.textanalytics.TextAnalyticsAsyncClient.recognizePiiEntities#string-string-RecognizePiiEntityOptions - String document = "My SSN is 859-98-0987"; - textAnalyticsAsyncClient.recognizePiiEntities(document, "en", - new RecognizePiiEntityOptions().setDomainFilter(PiiEntityDomainType.PROTECTED_HEALTH_INFORMATION)) - .subscribe(piiEntityCollection -> { - System.out.printf("Redacted Text: %s%n", piiEntityCollection.getRedactedText()); - piiEntityCollection.forEach(entity -> System.out.printf( - "Recognized Personally Identifiable Information entity: %s, entity category: %s," - + " entity subcategory: %s, confidence score: %f.%n", - entity.getText(), entity.getCategory(), entity.getSubcategory(), entity.getConfidenceScore())); - }); - // END: com.azure.ai.textanalytics.TextAnalyticsAsyncClient.recognizePiiEntities#string-string-RecognizePiiEntityOptions - } - - /** - * Code snippet for {@link TextAnalyticsAsyncClient#recognizePiiEntitiesBatch(Iterable, String, RecognizePiiEntityOptions)} - */ - public void recognizePiiEntitiesStringListWithOptions() { - // BEGIN: com.azure.ai.textanalytics.TextAnalyticsAsyncClient.recognizePiiEntitiesBatch#Iterable-String-RecognizePiiEntityOptions - List documents = Arrays.asList( - "My SSN is 859-98-0987.", - "Visa card 0111 1111 1111 1111." - ); - - // Show statistics and model version - RecognizePiiEntityOptions requestOptions = new RecognizePiiEntityOptions().setIncludeStatistics(true) - .setModelVersion("latest"); - - textAnalyticsAsyncClient.recognizePiiEntitiesBatch(documents, "en", requestOptions) - .subscribe(piiEntitiesResults -> { - // Batch statistics - TextDocumentBatchStatistics batchStatistics = piiEntitiesResults.getStatistics(); - System.out.printf("Batch statistics, transaction count: %s, valid document count: %s.%n", - batchStatistics.getTransactionCount(), batchStatistics.getValidDocumentCount()); - - piiEntitiesResults.forEach(recognizePiiEntitiesResult -> { - PiiEntityCollection piiEntityCollection = recognizePiiEntitiesResult.getEntities(); - System.out.printf("Redacted Text: %s%n", piiEntityCollection.getRedactedText()); - piiEntityCollection.forEach(entity -> System.out.printf( - "Recognized Personally Identifiable Information entity: %s, entity category: %s," - + " entity subcategory: %s, confidence score: %f.%n", - entity.getText(), entity.getCategory(), entity.getSubcategory(), entity.getConfidenceScore())); - }); - }); - // END: com.azure.ai.textanalytics.TextAnalyticsAsyncClient.recognizePiiEntitiesBatch#Iterable-String-RecognizePiiEntityOptions - } - - /** - * Code snippet for {@link TextAnalyticsAsyncClient#recognizePiiEntitiesBatchWithResponse(Iterable, - * RecognizePiiEntityOptions)} - */ - public void recognizeBatchPiiEntitiesMaxOverload() { - // BEGIN: com.azure.ai.textanalytics.TextAnalyticsAsyncClient.recognizePiiEntitiesBatch#Iterable-RecognizePiiEntityOptions - List textDocumentInputs1 = Arrays.asList( - new TextDocumentInput("0", "My SSN is 859-98-0987."), - new TextDocumentInput("1", "Visa card 0111 1111 1111 1111.")); - - // Show statistics and model version - RecognizePiiEntityOptions requestOptions = new RecognizePiiEntityOptions().setIncludeStatistics(true) - .setModelVersion("latest"); - - textAnalyticsAsyncClient.recognizePiiEntitiesBatchWithResponse(textDocumentInputs1, requestOptions) - .subscribe(response -> { - RecognizePiiEntitiesResultCollection piiEntitiesResults = response.getValue(); - // Batch statistics - TextDocumentBatchStatistics batchStatistics = piiEntitiesResults.getStatistics(); - System.out.printf("Batch statistics, transaction count: %s, valid document count: %s.%n", - batchStatistics.getTransactionCount(), batchStatistics.getValidDocumentCount()); - - piiEntitiesResults.forEach(recognizePiiEntitiesResult -> { - PiiEntityCollection piiEntityCollection = recognizePiiEntitiesResult.getEntities(); - System.out.printf("Redacted Text: %s%n", piiEntityCollection.getRedactedText()); - piiEntityCollection.forEach(entity -> System.out.printf( - "Recognized Personally Identifiable Information entity: %s, entity category: %s," - + " entity subcategory: %s, confidence score: %f.%n", - entity.getText(), entity.getCategory(), entity.getSubcategory(), entity.getConfidenceScore())); - }); - }); - // END: com.azure.ai.textanalytics.TextAnalyticsAsyncClient.recognizePiiEntitiesBatch#Iterable-RecognizePiiEntityOptions - } - - // Linked Entity /** @@ -582,11 +454,12 @@ public void analyzeSentiment() { * Code snippet for {@link TextAnalyticsAsyncClient#analyzeSentiment(String, String)} */ public void analyzeSentimentWithLanguage() { - // BEGIN: com.azure.ai.textanalytics.TextAnalyticsAsyncClient.analyzeSentiment#String-String + // BEGIN: com.azure.ai.textanalytics.TextAnalyticsAsyncClient.analyzeSentiment#string-string String document = "The hotel was dark and unclean."; textAnalyticsAsyncClient.analyzeSentiment(document, "en") .subscribe(documentSentiment -> { System.out.printf("Recognized sentiment label: %s.%n", documentSentiment.getSentiment()); + for (SentenceSentiment sentenceSentiment : documentSentiment.getSentences()) { System.out.printf("Recognized sentence sentiment: %s, positive score: %.2f, neutral score: %.2f, " + "negative score: %.2f.%n", @@ -596,32 +469,7 @@ public void analyzeSentimentWithLanguage() { sentenceSentiment.getConfidenceScores().getNegative()); } }); - // END: com.azure.ai.textanalytics.TextAnalyticsAsyncClient.analyzeSentiment#String-String - } - - /** - * Code snippet for {@link TextAnalyticsAsyncClient#analyzeSentiment(String, String, AnalyzeSentimentOptions)} - */ - public void analyzeSentimentWithLanguageWithOpinionMining() { - // BEGIN: com.azure.ai.textanalytics.TextAnalyticsAsyncClient.analyzeSentiment#String-String-AnalyzeSentimentOptions - textAnalyticsAsyncClient.analyzeSentiment("The hotel was dark and unclean.", "en", - new AnalyzeSentimentOptions().setIncludeOpinionMining(true)) - .subscribe(documentSentiment -> { - for (SentenceSentiment sentenceSentiment : documentSentiment.getSentences()) { - System.out.printf("\tSentence sentiment: %s%n", sentenceSentiment.getSentiment()); - sentenceSentiment.getMinedOpinions().forEach(minedOpinions -> { - AspectSentiment aspectSentiment = minedOpinions.getAspect(); - System.out.printf("\tAspect sentiment: %s, aspect text: %s%n", - aspectSentiment.getSentiment(), aspectSentiment.getText()); - for (OpinionSentiment opinionSentiment : minedOpinions.getOpinions()) { - System.out.printf("\t\t'%s' sentiment because of \"%s\". Is the opinion negated: %s.%n", - opinionSentiment.getSentiment(), opinionSentiment.getText(), - opinionSentiment.isNegated()); - } - }); - } - }); - // END: com.azure.ai.textanalytics.TextAnalyticsAsyncClient.analyzeSentiment#String-String-AnalyzeSentimentOptions + // END: com.azure.ai.textanalytics.TextAnalyticsAsyncClient.analyzeSentiment#string-string } /** @@ -634,43 +482,7 @@ public void analyzeSentimentStringListWithOptions() { "The restaurant had amazing gnocchi." ); - textAnalyticsAsyncClient.analyzeSentimentBatch(documents, "en", - new TextAnalyticsRequestOptions().setIncludeStatistics(true)).subscribe( - response -> { - // Batch statistics - TextDocumentBatchStatistics batchStatistics = response.getStatistics(); - System.out.printf("Batch statistics, transaction count: %s, valid document count: %s.%n", - batchStatistics.getTransactionCount(), batchStatistics.getValidDocumentCount()); - - response.forEach(analyzeSentimentResult -> { - System.out.printf("Document ID: %s%n", analyzeSentimentResult.getId()); - DocumentSentiment documentSentiment = analyzeSentimentResult.getDocumentSentiment(); - System.out.printf("Recognized document sentiment: %s.%n", documentSentiment.getSentiment()); - documentSentiment.getSentences().forEach(sentenceSentiment -> - System.out.printf("Recognized sentence sentiment: %s, positive score: %.2f, " - + "neutral score: %.2f, negative score: %.2f.%n", - sentenceSentiment.getSentiment(), - sentenceSentiment.getConfidenceScores().getPositive(), - sentenceSentiment.getConfidenceScores().getNeutral(), - sentenceSentiment.getConfidenceScores().getNegative())); - }); - }); - // END: com.azure.ai.textanalytics.TextAnalyticsAsyncClient.analyzeSentimentBatch#Iterable-String-TextAnalyticsRequestOptions - } - - /** - * Code snippet for {@link TextAnalyticsAsyncClient#analyzeSentimentBatch(Iterable, String, AnalyzeSentimentOptions)} - */ - public void analyzeSentimentStringListWithOptionsAndOpinionMining() { - // BEGIN: com.azure.ai.textanalytics.TextAnalyticsAsyncClient.analyzeSentimentBatch#Iterable-String-AnalyzeSentimentOptions - List documents = Arrays.asList( - "The hotel was dark and unclean.", - "The restaurant had amazing gnocchi." - ); - - AnalyzeSentimentOptions options = new AnalyzeSentimentOptions().setIncludeOpinionMining(true); - - textAnalyticsAsyncClient.analyzeSentimentBatch(documents, "en", options).subscribe( + textAnalyticsAsyncClient.analyzeSentimentBatch(documents, "en", null).subscribe( response -> { // Batch statistics TextDocumentBatchStatistics batchStatistics = response.getStatistics(); @@ -680,23 +492,17 @@ public void analyzeSentimentStringListWithOptionsAndOpinionMining() { response.forEach(analyzeSentimentResult -> { System.out.printf("Document ID: %s%n", analyzeSentimentResult.getId()); DocumentSentiment documentSentiment = analyzeSentimentResult.getDocumentSentiment(); - documentSentiment.getSentences().forEach(sentenceSentiment -> { - System.out.printf("\tSentence sentiment: %s%n", sentenceSentiment.getSentiment()); - sentenceSentiment.getMinedOpinions().forEach(minedOpinions -> { - AspectSentiment aspectSentiment = minedOpinions.getAspect(); - System.out.printf("\t\tAspect sentiment: %s, aspect text: %s%n", - aspectSentiment.getSentiment(), aspectSentiment.getText()); - for (OpinionSentiment opinionSentiment : minedOpinions.getOpinions()) { - System.out.printf( - "\t\t\t'%s' opinion sentiment because of \"%s\". Is the opinion negated: %s.%n", - opinionSentiment.getSentiment(), opinionSentiment.getText(), - opinionSentiment.isNegated()); - } - }); - }); + System.out.printf("Recognized document sentiment: %s.%n", documentSentiment.getSentiment()); + documentSentiment.getSentences().forEach(sentenceSentiment -> + System.out.printf("Recognized sentence sentiment: %s, positive score: %.2f, " + + "neutral score: %.2f, negative score: %.2f.%n", + sentenceSentiment.getSentiment(), + sentenceSentiment.getConfidenceScores().getPositive(), + sentenceSentiment.getConfidenceScores().getNeutral(), + sentenceSentiment.getConfidenceScores().getNegative())); }); }); - // END: com.azure.ai.textanalytics.TextAnalyticsAsyncClient.analyzeSentimentBatch#Iterable-String-AnalyzeSentimentOptions + // END: com.azure.ai.textanalytics.TextAnalyticsAsyncClient.analyzeSentimentBatch#Iterable-String-TextAnalyticsRequestOptions } /** @@ -738,50 +544,4 @@ public void analyzeBatchSentimentMaxOverload() { }); // END: com.azure.ai.textanalytics.TextAnalyticsAsyncClient.analyzeSentimentBatch#Iterable-TextAnalyticsRequestOptions } - - /** - * Code snippet for {@link TextAnalyticsAsyncClient#analyzeSentimentBatchWithResponse(Iterable, AnalyzeSentimentOptions)} - */ - public void analyzeBatchSentimentMaxOverloadWithOpinionMining() { - // BEGIN: com.azure.ai.textanalytics.TextAnalyticsAsyncClient.analyzeSentimentBatch#Iterable-AnalyzeSentimentOptions - List textDocumentInputs1 = Arrays.asList( - new TextDocumentInput("0", "The hotel was dark and unclean.").setLanguage("en"), - new TextDocumentInput("1", "The restaurant had amazing gnocchi.").setLanguage("en")); - - // Request options: show statistics and model version - AnalyzeSentimentOptions options = new AnalyzeSentimentOptions() - .setIncludeOpinionMining(true).setIncludeStatistics(true); - textAnalyticsAsyncClient.analyzeSentimentBatchWithResponse(textDocumentInputs1, options) - .subscribe(response -> { - // Response's status code - System.out.printf("Status code of request response: %d%n", response.getStatusCode()); - AnalyzeSentimentResultCollection resultCollection = response.getValue(); - - // Batch statistics - TextDocumentBatchStatistics batchStatistics = resultCollection.getStatistics(); - System.out.printf("Batch statistics, transaction count: %s, valid document count: %s.%n", - batchStatistics.getTransactionCount(), - batchStatistics.getValidDocumentCount()); - - resultCollection.forEach(analyzeSentimentResult -> { - System.out.printf("Document ID: %s%n", analyzeSentimentResult.getId()); - DocumentSentiment documentSentiment = analyzeSentimentResult.getDocumentSentiment(); - documentSentiment.getSentences().forEach(sentenceSentiment -> { - System.out.printf("\tSentence sentiment: %s%n", sentenceSentiment.getSentiment()); - sentenceSentiment.getMinedOpinions().forEach(minedOpinions -> { - AspectSentiment aspectSentiment = minedOpinions.getAspect(); - System.out.printf("\t\tAspect sentiment: %s, aspect text: %s%n", - aspectSentiment.getSentiment(), aspectSentiment.getText()); - for (OpinionSentiment opinionSentiment : minedOpinions.getOpinions()) { - System.out.printf( - "\t\t\t'%s' opinion sentiment because of \"%s\". Is the opinion negated: %s.%n", - opinionSentiment.getSentiment(), opinionSentiment.getText(), - opinionSentiment.isNegated()); - } - }); - }); - }); - }); - // END: com.azure.ai.textanalytics.TextAnalyticsAsyncClient.analyzeSentimentBatch#Iterable-AnalyzeSentimentOptions - } } diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/TextAnalyticsClientJavaDocCodeSnippets.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/TextAnalyticsClientJavaDocCodeSnippets.java index b9e562f69a794..49aa84d7c9400 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/TextAnalyticsClientJavaDocCodeSnippets.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/TextAnalyticsClientJavaDocCodeSnippets.java @@ -3,28 +3,20 @@ package com.azure.ai.textanalytics; -import com.azure.ai.textanalytics.models.AnalyzeSentimentOptions; -import com.azure.ai.textanalytics.models.AspectSentiment; +import com.azure.ai.textanalytics.util.AnalyzeSentimentResultCollection; import com.azure.ai.textanalytics.models.CategorizedEntity; import com.azure.ai.textanalytics.models.CategorizedEntityCollection; import com.azure.ai.textanalytics.models.DetectLanguageInput; +import com.azure.ai.textanalytics.util.DetectLanguageResultCollection; import com.azure.ai.textanalytics.models.DetectedLanguage; import com.azure.ai.textanalytics.models.DocumentSentiment; -import com.azure.ai.textanalytics.models.OpinionSentiment; -import com.azure.ai.textanalytics.models.PiiEntity; -import com.azure.ai.textanalytics.models.PiiEntityCollection; -import com.azure.ai.textanalytics.models.PiiEntityDomainType; -import com.azure.ai.textanalytics.models.RecognizePiiEntityOptions; +import com.azure.ai.textanalytics.util.ExtractKeyPhrasesResultCollection; +import com.azure.ai.textanalytics.util.RecognizeEntitiesResultCollection; +import com.azure.ai.textanalytics.util.RecognizeLinkedEntitiesResultCollection; import com.azure.ai.textanalytics.models.SentenceSentiment; import com.azure.ai.textanalytics.models.TextAnalyticsRequestOptions; import com.azure.ai.textanalytics.models.TextDocumentBatchStatistics; import com.azure.ai.textanalytics.models.TextDocumentInput; -import com.azure.ai.textanalytics.util.AnalyzeSentimentResultCollection; -import com.azure.ai.textanalytics.util.DetectLanguageResultCollection; -import com.azure.ai.textanalytics.util.ExtractKeyPhrasesResultCollection; -import com.azure.ai.textanalytics.util.RecognizeEntitiesResultCollection; -import com.azure.ai.textanalytics.util.RecognizeLinkedEntitiesResultCollection; -import com.azure.ai.textanalytics.util.RecognizePiiEntitiesResultCollection; import com.azure.core.credential.AzureKeyCredential; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpPipelineBuilder; @@ -247,116 +239,6 @@ public void recognizeBatchEntitiesMaxOverload() { // END: com.azure.ai.textanalytics.TextAnalyticsClient.recognizeEntitiesBatch#Iterable-TextAnalyticsRequestOptions-Context } - // Personally Identifiable Information Entity - - /** - * Code snippet for {@link TextAnalyticsClient#recognizePiiEntities(String)} - */ - public void recognizePiiEntities() { - // BEGIN: com.azure.ai.textanalytics.TextAnalyticsClient.recognizePiiEntities#String - PiiEntityCollection piiEntityCollection = textAnalyticsClient.recognizePiiEntities("My SSN is 859-98-0987"); - System.out.printf("Redacted Text: %s%n", piiEntityCollection.getRedactedText()); - for (PiiEntity entity : piiEntityCollection) { - System.out.printf( - "Recognized Personally Identifiable Information entity: %s, entity category: %s," - + " entity subcategory: %s, confidence score: %f.%n", - entity.getText(), entity.getCategory(), entity.getSubcategory(), entity.getConfidenceScore()); - } - // END: com.azure.ai.textanalytics.TextAnalyticsClient.recognizePiiEntities#String - } - - /** - * Code snippet for {@link TextAnalyticsClient#recognizePiiEntities(String, String)} - */ - public void recognizePiiEntitiesWithLanguage() { - // BEGIN: com.azure.ai.textanalytics.TextAnalyticsClient.recognizePiiEntities#String-String - PiiEntityCollection piiEntityCollection = textAnalyticsClient.recognizePiiEntities( - "My SSN is 859-98-0987", "en"); - System.out.printf("Redacted Text: %s%n", piiEntityCollection.getRedactedText()); - piiEntityCollection.forEach(entity -> System.out.printf( - "Recognized Personally Identifiable Information entity: %s, entity category: %s," - + " entity subcategory: %s, confidence score: %f.%n", - entity.getText(), entity.getCategory(), entity.getSubcategory(), entity.getConfidenceScore())); - // END: com.azure.ai.textanalytics.TextAnalyticsClient.recognizePiiEntities#String-String - } - - /** - * Code snippet for {@link TextAnalyticsClient#recognizePiiEntities(String, String, RecognizePiiEntityOptions)} - */ - public void recognizePiiEntitiesWithRecognizePiiEntityOptions() { - // BEGIN: com.azure.ai.textanalytics.TextAnalyticsClient.recognizePiiEntities#String-String-RecognizePiiEntityOptions - PiiEntityCollection piiEntityCollection = textAnalyticsClient.recognizePiiEntities( - "My SSN is 859-98-0987", "en", - new RecognizePiiEntityOptions().setDomainFilter(PiiEntityDomainType.PROTECTED_HEALTH_INFORMATION)); - System.out.printf("Redacted Text: %s%n", piiEntityCollection.getRedactedText()); - piiEntityCollection.forEach(entity -> System.out.printf( - "Recognized Personally Identifiable Information entity: %s, entity category: %s," - + " entity subcategory: %s, confidence score: %f.%n", - entity.getText(), entity.getCategory(), entity.getSubcategory(), entity.getConfidenceScore())); - // END: com.azure.ai.textanalytics.TextAnalyticsClient.recognizePiiEntities#String-String-RecognizePiiEntityOptions - } - - /** - * Code snippet for {@link TextAnalyticsClient#recognizePiiEntitiesBatch(Iterable, String, RecognizePiiEntityOptions)} - */ - public void recognizePiiEntitiesStringListWithOptions() { - // BEGIN: com.azure.ai.textanalytics.TextAnalyticsClient.recognizePiiEntitiesBatch#Iterable-String-RecognizePiiEntityOptions - List documents = Arrays.asList( - "My SSN is 859-98-0987", - "Visa card 4111 1111 1111 1111" - ); - - RecognizePiiEntitiesResultCollection resultCollection = textAnalyticsClient.recognizePiiEntitiesBatch( - documents, "en", new RecognizePiiEntityOptions().setIncludeStatistics(true)); - - // Batch statistics - TextDocumentBatchStatistics batchStatistics = resultCollection.getStatistics(); - System.out.printf("A batch of documents statistics, transaction count: %s, valid document count: %s.%n", - batchStatistics.getTransactionCount(), batchStatistics.getValidDocumentCount()); - - resultCollection.forEach(recognizePiiEntitiesResult -> { - PiiEntityCollection piiEntityCollection = recognizePiiEntitiesResult.getEntities(); - System.out.printf("Redacted Text: %s%n", piiEntityCollection.getRedactedText()); - piiEntityCollection.forEach(entity -> System.out.printf( - "Recognized Personally Identifiable Information entity: %s, entity category: %s," - + " entity subcategory: %s, confidence score: %f.%n", - entity.getText(), entity.getCategory(), entity.getSubcategory(), entity.getConfidenceScore())); - }); - // END: com.azure.ai.textanalytics.TextAnalyticsClient.recognizePiiEntitiesBatch#Iterable-String-RecognizePiiEntityOptions - } - - /** - * Code snippet for {@link TextAnalyticsClient#recognizePiiEntitiesBatchWithResponse(Iterable, RecognizePiiEntityOptions, Context)} - */ - public void recognizeBatchPiiEntitiesMaxOverload() { - // BEGIN: com.azure.ai.textanalytics.TextAnalyticsClient.recognizePiiEntitiesBatch#Iterable-RecognizePiiEntityOptions-Context - List textDocumentInputs = Arrays.asList( - new TextDocumentInput("0", "My SSN is 859-98-0987"), - new TextDocumentInput("1", "Visa card 4111 1111 1111 1111") - ); - - Response response = - textAnalyticsClient.recognizePiiEntitiesBatchWithResponse(textDocumentInputs, - new RecognizePiiEntityOptions().setIncludeStatistics(true), Context.NONE); - - RecognizePiiEntitiesResultCollection resultCollection = response.getValue(); - - // Batch statistics - TextDocumentBatchStatistics batchStatistics = resultCollection.getStatistics(); - System.out.printf("A batch of documents statistics, transaction count: %s, valid document count: %s.%n", - batchStatistics.getTransactionCount(), batchStatistics.getValidDocumentCount()); - - resultCollection.forEach(recognizePiiEntitiesResult -> { - PiiEntityCollection piiEntityCollection = recognizePiiEntitiesResult.getEntities(); - System.out.printf("Redacted Text: %s%n", piiEntityCollection.getRedactedText()); - piiEntityCollection.forEach(entity -> System.out.printf( - "Recognized Personally Identifiable Information entity: %s, entity category: %s," - + " entity subcategory: %s, confidence score: %f.%n", - entity.getText(), entity.getCategory(), entity.getSubcategory(), entity.getConfidenceScore())); - }); - // END: com.azure.ai.textanalytics.TextAnalyticsClient.recognizePiiEntitiesBatch#Iterable-RecognizePiiEntityOptions-Context - } - // Linked Entity /** @@ -608,29 +490,6 @@ public void analyzeSentimentWithLanguage() { // END: com.azure.ai.textanalytics.TextAnalyticsClient.analyzeSentiment#String-String } - /** - * Code snippet for {@link TextAnalyticsClient#analyzeSentiment(String, String, AnalyzeSentimentOptions)} - */ - public void analyzeSentimentWithLanguageWithOpinionMining() { - // BEGIN: com.azure.ai.textanalytics.TextAnalyticsClient.analyzeSentiment#String-String-AnalyzeSentimentOptions - final DocumentSentiment documentSentiment = textAnalyticsClient.analyzeSentiment( - "The hotel was dark and unclean.", "en", - new AnalyzeSentimentOptions().setIncludeOpinionMining(true)); - for (SentenceSentiment sentenceSentiment : documentSentiment.getSentences()) { - System.out.printf("\tSentence sentiment: %s%n", sentenceSentiment.getSentiment()); - sentenceSentiment.getMinedOpinions().forEach(minedOpinions -> { - AspectSentiment aspectSentiment = minedOpinions.getAspect(); - System.out.printf("\tAspect sentiment: %s, aspect text: %s%n", aspectSentiment.getSentiment(), - aspectSentiment.getText()); - for (OpinionSentiment opinionSentiment : minedOpinions.getOpinions()) { - System.out.printf("\t\t'%s' sentiment because of \"%s\". Is the opinion negated: %s.%n", - opinionSentiment.getSentiment(), opinionSentiment.getText(), opinionSentiment.isNegated()); - } - }); - } - // END: com.azure.ai.textanalytics.TextAnalyticsClient.analyzeSentiment#String-String-AnalyzeSentimentOptions - } - /** * Code snippet for {@link TextAnalyticsClient#analyzeSentimentBatch(Iterable, String, TextAnalyticsRequestOptions)} */ @@ -642,8 +501,8 @@ public void analyzeSentimentStringListWithOptions() { ); // Analyzing batch sentiments - AnalyzeSentimentResultCollection resultCollection = textAnalyticsClient.analyzeSentimentBatch( - documents, "en", new TextAnalyticsRequestOptions().setIncludeStatistics(true)); + AnalyzeSentimentResultCollection resultCollection = + textAnalyticsClient.analyzeSentimentBatch(documents, "en", null); // Batch statistics TextDocumentBatchStatistics batchStatistics = resultCollection.getStatistics(); @@ -673,40 +532,6 @@ public void analyzeSentimentStringListWithOptions() { // END: com.azure.ai.textanalytics.TextAnalyticsClient.analyzeSentimentBatch#Iterable-String-TextAnalyticsRequestOptions } - /** - * Code snippet for {@link TextAnalyticsClient#analyzeSentimentBatch(Iterable, String, AnalyzeSentimentOptions)} - */ - public void analyzeSentimentStringListWithOptionsAndOpinionMining() { - // BEGIN: com.azure.ai.textanalytics.TextAnalyticsClient.analyzeSentimentBatch#Iterable-String-AnalyzeSentimentOptions - List documents = Arrays.asList( - "The hotel was dark and unclean. The restaurant had amazing gnocchi.", - "The restaurant had amazing gnocchi. The hotel was dark and unclean." - ); - - // Analyzing batch sentiments - AnalyzeSentimentResultCollection resultCollection = textAnalyticsClient.analyzeSentimentBatch( - documents, "en", new AnalyzeSentimentOptions().setIncludeOpinionMining(true)); - - // Analyzed sentiment for each of documents from a batch of documents - resultCollection.forEach(analyzeSentimentResult -> { - System.out.printf("Document ID: %s%n", analyzeSentimentResult.getId()); - DocumentSentiment documentSentiment = analyzeSentimentResult.getDocumentSentiment(); - documentSentiment.getSentences().forEach(sentenceSentiment -> { - System.out.printf("\tSentence sentiment: %s%n", sentenceSentiment.getSentiment()); - sentenceSentiment.getMinedOpinions().forEach(minedOpinions -> { - AspectSentiment aspectSentiment = minedOpinions.getAspect(); - System.out.printf("\tAspect sentiment: %s, aspect text: %s%n", aspectSentiment.getSentiment(), - aspectSentiment.getText()); - for (OpinionSentiment opinionSentiment : minedOpinions.getOpinions()) { - System.out.printf("\t\t'%s' sentiment because of \"%s\". Is the opinion negated: %s.%n", - opinionSentiment.getSentiment(), opinionSentiment.getText(), opinionSentiment.isNegated()); - } - }); - }); - }); - // END: com.azure.ai.textanalytics.TextAnalyticsClient.analyzeSentimentBatch#Iterable-String-AnalyzeSentimentOptions - } - /** * Code snippet for {@link TextAnalyticsClient#analyzeSentimentBatchWithResponse(Iterable, TextAnalyticsRequestOptions, Context)} */ @@ -757,52 +582,4 @@ public void analyzeBatchSentimentMaxOverload() { }); // END: com.azure.ai.textanalytics.TextAnalyticsClient.analyzeSentimentBatch#Iterable-TextAnalyticsRequestOptions-Context } - - /** - * Code snippet for {@link TextAnalyticsClient#analyzeSentimentBatchWithResponse(Iterable, AnalyzeSentimentOptions, Context)} - */ - public void analyzeBatchSentimentMaxOverloadWithOpinionMining() { - // BEGIN: com.azure.ai.textanalytics.TextAnalyticsClient.analyzeSentimentBatch#Iterable-AnalyzeSentimentOptions-Context - List textDocumentInputs = Arrays.asList( - new TextDocumentInput("1", "The hotel was dark and unclean. The restaurant had amazing gnocchi.") - .setLanguage("en"), - new TextDocumentInput("2", "The restaurant had amazing gnocchi. The hotel was dark and unclean.") - .setLanguage("en") - ); - - AnalyzeSentimentOptions options = new AnalyzeSentimentOptions().setIncludeOpinionMining(true) - .setIncludeStatistics(true); - - // Analyzing batch sentiments - Response response = - textAnalyticsClient.analyzeSentimentBatchWithResponse(textDocumentInputs, options, Context.NONE); - - // Response's status code - System.out.printf("Status code of request response: %d%n", response.getStatusCode()); - AnalyzeSentimentResultCollection resultCollection = response.getValue(); - - // Batch statistics - TextDocumentBatchStatistics batchStatistics = resultCollection.getStatistics(); - System.out.printf("A batch of documents statistics, transaction count: %s, valid document count: %s.%n", - batchStatistics.getTransactionCount(), batchStatistics.getValidDocumentCount()); - - // Analyzed sentiment for each of documents from a batch of documents - resultCollection.forEach(analyzeSentimentResult -> { - System.out.printf("Document ID: %s%n", analyzeSentimentResult.getId()); - DocumentSentiment documentSentiment = analyzeSentimentResult.getDocumentSentiment(); - documentSentiment.getSentences().forEach(sentenceSentiment -> { - System.out.printf("\tSentence sentiment: %s%n", sentenceSentiment.getSentiment()); - sentenceSentiment.getMinedOpinions().forEach(minedOpinions -> { - AspectSentiment aspectSentiment = minedOpinions.getAspect(); - System.out.printf("\tAspect sentiment: %s, aspect text: %s%n", aspectSentiment.getSentiment(), - aspectSentiment.getText()); - for (OpinionSentiment opinionSentiment : minedOpinions.getOpinions()) { - System.out.printf("\t\t'%s' sentiment because of \"%s\". Is the opinion negated: %s.%n", - opinionSentiment.getSentiment(), opinionSentiment.getText(), opinionSentiment.isNegated()); - } - }); - }); - }); - // END: com.azure.ai.textanalytics.TextAnalyticsClient.analyzeSentimentBatch#Iterable-AnalyzeSentimentOptions-Context - } } diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizeLinkedEntitiesBatchDocuments.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizeLinkedEntitiesBatchDocuments.java index b02e3875b2855..7e42e74511e7f 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizeLinkedEntitiesBatchDocuments.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizeLinkedEntitiesBatchDocuments.java @@ -69,10 +69,8 @@ public static void main(String[] args) { // Valid document entitiesResult.getEntities().forEach(linkedEntity -> { System.out.println("Linked Entities:"); - System.out.printf("\tName: %s, entity ID in data source: %s, URL: %s, data source: %s," - + " Bing Entity Search API ID: %s.%n", - linkedEntity.getName(), linkedEntity.getDataSourceEntityId(), linkedEntity.getUrl(), - linkedEntity.getDataSource(), linkedEntity.getBingEntitySearchApiId()); + System.out.printf("\tName: %s, entity ID in data source: %s, URL: %s, data source: %s.%n", + linkedEntity.getName(), linkedEntity.getDataSourceEntityId(), linkedEntity.getUrl(), linkedEntity.getDataSource()); linkedEntity.getMatches().forEach(entityMatch -> System.out.printf( "\tMatched entity: %s, confidence score: %f.%n", entityMatch.getText(), entityMatch.getConfidenceScore())); diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizeLinkedEntitiesBatchDocumentsAsync.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizeLinkedEntitiesBatchDocumentsAsync.java index b99a126e4898f..b7766e442b850 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizeLinkedEntitiesBatchDocumentsAsync.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizeLinkedEntitiesBatchDocumentsAsync.java @@ -6,10 +6,10 @@ import com.azure.ai.textanalytics.TextAnalyticsAsyncClient; import com.azure.ai.textanalytics.TextAnalyticsClientBuilder; import com.azure.ai.textanalytics.models.RecognizeLinkedEntitiesResult; +import com.azure.ai.textanalytics.util.RecognizeLinkedEntitiesResultCollection; import com.azure.ai.textanalytics.models.TextAnalyticsRequestOptions; import com.azure.ai.textanalytics.models.TextDocumentBatchStatistics; import com.azure.ai.textanalytics.models.TextDocumentInput; -import com.azure.ai.textanalytics.util.RecognizeLinkedEntitiesResultCollection; import com.azure.core.credential.AzureKeyCredential; import java.util.Arrays; @@ -68,10 +68,8 @@ public static void main(String[] args) { // Valid document entitiesResult.getEntities().forEach(linkedEntity -> { System.out.println("Linked Entities:"); - System.out.printf("\tName: %s, entity ID in data source: %s, URL: %s, data source: %s," - + " Bing Entity Search API ID: %s.%n", - linkedEntity.getName(), linkedEntity.getDataSourceEntityId(), linkedEntity.getUrl(), - linkedEntity.getDataSource(), linkedEntity.getBingEntitySearchApiId()); + System.out.printf("\tName: %s, entity ID in data source: %s, URL: %s, data source: %s.%n", + linkedEntity.getName(), linkedEntity.getDataSourceEntityId(), linkedEntity.getUrl(), linkedEntity.getDataSource()); linkedEntity.getMatches().forEach(entityMatch -> System.out.printf( "\tMatched entity: %s, confidence score: %f.%n", entityMatch.getText(), entityMatch.getConfidenceScore())); diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizeLinkedEntitiesBatchStringDocuments.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizeLinkedEntitiesBatchStringDocuments.java index 2d0d17db7ce26..3ec69a623e6bc 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizeLinkedEntitiesBatchStringDocuments.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizeLinkedEntitiesBatchStringDocuments.java @@ -60,13 +60,11 @@ public static void main(String[] args) { System.out.printf("Cannot recognize linked entities. Error: %s%n", entitiesResult.getError().getMessage()); } else { // Valid document - entitiesResult.getEntities().forEach(linkedEntity -> { + entitiesResult.getEntities().forEach(entity -> { System.out.println("Linked Entities:"); - System.out.printf("\tName: %s, entity ID in data source: %s, URL: %s, data source: %s," - + " Bing Entity Search API ID: %s.%n", - linkedEntity.getName(), linkedEntity.getDataSourceEntityId(), linkedEntity.getUrl(), - linkedEntity.getDataSource(), linkedEntity.getBingEntitySearchApiId()); - linkedEntity.getMatches().forEach(entityMatch -> System.out.printf( + System.out.printf("\tName: %s, entity ID in data source: %s, URL: %s, data source: %s.%n", + entity.getName(), entity.getDataSourceEntityId(), entity.getUrl(), entity.getDataSource()); + entity.getMatches().forEach(entityMatch -> System.out.printf( "\tMatched entity: %s, confidence score: %f.%n", entityMatch.getText(), entityMatch.getConfidenceScore())); }); diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizeLinkedEntitiesBatchStringDocumentsAsync.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizeLinkedEntitiesBatchStringDocumentsAsync.java index 081b7a20d5204..1bb07827b8244 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizeLinkedEntitiesBatchStringDocumentsAsync.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizeLinkedEntitiesBatchStringDocumentsAsync.java @@ -62,13 +62,10 @@ public static void main(String[] args) { // Valid document entitiesResult.getEntities().forEach(linkedEntity -> { System.out.println("Linked Entities:"); - System.out.printf("\tName: %s, entity ID in data source: %s, URL: %s, data source: %s," - + " Bing Entity Search API ID: %s.%n", - linkedEntity.getName(), linkedEntity.getDataSourceEntityId(), linkedEntity.getUrl(), - linkedEntity.getDataSource(), linkedEntity.getBingEntitySearchApiId()); + System.out.printf("\tName: %s, entity ID in data source: %s, URL: %s, data source: %s.%n", + linkedEntity.getName(), linkedEntity.getDataSourceEntityId(), linkedEntity.getUrl(), linkedEntity.getDataSource()); linkedEntity.getMatches().forEach(entityMatch -> System.out.printf( - "\tMatched entity: %s, confidence score: %f.%n", - entityMatch.getText(), entityMatch.getConfidenceScore())); + "\tMatched entity: %s, confidence score: %f.%n", entityMatch.getText(), entityMatch.getConfidenceScore())); }); } } diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizePiiEntitiesBatchDocuments.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizePiiEntitiesBatchDocuments.java deleted file mode 100644 index 6217ada71d5fb..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizePiiEntitiesBatchDocuments.java +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.textanalytics.batch; - -import com.azure.ai.textanalytics.TextAnalyticsClient; -import com.azure.ai.textanalytics.TextAnalyticsClientBuilder; -import com.azure.ai.textanalytics.models.PiiEntityCollection; -import com.azure.ai.textanalytics.models.RecognizePiiEntitiesResult; -import com.azure.ai.textanalytics.models.RecognizePiiEntityOptions; -import com.azure.ai.textanalytics.models.TextDocumentBatchStatistics; -import com.azure.ai.textanalytics.models.TextDocumentInput; -import com.azure.ai.textanalytics.util.RecognizePiiEntitiesResultCollection; -import com.azure.core.credential.AzureKeyCredential; -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; - -import java.util.Arrays; -import java.util.List; -import java.util.concurrent.atomic.AtomicInteger; - -/** - * Sample demonstrates how to recognize the Personally Identifiable Information(PII) entities of documents. - */ -public class RecognizePiiEntitiesBatchDocuments { - /** - * Main method to invoke this demo about how to recognize the Personally Identifiable Information entities of - * documents. - * - * @param args Unused arguments to the program. - */ - public static void main(String[] args) { - // Instantiate a client that will be used to call the service. - TextAnalyticsClient client = new TextAnalyticsClientBuilder() - .credential(new AzureKeyCredential("{key}")) - .endpoint("{endpoint}") - .buildClient(); - - // The texts that need be analyzed. - List documents = Arrays.asList( - new TextDocumentInput("1", "My SSN is 859-98-0987").setLanguage("en"), - new TextDocumentInput("2", "Visa card 4111 1111 1111 1111").setLanguage("en") - ); - - // Show statistics and model version - RecognizePiiEntityOptions options = new RecognizePiiEntityOptions().setIncludeStatistics(true).setModelVersion("latest"); - - // Recognizing Personally Identifiable Information entities for each document in a batch of documents - Response piiEntitiesBatchResultResponse = - client.recognizePiiEntitiesBatchWithResponse(documents, options, Context.NONE); - - // Response's status code - System.out.printf("Status code of request response: %d%n", piiEntitiesBatchResultResponse.getStatusCode()); - RecognizePiiEntitiesResultCollection recognizePiiEntitiesResultCollection = piiEntitiesBatchResultResponse.getValue(); - - // Model version - System.out.printf("Results of Azure Text Analytics \"Personally Identifiable Information Entities Recognition\" Model, version: %s%n", recognizePiiEntitiesResultCollection.getModelVersion()); - - // Batch statistics - TextDocumentBatchStatistics batchStatistics = recognizePiiEntitiesResultCollection.getStatistics(); - System.out.printf("Documents statistics: document count = %s, erroneous document count = %s, transaction count = %s, valid document count = %s.%n", - batchStatistics.getDocumentCount(), batchStatistics.getInvalidDocumentCount(), batchStatistics.getTransactionCount(), batchStatistics.getValidDocumentCount()); - - // Recognized Personally Identifiable Information entities for each document in a batch of documents - AtomicInteger counter = new AtomicInteger(); - for (RecognizePiiEntitiesResult entitiesResult : recognizePiiEntitiesResultCollection) { - // Recognized entities for each document in a batch of documents - System.out.printf("%n%s%n", documents.get(counter.getAndIncrement())); - if (entitiesResult.isError()) { - // Erroneous document - System.out.printf("Cannot recognize Personally Identifiable Information entities. Error: %s%n", entitiesResult.getError().getMessage()); - } else { - // Valid document - PiiEntityCollection piiEntityCollection = entitiesResult.getEntities(); - System.out.printf("Redacted Text: %s%n", piiEntityCollection.getRedactedText()); - piiEntityCollection.forEach(entity -> System.out.printf( - "Recognized Personally Identifiable Information entity: %s, entity category: %s, entity subcategory: %s, offset: %s, confidence score: %f.%n", - entity.getText(), entity.getCategory(), entity.getSubcategory(), entity.getOffset(), entity.getConfidenceScore())); - } - } - } -} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizePiiEntitiesBatchDocumentsAsync.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizePiiEntitiesBatchDocumentsAsync.java deleted file mode 100644 index 322807d27530a..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizePiiEntitiesBatchDocumentsAsync.java +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.textanalytics.batch; - -import com.azure.ai.textanalytics.TextAnalyticsAsyncClient; -import com.azure.ai.textanalytics.TextAnalyticsClientBuilder; -import com.azure.ai.textanalytics.models.PiiEntityCollection; -import com.azure.ai.textanalytics.models.RecognizePiiEntitiesResult; -import com.azure.ai.textanalytics.models.RecognizePiiEntityOptions; -import com.azure.ai.textanalytics.models.TextDocumentBatchStatistics; -import com.azure.ai.textanalytics.models.TextDocumentInput; -import com.azure.ai.textanalytics.util.RecognizePiiEntitiesResultCollection; -import com.azure.core.credential.AzureKeyCredential; - -import java.util.Arrays; -import java.util.List; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicInteger; - -/** - * Sample demonstrates how to recognize the Personally Identifiable Information(PII) entities of documents. - */ -public class RecognizePiiEntitiesBatchDocumentsAsync { - /** - * Main method to invoke this demo about how to recognize the Personally Identifiable Information entities of - * documents. - * - * @param args Unused arguments to the program. - */ - public static void main(String[] args) { - // Instantiate a client that will be used to call the service. - TextAnalyticsAsyncClient client = new TextAnalyticsClientBuilder() - .credential(new AzureKeyCredential("{key}")) - .endpoint("{endpoint}") - .buildAsyncClient(); - - // The texts that need be analyzed. - List documents = Arrays.asList( - new TextDocumentInput("1", "My SSN is 859-98-0987").setLanguage("en"), - new TextDocumentInput("2", "Visa card 4111 1111 1111 1111").setLanguage("en") - ); - - // Show statistics and model version - RecognizePiiEntityOptions options = new RecognizePiiEntityOptions().setIncludeStatistics(true).setModelVersion("latest"); - - // Recognizing Personally Identifiable Information entities for each document in a batch of documents - client.recognizePiiEntitiesBatchWithResponse(documents, options).subscribe( - entitiesBatchResultResponse -> { - // Response's status code - System.out.printf("Status code of request response: %d%n", entitiesBatchResultResponse.getStatusCode()); - RecognizePiiEntitiesResultCollection recognizePiiEntitiesResultCollection = entitiesBatchResultResponse.getValue(); - - // Model version - System.out.printf("Results of Azure Text Analytics \"Personally Identifiable Information Entities Recognition\" Model, version: %s%n", recognizePiiEntitiesResultCollection.getModelVersion()); - - // Batch statistics - TextDocumentBatchStatistics batchStatistics = recognizePiiEntitiesResultCollection.getStatistics(); - System.out.printf("Documents statistics: document count = %s, erroneous document count = %s, transaction count = %s, valid document count = %s.%n", - batchStatistics.getDocumentCount(), batchStatistics.getInvalidDocumentCount(), batchStatistics.getTransactionCount(), batchStatistics.getValidDocumentCount()); - - // Recognized Personally Identifiable Information entities for each of documents from a batch of documents - AtomicInteger counter = new AtomicInteger(); - for (RecognizePiiEntitiesResult entitiesResult : recognizePiiEntitiesResultCollection) { - System.out.printf("%n%s%n", documents.get(counter.getAndIncrement())); - if (entitiesResult.isError()) { - // Erroneous document - System.out.printf("Cannot recognize Personally Identifiable Information entities. Error: %s%n", entitiesResult.getError().getMessage()); - } else { - // Valid document - PiiEntityCollection piiEntityCollection = entitiesResult.getEntities(); - System.out.printf("Redacted Text: %s%n", piiEntityCollection.getRedactedText()); - piiEntityCollection.forEach(entity -> System.out.printf( - "Recognized Personally Identifiable Information entity: %s, entity category: %s, entity subcategory: %s, offset: %s, confidence score: %f.%n", - entity.getText(), entity.getCategory(), entity.getSubcategory(), entity.getOffset(), entity.getConfidenceScore())); - } - } - }, - error -> System.err.println("There was an error recognizing Personally Identifiable Information entities of the documents." + error), - () -> System.out.println("Batch of Personally Identifiable Information entities recognized.")); - - // The .subscribe() creation and assignment is not a blocking call. For the purpose of this example, we sleep - // the thread so the program does not end before the send operation is complete. Using .block() instead of - // .subscribe() will turn this into a synchronous call. - try { - TimeUnit.SECONDS.sleep(5); - } catch (InterruptedException ignored) { - } - } -} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizePiiEntitiesBatchStringDocuments.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizePiiEntitiesBatchStringDocuments.java deleted file mode 100644 index 2bfc3e91734b5..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizePiiEntitiesBatchStringDocuments.java +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.textanalytics.batch; - -import com.azure.ai.textanalytics.TextAnalyticsClient; -import com.azure.ai.textanalytics.TextAnalyticsClientBuilder; -import com.azure.ai.textanalytics.models.PiiEntityCollection; -import com.azure.ai.textanalytics.models.RecognizePiiEntitiesResult; -import com.azure.ai.textanalytics.models.RecognizePiiEntityOptions; -import com.azure.ai.textanalytics.models.TextDocumentBatchStatistics; -import com.azure.ai.textanalytics.util.RecognizePiiEntitiesResultCollection; -import com.azure.core.credential.AzureKeyCredential; - -import java.util.Arrays; -import java.util.List; -import java.util.concurrent.atomic.AtomicInteger; - -/** - * Sample demonstrates how to recognize the Personally Identifiable Information(PII) entities of {@code String} documents. - */ -public class RecognizePiiEntitiesBatchStringDocuments { - /** - * Main method to invoke this demo about how to recognize the Personally Identifiable Information entities of - * documents. - * - * @param args Unused arguments to the program. - */ - public static void main(String[] args) { - // Instantiate a client that will be used to call the service. - TextAnalyticsClient client = new TextAnalyticsClientBuilder() - .credential(new AzureKeyCredential("{key}")) - .endpoint("{endpoint}") - .buildClient(); - - // The texts that need be analyzed. - List documents = Arrays.asList( - "My SSN is 859-98-0987", - "Visa card 4111 1111 1111 1111" - ); - - // Show statistics and model version - RecognizePiiEntityOptions options = new RecognizePiiEntityOptions().setIncludeStatistics(true).setModelVersion("latest"); - - // Recognizing Personally Identifiable Information entities for each document in a batch of documents - RecognizePiiEntitiesResultCollection recognizePiiEntitiesResultCollection = client.recognizePiiEntitiesBatch(documents, "en", options); - - // Model version - System.out.printf("Results of Azure Text Analytics \"Personally Identifiable Information Entities Recognition\" Model, version: %s%n", recognizePiiEntitiesResultCollection.getModelVersion()); - - // Batch statistics - TextDocumentBatchStatistics batchStatistics = recognizePiiEntitiesResultCollection.getStatistics(); - System.out.printf("Documents statistics: document count = %s, erroneous document count = %s, transaction count = %s, valid document count = %s.%n", - batchStatistics.getDocumentCount(), batchStatistics.getInvalidDocumentCount(), batchStatistics.getTransactionCount(), batchStatistics.getValidDocumentCount()); - - // Recognized Personally Identifiable Information entities for each document in a batch of documents - AtomicInteger counter = new AtomicInteger(); - for (RecognizePiiEntitiesResult entitiesResult : recognizePiiEntitiesResultCollection) { - // Recognized entities for each of documents from a batch of documents - System.out.printf("%nText = %s%n", documents.get(counter.getAndIncrement())); - if (entitiesResult.isError()) { - // Erroneous document - System.out.printf("Cannot recognize Personally Identifiable Information entities. Error: %s%n", entitiesResult.getError().getMessage()); - } else { - // Valid document - PiiEntityCollection piiEntityCollection = entitiesResult.getEntities(); - System.out.printf("Redacted Text: %s%n", piiEntityCollection.getRedactedText()); - piiEntityCollection.forEach(entity -> System.out.printf( - "Recognized Personally Identifiable Information entity: %s, entity category: %s, entity subcategory: %s, offset: %s, confidence score: %f.%n", - entity.getText(), entity.getCategory(), entity.getSubcategory(), entity.getOffset(), entity.getConfidenceScore())); - } - } - } -} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizePiiEntitiesBatchStringDocumentsAsync.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizePiiEntitiesBatchStringDocumentsAsync.java deleted file mode 100644 index f6a6bcb9d9999..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizePiiEntitiesBatchStringDocumentsAsync.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.textanalytics.batch; - -import com.azure.ai.textanalytics.TextAnalyticsAsyncClient; -import com.azure.ai.textanalytics.TextAnalyticsClientBuilder; -import com.azure.ai.textanalytics.models.PiiEntityCollection; -import com.azure.ai.textanalytics.models.RecognizePiiEntitiesResult; -import com.azure.ai.textanalytics.models.RecognizePiiEntityOptions; -import com.azure.ai.textanalytics.models.TextDocumentBatchStatistics; -import com.azure.core.credential.AzureKeyCredential; - -import java.util.Arrays; -import java.util.List; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicInteger; - -/** - * Sample demonstrates how to recognize the PII(Personally Identifiable Information) entities of {@code String} documents. - */ -public class RecognizePiiEntitiesBatchStringDocumentsAsync { - /** - * Main method to invoke this demo about how to recognize the Personally Identifiable Information entities of - * documents. - * - * @param args Unused arguments to the program. - */ - public static void main(String[] args) { - // Instantiate a client that will be used to call the service. - TextAnalyticsAsyncClient client = new TextAnalyticsClientBuilder() - .credential(new AzureKeyCredential("{key}")) - .endpoint("{endpoint}") - .buildAsyncClient(); - - // The texts that need be analyzed. - List documents = Arrays.asList( - "My SSN is 859-98-0987", - "Visa card 4111 1111 1111 1111" - ); - - // Show statistics and model version - RecognizePiiEntityOptions options = new RecognizePiiEntityOptions().setIncludeStatistics(true).setModelVersion("latest"); - - // Recognizing Personally Identifiable Information entities for each document in a batch of documents - AtomicInteger counter = new AtomicInteger(); - client.recognizePiiEntitiesBatch(documents, "en", options).subscribe( - recognizePiiEntitiesResultCollection -> { - // Model version - System.out.printf("Results of Azure Text Analytics \"Personally Identifiable Information Entities Recognition\" Model, version: %s%n", recognizePiiEntitiesResultCollection.getModelVersion()); - - // Batch statistics - TextDocumentBatchStatistics batchStatistics = recognizePiiEntitiesResultCollection.getStatistics(); - System.out.printf("Documents statistics: document count = %s, erroneous document count = %s, transaction count = %s, valid document count = %s.%n", - batchStatistics.getDocumentCount(), batchStatistics.getInvalidDocumentCount(), batchStatistics.getTransactionCount(), batchStatistics.getValidDocumentCount()); - - for (RecognizePiiEntitiesResult entitiesResult : recognizePiiEntitiesResultCollection) { - System.out.printf("%nText = %s%n", documents.get(counter.getAndIncrement())); - if (entitiesResult.isError()) { - // Erroneous document - System.out.printf("Cannot recognize Personally Identifiable Information entities. Error: %s%n", entitiesResult.getError().getMessage()); - } else { - // Valid document - PiiEntityCollection piiEntityCollection = entitiesResult.getEntities(); - System.out.printf("Redacted Text: %s%n", piiEntityCollection.getRedactedText()); - piiEntityCollection.forEach(entity -> System.out.printf( - "Recognized Personally Identifiable Information entity: %s, entity category: %s, entity subcategory: %s, offset: %s, confidence score: %f.%n", - entity.getText(), entity.getCategory(), entity.getSubcategory(), entity.getOffset(), entity.getConfidenceScore())); - } - } - }, - error -> System.err.println("There was an error recognizing Personally Identifiable Information entities of the documents." + error), - () -> System.out.println("Batch of Personally Identifiable Information entities recognized.")); - - // The .subscribe() creation and assignment is not a blocking call. For the purpose of this example, we sleep - // the thread so the program does not end before the send operation is complete. Using .block() instead of - // .subscribe() will turn this into a synchronous call. - try { - TimeUnit.SECONDS.sleep(5); - } catch (InterruptedException ignored) { - } - } -} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/DocumentInputAsyncTest.java b/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/DocumentInputAsyncTest.java index ff6fca3990d3b..a00a8c8137a93 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/DocumentInputAsyncTest.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/DocumentInputAsyncTest.java @@ -617,7 +617,7 @@ public void analyzeSentimentNullInputWithLanguageHint() { */ @Test public void analyzeSentimentBatchNullInput() { - StepVerifier.create(client.analyzeSentimentBatch(null, null, new TextAnalyticsRequestOptions())) + StepVerifier.create(client.analyzeSentimentBatch(null, null, null)) .verifyErrorSatisfies(exception -> { assertEquals(NullPointerException.class, exception.getClass()); assertTrue(INVALID_DOCUMENT_BATCH_NPE_MESSAGE.equals(exception.getMessage())); @@ -630,7 +630,7 @@ public void analyzeSentimentBatchNullInput() { */ @Test public void analyzeSentimentBatchEmptyInputList() { - StepVerifier.create(client.analyzeSentimentBatch(Collections.emptyList(), null, new TextAnalyticsRequestOptions())) + StepVerifier.create(client.analyzeSentimentBatch(Collections.emptyList(), null, null)) .verifyErrorSatisfies(exception -> { assertEquals(IllegalArgumentException.class, exception.getClass()); assertTrue(INVALID_DOCUMENT_EMPTY_LIST_EXCEPTION_MESSAGE.equals(exception.getMessage())); @@ -643,7 +643,7 @@ public void analyzeSentimentBatchEmptyInputList() { */ @Test public void analyzeSentimentBatchNullInputWithLanguageHint() { - StepVerifier.create(client.analyzeSentimentBatch(null, "en", new TextAnalyticsRequestOptions())) + StepVerifier.create(client.analyzeSentimentBatch(null, "en", null)) .verifyErrorSatisfies(exception -> { assertEquals(NullPointerException.class, exception.getClass()); assertTrue(INVALID_DOCUMENT_BATCH_NPE_MESSAGE.equals(exception.getMessage())); @@ -656,7 +656,7 @@ public void analyzeSentimentBatchNullInputWithLanguageHint() { */ @Test public void analyzeSentimentBatchEmptyInputListWithLanguageHint() { - StepVerifier.create(client.analyzeSentimentBatch(Collections.emptyList(), "en", new TextAnalyticsRequestOptions())) + StepVerifier.create(client.analyzeSentimentBatch(Collections.emptyList(), "en", null)) .verifyErrorSatisfies(exception -> { assertEquals(IllegalArgumentException.class, exception.getClass()); assertTrue(INVALID_DOCUMENT_EMPTY_LIST_EXCEPTION_MESSAGE.equals(exception.getMessage())); diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/DocumentInputTest.java b/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/DocumentInputTest.java index 308d3c779d76a..e8e74f2e7167d 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/DocumentInputTest.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/DocumentInputTest.java @@ -535,7 +535,7 @@ public void analyzeSentimentNullInputWithLanguageHint() { @Test public void analyzeSentimentBatchNullInput() { Exception exception = assertThrows(NullPointerException.class, () -> - client.analyzeSentimentBatch(null, null, new TextAnalyticsRequestOptions())); + client.analyzeSentimentBatch(null, null, null)); assertTrue(INVALID_DOCUMENT_BATCH_NPE_MESSAGE.equals(exception.getMessage())); } @@ -546,7 +546,7 @@ public void analyzeSentimentBatchNullInput() { @Test public void analyzeSentimentBatchEmptyInputList() { Exception exception = assertThrows(IllegalArgumentException.class, () -> - client.analyzeSentimentBatch(Collections.emptyList(), null, new TextAnalyticsRequestOptions())); + client.analyzeSentimentBatch(Collections.emptyList(), null, null)); assertTrue(INVALID_DOCUMENT_EMPTY_LIST_EXCEPTION_MESSAGE.equals(exception.getMessage())); } @@ -557,7 +557,7 @@ public void analyzeSentimentBatchEmptyInputList() { @Test public void analyzeSentimentBatchNullInputWithLanguageHint() { Exception exception = assertThrows(NullPointerException.class, () -> - client.analyzeSentimentBatch(null, "en", new TextAnalyticsRequestOptions())); + client.analyzeSentimentBatch(null, "en", null)); assertTrue(INVALID_DOCUMENT_BATCH_NPE_MESSAGE.equals(exception.getMessage())); } @@ -568,7 +568,7 @@ public void analyzeSentimentBatchNullInputWithLanguageHint() { @Test public void analyzeSentimentBatchEmptyInputListWithLanguageHint() { Exception exception = assertThrows(IllegalArgumentException.class, () -> - client.analyzeSentimentBatch(Collections.emptyList(), "en", new TextAnalyticsRequestOptions())); + client.analyzeSentimentBatch(Collections.emptyList(), "en", null)); assertTrue(INVALID_DOCUMENT_EMPTY_LIST_EXCEPTION_MESSAGE.equals(exception.getMessage())); } diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/ReferencePointerParseTest.java b/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/ReferencePointerParseTest.java deleted file mode 100644 index 3b5a2b6d2e919..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/ReferencePointerParseTest.java +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.textanalytics; - -import com.azure.ai.textanalytics.implementation.TextAnalyticsClientImpl; -import com.azure.ai.textanalytics.implementation.models.DocumentSentiment; -import com.azure.ai.textanalytics.implementation.models.SentenceOpinion; -import com.azure.ai.textanalytics.implementation.models.SentenceSentiment; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.MockitoAnnotations; - -import java.util.ArrayList; -import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertThrows; - -/** - * Unit tests for Aspect relation's reference parse - */ -public class ReferencePointerParseTest { - - @Mock - private TextAnalyticsClientImpl textAnalyticsClientImpl; - - @BeforeEach - void setup() { - MockitoAnnotations.initMocks(this); - } - - @AfterEach - void teardown() { - Mockito.framework().clearInlineMocks(); - } - - private AnalyzeSentimentAsyncClient analyzeSentimentAsyncClient = new AnalyzeSentimentAsyncClient(textAnalyticsClientImpl); - - private static final String INVALID_POINTER_EXCEPTION = "'%s' is not a valid opinion pointer."; - private static final String INVALID_DOCUMENT_INDEX_EXCEPTION = "Invalid document index '%s' in '%s'."; - private static final String INVALID_SENTENCE_INDEX_EXCEPTION = "Invalid sentence index '%s' in '%s'."; - private static final String INVALID_OPINION_INDEX_EXCEPTION = "Invalid opinion index '%s' in '%s'."; - private static final String VALID_OPINION_POINTER = "#/documents/1/sentences/3/opinions/5"; - - @Test - public void parseRefPointerToIndexArrayTest() { - final int[] indexArray = analyzeSentimentAsyncClient.parseRefPointerToIndexArray(VALID_OPINION_POINTER); - assertEquals(1, indexArray[0]); - assertEquals(3, indexArray[1]); - assertEquals(5, indexArray[2]); - } - - @Test - public void parseInvalidNamePatternStringTest() { - final String referencePointer = "#/a/1/b/2/c/3"; - final IllegalStateException illegalStateException = assertThrows(IllegalStateException.class, () -> - analyzeSentimentAsyncClient.parseRefPointerToIndexArray(referencePointer)); - assertEquals(String.format(INVALID_POINTER_EXCEPTION, referencePointer), illegalStateException.getMessage()); - } - - @Test - public void parseInvalidNumberFormatStringTest() { - final String referencePointer = "#/documents/a/sentences/b/opinions/c"; - final IllegalStateException illegalStateException = assertThrows(IllegalStateException.class, () -> - analyzeSentimentAsyncClient.parseRefPointerToIndexArray(referencePointer)); - assertEquals(String.format(INVALID_POINTER_EXCEPTION, referencePointer), illegalStateException.getMessage()); - } - - @Test - public void parseIncompleteReferencePointerStringTest() { - final String referencePointer = "#/documents/1/sentences/2"; - final IllegalStateException illegalStateException = assertThrows(IllegalStateException.class, () -> - analyzeSentimentAsyncClient.parseRefPointerToIndexArray(referencePointer)); - assertEquals(String.format(INVALID_POINTER_EXCEPTION, referencePointer), illegalStateException.getMessage()); - } - - @Test - public void findSentimentOpinion() { - final SentenceOpinion sentenceOpinion = analyzeSentimentAsyncClient.findSentimentOpinion(VALID_OPINION_POINTER, getDocumentSentiments()); - assertEquals(SentenceOpinion.class, sentenceOpinion.getClass()); - } - - @Test - public void findSentimentOpinionWithInvalidDocumentIndex() { - final String referencePointer = "#/documents/2/sentences/1/opinions/1"; - final IllegalStateException illegalStateException = assertThrows(IllegalStateException.class, () -> - analyzeSentimentAsyncClient.findSentimentOpinion(referencePointer, getDocumentSentiments())); - assertEquals(String.format(INVALID_DOCUMENT_INDEX_EXCEPTION, 2, referencePointer), illegalStateException.getMessage()); - } - - @Test - public void findSentimentOpinionWithInvalidSentenceIndex() { - final String referencePointer = "#/documents/1/sentences/4/opinions/1"; - final IllegalStateException illegalStateException = assertThrows(IllegalStateException.class, () -> - analyzeSentimentAsyncClient.findSentimentOpinion(referencePointer, getDocumentSentiments())); - assertEquals(String.format(INVALID_SENTENCE_INDEX_EXCEPTION, 4, referencePointer), illegalStateException.getMessage()); - } - - @Test - public void findSentimentOpinionWithInvalidOpinionIndex() { - final String referencePointer = "#/documents/1/sentences/3/opinions/6"; - final IllegalStateException illegalStateException = assertThrows(IllegalStateException.class, () -> - analyzeSentimentAsyncClient.findSentimentOpinion(referencePointer, getDocumentSentiments())); - assertEquals(String.format(INVALID_OPINION_INDEX_EXCEPTION, 6, referencePointer), illegalStateException.getMessage()); - } - - private List getDocumentSentiments() { - List documentSentiments = new ArrayList<>(); - for (int i = 0; i < 2; i++) { - documentSentiments.add(new DocumentSentiment() - .setId(Integer.toString(i)) - .setSentences(getSentenceSentiments())); - } - return documentSentiments; - } - - private List getSentenceSentiments() { - List sentenceSentiments = new ArrayList<>(); - for (int i = 0; i < 4; i++) { - sentenceSentiments.add(new SentenceSentiment().setOpinions(getSentenceOpinions())); - } - return sentenceSentiments; - } - - private List getSentenceOpinions() { - final List sentenceOpinions = new ArrayList<>(); - for (int i = 0; i < 6; i++) { - sentenceOpinions.add(new SentenceOpinion()); - } - return sentenceOpinions; - } -} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TestUtils.java b/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TestUtils.java index cbdd6223d26fc..a6ebab3b3673c 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TestUtils.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TestUtils.java @@ -4,38 +4,31 @@ package com.azure.ai.textanalytics; import com.azure.ai.textanalytics.models.AnalyzeSentimentResult; -import com.azure.ai.textanalytics.models.AspectSentiment; +import com.azure.ai.textanalytics.util.AnalyzeSentimentResultCollection; import com.azure.ai.textanalytics.models.CategorizedEntity; import com.azure.ai.textanalytics.models.CategorizedEntityCollection; import com.azure.ai.textanalytics.models.DetectLanguageInput; import com.azure.ai.textanalytics.models.DetectLanguageResult; +import com.azure.ai.textanalytics.util.DetectLanguageResultCollection; import com.azure.ai.textanalytics.models.DetectedLanguage; import com.azure.ai.textanalytics.models.DocumentSentiment; import com.azure.ai.textanalytics.models.EntityCategory; import com.azure.ai.textanalytics.models.ExtractKeyPhraseResult; +import com.azure.ai.textanalytics.util.ExtractKeyPhrasesResultCollection; import com.azure.ai.textanalytics.models.KeyPhrasesCollection; import com.azure.ai.textanalytics.models.LinkedEntity; import com.azure.ai.textanalytics.models.LinkedEntityCollection; import com.azure.ai.textanalytics.models.LinkedEntityMatch; -import com.azure.ai.textanalytics.models.MinedOpinion; -import com.azure.ai.textanalytics.models.OpinionSentiment; -import com.azure.ai.textanalytics.models.PiiEntity; -import com.azure.ai.textanalytics.models.PiiEntityCollection; import com.azure.ai.textanalytics.models.RecognizeEntitiesResult; +import com.azure.ai.textanalytics.util.RecognizeEntitiesResultCollection; import com.azure.ai.textanalytics.models.RecognizeLinkedEntitiesResult; -import com.azure.ai.textanalytics.models.RecognizePiiEntitiesResult; +import com.azure.ai.textanalytics.util.RecognizeLinkedEntitiesResultCollection; import com.azure.ai.textanalytics.models.SentenceSentiment; import com.azure.ai.textanalytics.models.SentimentConfidenceScores; import com.azure.ai.textanalytics.models.TextDocumentBatchStatistics; import com.azure.ai.textanalytics.models.TextDocumentInput; import com.azure.ai.textanalytics.models.TextDocumentStatistics; import com.azure.ai.textanalytics.models.TextSentiment; -import com.azure.ai.textanalytics.util.AnalyzeSentimentResultCollection; -import com.azure.ai.textanalytics.util.DetectLanguageResultCollection; -import com.azure.ai.textanalytics.util.ExtractKeyPhrasesResultCollection; -import com.azure.ai.textanalytics.util.RecognizeEntitiesResultCollection; -import com.azure.ai.textanalytics.util.RecognizeLinkedEntitiesResultCollection; -import com.azure.ai.textanalytics.util.RecognizePiiEntitiesResultCollection; import com.azure.core.exception.HttpResponseException; import com.azure.core.http.HttpClient; import com.azure.core.util.Configuration; @@ -53,7 +46,6 @@ import static com.azure.core.test.TestBase.AZURE_TEST_SERVICE_VERSIONS_VALUE_ALL; import static com.azure.core.test.TestBase.getHttpClients; -import static java.util.Arrays.asList; /** * Contains helper methods for generating inputs for test methods @@ -66,48 +58,41 @@ final class TestUtils { static final String FAKE_API_KEY = "1234567890"; static final String AZURE_TEXT_ANALYTICS_API_KEY = "AZURE_TEXT_ANALYTICS_API_KEY"; - static final List SENTIMENT_INPUTS = asList("The hotel was dark and unclean. The restaurant had amazing gnocchi.", + static final List SENTIMENT_INPUTS = Arrays.asList("The hotel was dark and unclean. The restaurant had amazing gnocchi.", "The restaurant had amazing gnocchi. The hotel was dark and unclean."); - static final List CATEGORIZED_ENTITY_INPUTS = asList( + static final List CATEGORIZED_ENTITY_INPUTS = Arrays.asList( "I had a wonderful trip to Seattle last week.", "I work at Microsoft."); - static final List PII_ENTITY_INPUTS = asList( - "Microsoft employee with ssn 859-98-0987 is using our awesome API's.", - "Your ABA number - 111000025 - is the first 9 digits in the lower left hand corner of your personal check."); - - static final List LINKED_ENTITY_INPUTS = asList( + static final List LINKED_ENTITY_INPUTS = Arrays.asList( "I had a wonderful trip to Seattle last week.", "I work at Microsoft."); - static final List KEY_PHRASE_INPUTS = asList( + static final List KEY_PHRASE_INPUTS = Arrays.asList( "Hello world. This is some input text that I love.", "Bonjour tout le monde"); static final String TOO_LONG_INPUT = "Thisisaveryveryverylongtextwhichgoesonforalongtimeandwhichalmostdoesn'tseemtostopatanygivenpointintime.ThereasonforthistestistotryandseewhathappenswhenwesubmitaveryveryverylongtexttoLanguage.Thisshouldworkjustfinebutjustincaseitisalwaysgoodtohaveatestcase.ThisallowsustotestwhathappensifitisnotOK.Ofcourseitisgoingtobeokbutthenagainitisalsobettertobesure!"; - static final List KEY_PHRASE_FRENCH_INPUTS = asList( + static final List KEY_PHRASE_FRENCH_INPUTS = Arrays.asList( "Bonjour tout le monde.", "Je m'appelle Mondly."); - static final List DETECT_LANGUAGE_INPUTS = asList( + static final List DETECT_LANGUAGE_INPUTS = Arrays.asList( "This is written in English", "Este es un documento escrito en Español.", "~@!~:)"); - static final String PII_ENTITY_OFFSET_INPUT = "SSN: 859-98-0987"; - static final String SENTIMENT_OFFSET_INPUT = "The hotel was dark and unclean."; - // "personal" and "social" are common to both English and Spanish and if given with limited context the // response will be based on the "US" country hint. If the origin of the text is known to be coming from // Spanish that can be given as a hint. - static final List SPANISH_SAME_AS_ENGLISH_INPUTS = asList("personal", "social"); + static final List SPANISH_SAME_AS_ENGLISH_INPUTS = Arrays.asList("personal", "social"); static final DetectedLanguage DETECTED_LANGUAGE_SPANISH = new DetectedLanguage("Spanish", "es", 1.0, null); static final DetectedLanguage DETECTED_LANGUAGE_ENGLISH = new DetectedLanguage("English", "en", 1.0, null); - static final List DETECT_SPANISH_LANGUAGE_RESULTS = asList( + static final List DETECT_SPANISH_LANGUAGE_RESULTS = Arrays.asList( DETECTED_LANGUAGE_SPANISH, DETECTED_LANGUAGE_SPANISH); - static final List DETECT_ENGLISH_LANGUAGE_RESULTS = asList( + static final List DETECT_ENGLISH_LANGUAGE_RESULTS = Arrays.asList( DETECTED_LANGUAGE_ENGLISH, DETECTED_LANGUAGE_ENGLISH); static final HttpResponseException HTTP_RESPONSE_EXCEPTION_CLASS = new HttpResponseException("", null); @@ -117,7 +102,7 @@ final class TestUtils { "AZURE_TEXT_ANALYTICS_TEST_SERVICE_VERSIONS"; static List getDetectLanguageInputs() { - return asList( + return Arrays.asList( new DetectLanguageInput("0", DETECT_LANGUAGE_INPUTS.get(0), "US"), new DetectLanguageInput("1", DETECT_LANGUAGE_INPUTS.get(1), "US"), new DetectLanguageInput("2", DETECT_LANGUAGE_INPUTS.get(2), "US") @@ -125,14 +110,14 @@ static List getDetectLanguageInputs() { } static List getDuplicateIdDetectLanguageInputs() { - return asList( + return Arrays.asList( new DetectLanguageInput("0", DETECT_LANGUAGE_INPUTS.get(0), "US"), new DetectLanguageInput("0", DETECT_LANGUAGE_INPUTS.get(0), "US") ); } static List getDuplicateTextDocumentInputs() { - return asList( + return Arrays.asList( new TextDocumentInput("0", CATEGORIZED_ENTITY_INPUTS.get(0)), new TextDocumentInput("0", CATEGORIZED_ENTITY_INPUTS.get(0)), new TextDocumentInput("0", CATEGORIZED_ENTITY_INPUTS.get(0)) @@ -140,7 +125,7 @@ static List getDuplicateTextDocumentInputs() { } static List getWarningsTextDocumentInputs() { - return asList( + return Arrays.asList( new TextDocumentInput("0", TOO_LONG_INPUT), new TextDocumentInput("1", CATEGORIZED_ENTITY_INPUTS.get(1)) ); @@ -159,24 +144,22 @@ static List getTextDocumentInputs(List inputs) { * @return A {@link DetectLanguageResultCollection}. */ static DetectLanguageResultCollection getExpectedBatchDetectedLanguages() { - final TextDocumentBatchStatistics textDocumentBatchStatistics = new TextDocumentBatchStatistics(3, 3, 0, 3); - final List detectLanguageResultList = asList( - new DetectLanguageResult("0", new TextDocumentStatistics(26, 1), null, getDetectedLanguageEnglish()), - new DetectLanguageResult("1", new TextDocumentStatistics(40, 1), null, getDetectedLanguageSpanish()), - new DetectLanguageResult("2", new TextDocumentStatistics(6, 1), null, getUnknownDetectedLanguage())); - return new DetectLanguageResultCollection(detectLanguageResultList, DEFAULT_MODEL_VERSION, textDocumentBatchStatistics); - } + DetectedLanguage detectedLanguage1 = new DetectedLanguage("English", "en", 0.0, null); + DetectedLanguage detectedLanguage2 = new DetectedLanguage("Spanish", "es", 0.0, null); + DetectedLanguage detectedLanguage3 = new DetectedLanguage("(Unknown)", "(Unknown)", 0.0, null); - static DetectedLanguage getDetectedLanguageEnglish() { - return new DetectedLanguage("English", "en", 0.0, null); - } + TextDocumentStatistics textDocumentStatistics1 = new TextDocumentStatistics(26, 1); + TextDocumentStatistics textDocumentStatistics2 = new TextDocumentStatistics(40, 1); + TextDocumentStatistics textDocumentStatistics3 = new TextDocumentStatistics(6, 1); - static DetectedLanguage getDetectedLanguageSpanish() { - return new DetectedLanguage("Spanish", "es", 0.0, null); - } + DetectLanguageResult detectLanguageResult1 = new DetectLanguageResult("0", textDocumentStatistics1, null, detectedLanguage1); + DetectLanguageResult detectLanguageResult2 = new DetectLanguageResult("1", textDocumentStatistics2, null, detectedLanguage2); + DetectLanguageResult detectLanguageResult3 = new DetectLanguageResult("2", textDocumentStatistics3, null, detectedLanguage3); + + TextDocumentBatchStatistics textDocumentBatchStatistics = new TextDocumentBatchStatistics(3, 3, 0, 3); + List detectLanguageResultList = Arrays.asList(detectLanguageResult1, detectLanguageResult2, detectLanguageResult3); - static DetectedLanguage getUnknownDetectedLanguage() { - return new DetectedLanguage("(Unknown)", "(Unknown)", 0.0, null); + return new DetectLanguageResultCollection(detectLanguageResultList, DEFAULT_MODEL_VERSION, textDocumentBatchStatistics); } /** @@ -186,7 +169,7 @@ static DetectedLanguage getUnknownDetectedLanguage() { */ static RecognizeEntitiesResultCollection getExpectedBatchCategorizedEntities() { return new RecognizeEntitiesResultCollection( - asList(getExpectedBatchCategorizedEntities1(), getExpectedBatchCategorizedEntities2()), + Arrays.asList(getExpectedBatchCategorizedEntities1(), getExpectedBatchCategorizedEntities2()), DEFAULT_MODEL_VERSION, new TextDocumentBatchStatistics(2, 2, 0, 2)); } @@ -195,17 +178,18 @@ static RecognizeEntitiesResultCollection getExpectedBatchCategorizedEntities() { * Helper method to get the expected Categorized Entities List 1 */ static List getCategorizedEntitiesList1() { - CategorizedEntity categorizedEntity1 = new CategorizedEntity("trip", EntityCategory.EVENT, null, 0.0, 18); - CategorizedEntity categorizedEntity2 = new CategorizedEntity("Seattle", EntityCategory.LOCATION, "GPE", 0.0, 26); - CategorizedEntity categorizedEntity3 = new CategorizedEntity("last week", EntityCategory.DATE_TIME, "DateRange", 0.0, 34); - return asList(categorizedEntity1, categorizedEntity2, categorizedEntity3); + CategorizedEntity categorizedEntity1 = new CategorizedEntity("trip", EntityCategory.EVENT, null, 0.0); + CategorizedEntity categorizedEntity2 = new CategorizedEntity("Seattle", EntityCategory.LOCATION, "GPE", 0.0); + CategorizedEntity categorizedEntity3 = new CategorizedEntity("last week", EntityCategory.DATE_TIME, "DateRange", 0.0); + return Arrays.asList(categorizedEntity1, categorizedEntity2, categorizedEntity3); } /** * Helper method to get the expected Categorized Entities List 2 */ static List getCategorizedEntitiesList2() { - return asList(new CategorizedEntity("Microsoft", EntityCategory.ORGANIZATION, null, 0.0, 10)); + CategorizedEntity categorizedEntity3 = new CategorizedEntity("Microsoft", EntityCategory.ORGANIZATION, null, 0.0); + return Arrays.asList(categorizedEntity3); } /** @@ -228,195 +212,89 @@ static RecognizeEntitiesResult getExpectedBatchCategorizedEntities2() { return recognizeEntitiesResult2; } - /** - * Helper method to get the expected batch of Personally Identifiable Information entities - */ - static RecognizePiiEntitiesResultCollection getExpectedBatchPiiEntities() { - PiiEntityCollection piiEntityCollection = new PiiEntityCollection(new IterableStream<>(getPiiEntitiesList1()), - "********* employee with ssn *********** is using our awesome API's.", null); - PiiEntityCollection piiEntityCollection2 = new PiiEntityCollection(new IterableStream<>(getPiiEntitiesList2()), - "Your ABA number - ********* - is the first 9 digits in the lower left hand corner of your personal check.", null); - TextDocumentStatistics textDocumentStatistics1 = new TextDocumentStatistics(67, 1); - TextDocumentStatistics textDocumentStatistics2 = new TextDocumentStatistics(105, 1); - RecognizePiiEntitiesResult recognizeEntitiesResult1 = new RecognizePiiEntitiesResult("0", textDocumentStatistics1, null, piiEntityCollection); - RecognizePiiEntitiesResult recognizeEntitiesResult2 = new RecognizePiiEntitiesResult("1", textDocumentStatistics2, null, piiEntityCollection2); - - return new RecognizePiiEntitiesResultCollection( - asList(recognizeEntitiesResult1, recognizeEntitiesResult2), - DEFAULT_MODEL_VERSION, - new TextDocumentBatchStatistics(2, 2, 0, 2)); - } - - /** - * Helper method to get the expected batch of Personally Identifiable Information entities for domain filter - */ - static RecognizePiiEntitiesResultCollection getExpectedBatchPiiEntitiesForDomainFilter() { - PiiEntityCollection piiEntityCollection = new PiiEntityCollection( - new IterableStream<>(Arrays.asList(getPiiEntitiesList1().get(1))), - "Microsoft employee with ssn *********** is using our awesome API's.", null); - PiiEntityCollection piiEntityCollection2 = new PiiEntityCollection( - new IterableStream<>(Arrays.asList(getPiiEntitiesList2().get(0), getPiiEntitiesList2().get(1), getPiiEntitiesList2().get(2))), - "Your ABA number - ********* - is the first 9 digits in the lower left hand corner of your personal check.", null); - TextDocumentStatistics textDocumentStatistics1 = new TextDocumentStatistics(67, 1); - TextDocumentStatistics textDocumentStatistics2 = new TextDocumentStatistics(105, 1); - RecognizePiiEntitiesResult recognizeEntitiesResult1 = new RecognizePiiEntitiesResult("0", textDocumentStatistics1, null, piiEntityCollection); - RecognizePiiEntitiesResult recognizeEntitiesResult2 = new RecognizePiiEntitiesResult("1", textDocumentStatistics2, null, piiEntityCollection2); - - return new RecognizePiiEntitiesResultCollection( - asList(recognizeEntitiesResult1, recognizeEntitiesResult2), - DEFAULT_MODEL_VERSION, - new TextDocumentBatchStatistics(2, 2, 0, 2)); - } - - /** - * Helper method to get the expected Categorized Entities List 1 - */ - static List getPiiEntitiesList1() { - PiiEntity piiEntity0 = new PiiEntity("Microsoft", EntityCategory.ORGANIZATION, null, 1.0, 0); - PiiEntity piiEntity1 = new PiiEntity("859-98-0987", EntityCategory.fromString("U.S. Social Security Number (SSN)"), null, 0.65, 28); - return asList(piiEntity0, piiEntity1); - } - - /** - * Helper method to get the expected Categorized Entities List 2 - */ - static List getPiiEntitiesList2() { - PiiEntity piiEntity2 = new PiiEntity("111000025", EntityCategory.fromString("Phone Number"), null, 0.8, 18); - PiiEntity piiEntity3 = new PiiEntity("111000025", EntityCategory.fromString("ABA Routing Number"), null, 0.75, 18); - PiiEntity piiEntity4 = new PiiEntity("111000025", EntityCategory.fromString("New Zealand Social Welfare Number"), null, 0.65, 18); - PiiEntity piiEntity5 = new PiiEntity("111000025", EntityCategory.fromString("Portugal Tax Identification Number"), null, 0.65, 18); - return asList(piiEntity2, piiEntity3, piiEntity4, piiEntity5); - } - /** * Helper method to get the expected Batch Linked Entities * @return A {@link RecognizeLinkedEntitiesResultCollection}. */ static RecognizeLinkedEntitiesResultCollection getExpectedBatchLinkedEntities() { - final TextDocumentBatchStatistics textDocumentBatchStatistics = new TextDocumentBatchStatistics(2, 2, 0, 2); - final List recognizeLinkedEntitiesResultList = - asList( - new RecognizeLinkedEntitiesResult( - "0", new TextDocumentStatistics(44, 1), null, - new LinkedEntityCollection(new IterableStream<>(getLinkedEntitiesList1()), null)), - new RecognizeLinkedEntitiesResult( - "1", new TextDocumentStatistics(20, 1), null, - new LinkedEntityCollection(new IterableStream<>(getLinkedEntitiesList2()), null))); - return new RecognizeLinkedEntitiesResultCollection(recognizeLinkedEntitiesResultList, DEFAULT_MODEL_VERSION, textDocumentBatchStatistics); - } + LinkedEntityMatch linkedEntityMatch1 = new LinkedEntityMatch("Seattle", 0.0); + LinkedEntityMatch linkedEntityMatch2 = new LinkedEntityMatch("Microsoft", 0.0); - /** - * Helper method to get the expected linked Entities List 1 - */ - static List getLinkedEntitiesList1() { - final LinkedEntityMatch linkedEntityMatch = new LinkedEntityMatch("Seattle", 0.0, 26); - LinkedEntity linkedEntity = new LinkedEntity( - "Seattle", new IterableStream<>(Collections.singletonList(linkedEntityMatch)), + LinkedEntity linkedEntity1 = new LinkedEntity( + "Seattle", new IterableStream<>(Collections.singletonList(linkedEntityMatch1)), "en", "Seattle", "https://en.wikipedia.org/wiki/Seattle", - "Wikipedia", "5fbba6b8-85e1-4d41-9444-d9055436e473"); - return asList(linkedEntity); - } + "Wikipedia"); - /** - * Helper method to get the expected linked Entities List 2 - */ - static List getLinkedEntitiesList2() { - LinkedEntityMatch linkedEntityMatch = new LinkedEntityMatch("Microsoft", 0.0, 10); - LinkedEntity linkedEntity = new LinkedEntity( - "Microsoft", new IterableStream<>(Collections.singletonList(linkedEntityMatch)), + LinkedEntity linkedEntity2 = new LinkedEntity( + "Microsoft", new IterableStream<>(Collections.singletonList(linkedEntityMatch2)), "en", "Microsoft", "https://en.wikipedia.org/wiki/Microsoft", - "Wikipedia", "a093e9b9-90f5-a3d5-c4b8-5855e1b01f85"); - return asList(linkedEntity); + "Wikipedia"); + + IterableStream linkedEntityList1 = new IterableStream<>(Collections.singletonList(linkedEntity1)); + IterableStream linkedEntityList2 = new IterableStream<>(Collections.singletonList(linkedEntity2)); + + TextDocumentStatistics textDocumentStatistics1 = new TextDocumentStatistics(44, 1); + TextDocumentStatistics textDocumentStatistics2 = new TextDocumentStatistics(20, 1); + + RecognizeLinkedEntitiesResult recognizeLinkedEntitiesResult1 = new RecognizeLinkedEntitiesResult("0", textDocumentStatistics1, null, new LinkedEntityCollection(linkedEntityList1, null)); + RecognizeLinkedEntitiesResult recognizeLinkedEntitiesResult2 = new RecognizeLinkedEntitiesResult("1", textDocumentStatistics2, null, new LinkedEntityCollection(linkedEntityList2, null)); + + TextDocumentBatchStatistics textDocumentBatchStatistics = new TextDocumentBatchStatistics(2, 2, 0, 2); + List recognizeLinkedEntitiesResultList = Arrays.asList(recognizeLinkedEntitiesResult1, recognizeLinkedEntitiesResult2); + + return new RecognizeLinkedEntitiesResultCollection(recognizeLinkedEntitiesResultList, DEFAULT_MODEL_VERSION, textDocumentBatchStatistics); } /** - * Helper method to get the expected Batch Key Phrases. + * Helper method to get the expected Batch Key Phrases + * @return */ static ExtractKeyPhrasesResultCollection getExpectedBatchKeyPhrases() { TextDocumentStatistics textDocumentStatistics1 = new TextDocumentStatistics(49, 1); TextDocumentStatistics textDocumentStatistics2 = new TextDocumentStatistics(21, 1); - ExtractKeyPhraseResult extractKeyPhraseResult1 = new ExtractKeyPhraseResult("0", textDocumentStatistics1, null, new KeyPhrasesCollection(new IterableStream<>(asList("input text", "world")), null)); + ExtractKeyPhraseResult extractKeyPhraseResult1 = new ExtractKeyPhraseResult("0", textDocumentStatistics1, null, new KeyPhrasesCollection(new IterableStream<>(Arrays.asList("input text", "world")), null)); ExtractKeyPhraseResult extractKeyPhraseResult2 = new ExtractKeyPhraseResult("1", textDocumentStatistics2, null, new KeyPhrasesCollection(new IterableStream<>(Collections.singletonList("monde")), null)); TextDocumentBatchStatistics textDocumentBatchStatistics = new TextDocumentBatchStatistics(2, 2, 0, 2); - List extractKeyPhraseResultList = asList(extractKeyPhraseResult1, extractKeyPhraseResult2); + List extractKeyPhraseResultList = Arrays.asList(extractKeyPhraseResult1, extractKeyPhraseResult2); return new ExtractKeyPhrasesResultCollection(extractKeyPhraseResultList, DEFAULT_MODEL_VERSION, textDocumentBatchStatistics); } /** * Helper method to get the expected Batch Text Sentiments + * @return */ static AnalyzeSentimentResultCollection getExpectedBatchTextSentiment() { final TextDocumentStatistics textDocumentStatistics = new TextDocumentStatistics(67, 1); - final AnalyzeSentimentResult analyzeSentimentResult1 = new AnalyzeSentimentResult("0", - textDocumentStatistics, null, getExpectedDocumentSentiment()); - final AnalyzeSentimentResult analyzeSentimentResult2 = new AnalyzeSentimentResult("1", - textDocumentStatistics, null, getExpectedDocumentSentiment2()); - - return new AnalyzeSentimentResultCollection( - asList(analyzeSentimentResult1, analyzeSentimentResult2), - DEFAULT_MODEL_VERSION, new TextDocumentBatchStatistics(2, 2, 0, 2)); - } - /** - * Helper method that get the first expected DocumentSentiment result. - */ - static DocumentSentiment getExpectedDocumentSentiment() { - return new DocumentSentiment(TextSentiment.MIXED, + final DocumentSentiment expectedDocumentSentiment = new DocumentSentiment(TextSentiment.MIXED, new SentimentConfidenceScores(0.0, 0.0, 0.0), - new IterableStream<>(asList( - new SentenceSentiment("The hotel was dark and unclean.", TextSentiment.NEGATIVE, - new SentimentConfidenceScores(0.0, 0.0, 0.0), - new IterableStream<>(asList(new MinedOpinion( - new AspectSentiment("hotel", TextSentiment.NEGATIVE, 4, new SentimentConfidenceScores(0.0, 0.0, 0.0)), - new IterableStream<>(asList( - new OpinionSentiment("dark", TextSentiment.NEGATIVE, 14, false, new SentimentConfidenceScores(0.0, 0.0, 0.0)), - new OpinionSentiment("unclean", TextSentiment.NEGATIVE, 23, false, new SentimentConfidenceScores(0.0, 0.0, 0.0)) - ))))), - 0 - ), - new SentenceSentiment("The restaurant had amazing gnocchi.", TextSentiment.POSITIVE, - new SentimentConfidenceScores(0.0, 0.0, 0.0), - new IterableStream<>(asList(new MinedOpinion( - new AspectSentiment("gnocchi", TextSentiment.POSITIVE, 59, new SentimentConfidenceScores(0.0, 0.0, 0.0)), - new IterableStream<>(asList( - new OpinionSentiment("amazing", TextSentiment.POSITIVE, 51, false, new SentimentConfidenceScores(0.0, 0.0, 0.0)) - ))))), - 32 - ) + new IterableStream<>(Arrays.asList( + new SentenceSentiment("", TextSentiment.NEGATIVE, new SentimentConfidenceScores(0.0, 0.0, 0.0)), + new SentenceSentiment("", TextSentiment.POSITIVE, new SentimentConfidenceScores(0.0, 0.0, 0.0)) )), null); - } - /** - * Helper method that get the second expected DocumentSentiment result. - */ - static DocumentSentiment getExpectedDocumentSentiment2() { - return new DocumentSentiment(TextSentiment.MIXED, + final DocumentSentiment expectedDocumentSentiment2 = new DocumentSentiment(TextSentiment.MIXED, new SentimentConfidenceScores(0.0, 0.0, 0.0), - new IterableStream<>(asList( - new SentenceSentiment("The restaurant had amazing gnocchi.", TextSentiment.POSITIVE, - new SentimentConfidenceScores(0.0, 0.0, 0.0), - new IterableStream<>(asList(new MinedOpinion( - new AspectSentiment("gnocchi", TextSentiment.POSITIVE, 27, new SentimentConfidenceScores(0.0, 0.0, 0.0)), - new IterableStream<>(asList( - new OpinionSentiment("amazing", TextSentiment.POSITIVE, 19, false, new SentimentConfidenceScores(0.0, 0.0, 0.0)) - ))))), - 0 - ), - new SentenceSentiment("The hotel was dark and unclean.", TextSentiment.NEGATIVE, - new SentimentConfidenceScores(0.0, 0.0, 0.0), new IterableStream<>(asList(new MinedOpinion( - new AspectSentiment("hotel", TextSentiment.NEGATIVE, 40, new SentimentConfidenceScores(0.0, 0.0, 0.0)), - new IterableStream<>(asList( - new OpinionSentiment("dark", TextSentiment.NEGATIVE, 50, false, new SentimentConfidenceScores(0.0, 0.0, 0.0)), - new OpinionSentiment("unclean", TextSentiment.NEGATIVE, 59, false, new SentimentConfidenceScores(0.0, 0.0, 0.0)) - ))))), - 36 - ) + new IterableStream<>(Arrays.asList( + new SentenceSentiment("", TextSentiment.POSITIVE, new SentimentConfidenceScores(0.0, 0.0, 0.0)), + new SentenceSentiment("", TextSentiment.NEGATIVE, new SentimentConfidenceScores(0.0, 0.0, 0.0)) )), null); + + final AnalyzeSentimentResult analyzeSentimentResult1 = new AnalyzeSentimentResult("0", + textDocumentStatistics, null, expectedDocumentSentiment); + + final AnalyzeSentimentResult analyzeSentimentResult2 = new AnalyzeSentimentResult("1", + textDocumentStatistics, null, expectedDocumentSentiment2); + + return new AnalyzeSentimentResultCollection( + Arrays.asList(analyzeSentimentResult1, analyzeSentimentResult2), + DEFAULT_MODEL_VERSION, new TextDocumentBatchStatistics(2, 2, 0, 2)); } + /** * Returns a stream of arguments that includes all combinations of eligible {@link HttpClient HttpClients} and * service versions that should be tested. diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsAsyncClientTest.java b/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsAsyncClientTest.java index aa07870c3a23f..83de30a3024c7 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsAsyncClientTest.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsAsyncClientTest.java @@ -3,15 +3,13 @@ package com.azure.ai.textanalytics; -import com.azure.ai.textanalytics.models.AnalyzeSentimentOptions; +import com.azure.ai.textanalytics.models.DetectedLanguage; import com.azure.ai.textanalytics.models.DocumentSentiment; -import com.azure.ai.textanalytics.models.PiiEntityDomainType; -import com.azure.ai.textanalytics.models.RecognizePiiEntityOptions; +import com.azure.ai.textanalytics.models.LinkedEntity; +import com.azure.ai.textanalytics.models.LinkedEntityMatch; import com.azure.ai.textanalytics.models.SentenceSentiment; import com.azure.ai.textanalytics.models.SentimentConfidenceScores; -import com.azure.ai.textanalytics.models.TextAnalyticsError; import com.azure.ai.textanalytics.models.TextAnalyticsException; -import com.azure.ai.textanalytics.models.TextAnalyticsRequestOptions; import com.azure.ai.textanalytics.models.TextSentiment; import com.azure.core.exception.HttpResponseException; import com.azure.core.http.HttpClient; @@ -24,34 +22,19 @@ import java.time.Duration; import java.util.Arrays; +import java.util.Collections; import java.util.stream.Collectors; -import static com.azure.ai.textanalytics.TestUtils.CATEGORIZED_ENTITY_INPUTS; import static com.azure.ai.textanalytics.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; -import static com.azure.ai.textanalytics.TestUtils.LINKED_ENTITY_INPUTS; -import static com.azure.ai.textanalytics.TestUtils.PII_ENTITY_OFFSET_INPUT; -import static com.azure.ai.textanalytics.TestUtils.SENTIMENT_OFFSET_INPUT; import static com.azure.ai.textanalytics.TestUtils.getCategorizedEntitiesList1; -import static com.azure.ai.textanalytics.TestUtils.getDetectedLanguageEnglish; -import static com.azure.ai.textanalytics.TestUtils.getDetectedLanguageSpanish; import static com.azure.ai.textanalytics.TestUtils.getExpectedBatchCategorizedEntities; import static com.azure.ai.textanalytics.TestUtils.getExpectedBatchDetectedLanguages; import static com.azure.ai.textanalytics.TestUtils.getExpectedBatchKeyPhrases; import static com.azure.ai.textanalytics.TestUtils.getExpectedBatchLinkedEntities; -import static com.azure.ai.textanalytics.TestUtils.getExpectedBatchPiiEntities; -import static com.azure.ai.textanalytics.TestUtils.getExpectedBatchPiiEntitiesForDomainFilter; import static com.azure.ai.textanalytics.TestUtils.getExpectedBatchTextSentiment; -import static com.azure.ai.textanalytics.TestUtils.getExpectedDocumentSentiment; -import static com.azure.ai.textanalytics.TestUtils.getLinkedEntitiesList1; -import static com.azure.ai.textanalytics.TestUtils.getPiiEntitiesList1; -import static com.azure.ai.textanalytics.TestUtils.getUnknownDetectedLanguage; -import static com.azure.ai.textanalytics.models.TextAnalyticsErrorCode.INVALID_COUNTRY_HINT; -import static com.azure.ai.textanalytics.models.TextAnalyticsErrorCode.INVALID_DOCUMENT; -import static com.azure.ai.textanalytics.models.TextAnalyticsErrorCode.INVALID_DOCUMENT_BATCH; import static com.azure.ai.textanalytics.models.WarningCode.LONG_WORDS_IN_DOCUMENT; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; public class TextAnalyticsAsyncClientTest extends TextAnalyticsClientTestBase { @@ -85,7 +68,8 @@ public void detectLanguagesBatchInputShowStatistics(HttpClient httpClient, TextA StepVerifier.create(client.detectLanguageBatchWithResponse(inputs, options)) .assertNext(response -> validateDetectLanguageResultCollectionWithResponse(true, getExpectedBatchDetectedLanguages(), - 200, response)) + 200, response) + ) .verifyComplete()); } @@ -151,10 +135,10 @@ public void detectLanguagesBatchStringInput(HttpClient httpClient, TextAnalytics @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") public void detectSingleTextLanguage(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - detectSingleTextLanguageRunner(input -> - StepVerifier.create(client.detectLanguage(input)) - .assertNext(response -> validatePrimaryLanguage(getDetectedLanguageEnglish(), response)) - .verifyComplete()); + DetectedLanguage primaryLanguage = new DetectedLanguage("English", "en", 1.0, null); + StepVerifier.create(client.detectLanguage("This is a test English Text")) + .assertNext(response -> validatePrimaryLanguage(primaryLanguage, response)) + .verifyComplete(); } /** @@ -164,11 +148,9 @@ public void detectSingleTextLanguage(HttpClient httpClient, TextAnalyticsService @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") public void detectLanguageInvalidCountryHint(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - detectLanguageInvalidCountryHintRunner((input, countryHint) -> - StepVerifier.create(client.detectLanguage(input, countryHint)) - .expectErrorMatches(throwable -> throwable instanceof TextAnalyticsException - && INVALID_COUNTRY_HINT.equals(((TextAnalyticsException) throwable).getErrorCode())) - .verify()); + StepVerifier.create(client.detectLanguage("Este es un documento escrito en Español.", "en")) + .expectErrorMatches(throwable -> throwable instanceof TextAnalyticsException + && throwable.getMessage().equals(INVALID_COUNTRY_HINT_EXPECTED_EXCEPTION_MESSAGE)); } /** @@ -178,11 +160,9 @@ public void detectLanguageInvalidCountryHint(HttpClient httpClient, TextAnalytic @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") public void detectLanguageEmptyText(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - emptyTextRunner(input -> - StepVerifier.create(client.detectLanguage(input)) - .expectErrorMatches(throwable -> throwable instanceof TextAnalyticsException - && INVALID_DOCUMENT.equals(((TextAnalyticsException) throwable).getErrorCode())) - .verify()); + StepVerifier.create(client.detectLanguage("")) + .expectErrorMatches(throwable -> throwable instanceof TextAnalyticsException + && throwable.getMessage().equals(INVALID_DOCUMENT_EXPECTED_EXCEPTION_MESSAGE)); } /** @@ -192,10 +172,10 @@ public void detectLanguageEmptyText(HttpClient httpClient, TextAnalyticsServiceV @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") public void detectLanguageFaultyText(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - faultyTextRunner(input -> - StepVerifier.create(client.detectLanguage(input)) - .assertNext(response -> validatePrimaryLanguage(getUnknownDetectedLanguage(), response)) - .verifyComplete()); + StepVerifier.create(client.detectLanguage("!@#%%")) + .assertNext(response -> validatePrimaryLanguage( + new DetectedLanguage("(Unknown)", "(Unknown)", 0.0, null), response)) + .verifyComplete(); } /** @@ -210,23 +190,6 @@ public void detectLanguageDuplicateIdInput(HttpClient httpClient, TextAnalyticsS .verifyErrorSatisfies(ex -> assertEquals(HttpResponseException.class, ex.getClass()))); } - /** - * Verifies that an invalid document exception is returned for input documents with an empty ID. - */ - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void detectLanguageEmptyIdInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - detectLanguageInputEmptyIdRunner(inputs -> - StepVerifier.create(client.detectLanguageBatchWithResponse(inputs, null)) - .verifyErrorSatisfies(ex -> { - final HttpResponseException httpResponseException = (HttpResponseException) ex; - assertEquals(400, httpResponseException.getResponse().getStatusCode()); - final TextAnalyticsError textAnalyticsError = (TextAnalyticsError) httpResponseException.getValue(); - assertEquals(INVALID_DOCUMENT, textAnalyticsError.getErrorCode()); - })); - } - /** * Verify that with countryHint with empty string will not throw exception. */ @@ -234,10 +197,10 @@ public void detectLanguageEmptyIdInput(HttpClient httpClient, TextAnalyticsServi @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") public void detectLanguageEmptyCountryHint(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - detectLanguageEmptyCountryHintRunner((input, countryHint) -> - StepVerifier.create(client.detectLanguage(input, countryHint)) - .assertNext(response -> validatePrimaryLanguage(getDetectedLanguageSpanish(), response)) - .verifyComplete()); + StepVerifier.create(client.detectLanguage("Este es un documento escrito en Español", "")) + .assertNext(response -> validatePrimaryLanguage( + new DetectedLanguage("Spanish", "es", 0.0, null), response)) + .verifyComplete(); } /** @@ -247,10 +210,10 @@ public void detectLanguageEmptyCountryHint(HttpClient httpClient, TextAnalyticsS @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") public void detectLanguageNoneCountryHint(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - detectLanguageNoneCountryHintRunner((input, countryHint) -> - StepVerifier.create(client.detectLanguage(input, countryHint)) - .assertNext(response -> validatePrimaryLanguage(getDetectedLanguageSpanish(), response)) - .verifyComplete()); + StepVerifier.create(client.detectLanguage("Este es un documento escrito en Español", "none")) + .assertNext(response -> validatePrimaryLanguage( + new DetectedLanguage("Spanish", "es", 0.0, null), response)) + .verifyComplete(); } // Entities @@ -258,34 +221,28 @@ public void detectLanguageNoneCountryHint(HttpClient httpClient, TextAnalyticsSe @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") public void recognizeEntitiesForTextInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - recognizeCategorizedEntitiesForSingleTextInputRunner(input -> - StepVerifier.create(client.recognizeEntities(input)) - .assertNext(response -> validateCategorizedEntities(getCategorizedEntitiesList1(), - response.stream().collect(Collectors.toList()))) - .verifyComplete()); + StepVerifier.create(client.recognizeEntities("I had a wonderful trip to Seattle last week.")) + .assertNext(response -> validateCategorizedEntities(getCategorizedEntitiesList1(), + response.stream().collect(Collectors.toList()))) + .verifyComplete(); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") public void recognizeEntitiesForEmptyText(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - emptyTextRunner(input -> - StepVerifier.create(client.recognizeEntities(input)) - .expectErrorMatches(throwable -> throwable instanceof TextAnalyticsException - && INVALID_DOCUMENT.equals(((TextAnalyticsException) throwable).getErrorCode())) - .verify() - ); + StepVerifier.create(client.recognizeEntities("")) + .expectErrorMatches(throwable -> throwable instanceof TextAnalyticsException + && throwable.getMessage().equals(INVALID_DOCUMENT_EXPECTED_EXCEPTION_MESSAGE)); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") public void recognizeEntitiesForFaultyText(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - faultyTextRunner(input -> - StepVerifier.create(client.recognizeEntities(input)) - .assertNext(result -> assertFalse(result.getWarnings().iterator().hasNext())) - .verifyComplete() - ); + StepVerifier.create(client.recognizeEntities("!@#%%")) + .assertNext(result -> assertFalse(result.getWarnings().iterator().hasNext())) + .verifyComplete(); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -297,30 +254,14 @@ public void recognizeEntitiesDuplicateIdInput(HttpClient httpClient, TextAnalyti .verifyErrorSatisfies(ex -> assertEquals(HttpResponseException.class, ex.getClass()))); } - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizeEntitiesEmptyIdInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - textAnalyticsInputEmptyIdRunner(inputs -> - StepVerifier.create(client.recognizeEntitiesBatchWithResponse(inputs, null)) - .verifyErrorSatisfies(ex -> { - final HttpResponseException httpResponseException = (HttpResponseException) ex; - assertEquals(400, httpResponseException.getResponse().getStatusCode()); - final TextAnalyticsError textAnalyticsError = (TextAnalyticsError) httpResponseException.getValue(); - assertEquals(INVALID_DOCUMENT, textAnalyticsError.getErrorCode()); - })); - } - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") public void recognizeEntitiesBatchInputSingleError(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); recognizeBatchCategorizedEntitySingleErrorRunner((inputs) -> StepVerifier.create(client.recognizeEntitiesBatchWithResponse(inputs, null)) - .assertNext(resultCollection -> resultCollection.getValue().forEach(recognizeEntitiesResult -> { - Exception exception = assertThrows(TextAnalyticsException.class, recognizeEntitiesResult::getEntities); - assertEquals(String.format(BATCH_ERROR_EXCEPTION_MESSAGE, "RecognizeEntitiesResult"), exception.getMessage()); - })).verifyComplete()); + .expectErrorMatches(throwable -> throwable instanceof TextAnalyticsException + && throwable.getMessage().equals(BATCH_ERROR_EXCEPTION_MESSAGE))); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -375,386 +316,17 @@ public void recognizeEntitiesForListWithOptions(HttpClient httpClient, TextAnaly @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizeEntitiesBatchTooManyDocuments(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { + public void recognizeEntitiesTooManyDocuments(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - tooManyDocumentsRunner(inputs -> + recognizeEntitiesTooManyDocumentsRunner(inputs -> { StepVerifier.create(client.recognizeEntitiesBatch(inputs, null, null)) .verifyErrorSatisfies(ex -> { - final HttpResponseException httpResponseException = (HttpResponseException) ex; - assertEquals(400, httpResponseException.getResponse().getStatusCode()); - final TextAnalyticsError textAnalyticsError = (TextAnalyticsError) httpResponseException.getValue(); - assertEquals(INVALID_DOCUMENT_BATCH, textAnalyticsError.getErrorCode()); - })); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizeEntitiesEmoji(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - emojiRunner(document -> - StepVerifier.create(client.recognizeEntities(document)) - .assertNext(result -> result.forEach(categorizedEntity -> { - assertEquals(13, categorizedEntity.getOffset()); - })).verifyComplete(), CATEGORIZED_ENTITY_INPUTS.get(1) - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizeEntitiesEmojiWithSkinToneModifier(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - emojiWithSkinToneModifierRunner(document -> - StepVerifier.create(client.recognizeEntities(document)) - .assertNext(result -> result.forEach(categorizedEntity -> { - assertEquals(15, categorizedEntity.getOffset()); - })).verifyComplete(), CATEGORIZED_ENTITY_INPUTS.get(1) - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizeEntitiesEmojiFamily(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - emojiFamilyRunner(document -> - StepVerifier.create(client.recognizeEntities(document)) - .assertNext(result -> result.forEach(categorizedEntity -> { - assertEquals(22, categorizedEntity.getOffset()); - })).verifyComplete(), CATEGORIZED_ENTITY_INPUTS.get(1) - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizeEntitiesEmojiFamilyWIthSkinToneModifier(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - emojiFamilyWithSkinToneModifierRunner(document -> - StepVerifier.create(client.recognizeEntities(document)) - .assertNext(result -> result.forEach(categorizedEntity -> { - assertEquals(30, categorizedEntity.getOffset()); - })).verifyComplete(), CATEGORIZED_ENTITY_INPUTS.get(1) - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizeEntitiesDiacriticsNfc(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - diacriticsNfcRunner(document -> - StepVerifier.create(client.recognizeEntities(document)) - .assertNext(result -> result.forEach(categorizedEntity -> { - assertEquals(14, categorizedEntity.getOffset()); - })).verifyComplete(), CATEGORIZED_ENTITY_INPUTS.get(1) - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizeEntitiesDiacriticsNfd(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - diacriticsNfdRunner(document -> - StepVerifier.create(client.recognizeEntities(document)) - .assertNext(result -> result.forEach(categorizedEntity -> { - assertEquals(15, categorizedEntity.getOffset()); - })).verifyComplete(), CATEGORIZED_ENTITY_INPUTS.get(1) - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizeEntitiesKoreanNfc(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - koreanNfcRunner(document -> - StepVerifier.create(client.recognizeEntities(document)) - .assertNext(result -> result.forEach(categorizedEntity -> { - assertEquals(13, categorizedEntity.getOffset()); - })).verifyComplete(), CATEGORIZED_ENTITY_INPUTS.get(1) - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizeEntitiesKoreanNfd(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - koreanNfdRunner(document -> - StepVerifier.create(client.recognizeEntities(document)) - .assertNext(result -> result.forEach(categorizedEntity -> { - assertEquals(13, categorizedEntity.getOffset()); - })).verifyComplete(), CATEGORIZED_ENTITY_INPUTS.get(1) - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizeEntitiesZalgoText(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - zalgoTextRunner(document -> - StepVerifier.create(client.recognizeEntities(document)) - .assertNext(result -> result.forEach(categorizedEntity -> { - assertEquals(126, categorizedEntity.getOffset()); - })).verifyComplete(), CATEGORIZED_ENTITY_INPUTS.get(1) - ); - } - - // Recognize Personally Identifiable Information entity - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizePiiEntitiesForTextInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - recognizePiiSingleDocumentRunner(document -> - StepVerifier.create(client.recognizePiiEntities(document)) - .assertNext(response -> validatePiiEntities(getPiiEntitiesList1(), response.stream().collect(Collectors.toList()))) - .verifyComplete()); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizePiiEntitiesForEmptyText(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - emptyTextRunner(document -> StepVerifier.create(client.recognizePiiEntities(document)) - .expectErrorMatches(throwable -> throwable instanceof TextAnalyticsException - && INVALID_DOCUMENT.equals(((TextAnalyticsException) throwable).getErrorCode())) - .verify()); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizePiiEntitiesForFaultyText(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - faultyTextRunner(document -> - StepVerifier.create(client.recognizePiiEntities(document)) - .assertNext(result -> assertFalse(result.getWarnings().iterator().hasNext())) - .verifyComplete()); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizePiiEntitiesDuplicateIdInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - recognizeBatchPiiEntityDuplicateIdRunner(inputs -> - StepVerifier.create(client.recognizePiiEntitiesBatchWithResponse(inputs, null)) - .verifyErrorSatisfies(ex -> assertEquals(HttpResponseException.class, ex.getClass()))); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizePiiEntitiesEmptyIdInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - textAnalyticsInputEmptyIdRunner(inputs -> - StepVerifier.create(client.recognizePiiEntitiesBatchWithResponse(inputs, null)) - .verifyErrorSatisfies(ex -> { - final HttpResponseException httpResponseException = (HttpResponseException) ex; - assertEquals(400, httpResponseException.getResponse().getStatusCode()); - final TextAnalyticsError textAnalyticsError = (TextAnalyticsError) httpResponseException.getValue(); - assertEquals(INVALID_DOCUMENT, textAnalyticsError.getErrorCode()); - })); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizePiiEntitiesBatchInputSingleError(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - recognizeBatchPiiEntitySingleErrorRunner((inputs) -> - StepVerifier.create(client.recognizePiiEntitiesBatchWithResponse(inputs, null)) - .assertNext(resultCollection -> resultCollection.getValue().forEach(recognizePiiEntitiesResult -> { - Exception exception = assertThrows(TextAnalyticsException.class, recognizePiiEntitiesResult::getEntities); - assertEquals(String.format(BATCH_ERROR_EXCEPTION_MESSAGE, "RecognizePiiEntitiesResult"), exception.getMessage()); - })).verifyComplete()); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizePiiEntitiesForBatchInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - recognizeBatchPiiEntitiesRunner((inputs) -> - StepVerifier.create(client.recognizePiiEntitiesBatchWithResponse(inputs, null)) - .assertNext(response -> validatePiiEntitiesResultCollectionWithResponse(false, getExpectedBatchPiiEntities(), 200, response)) - .verifyComplete()); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizePiiEntitiesForBatchInputShowStatistics(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - recognizeBatchPiiEntitiesShowStatsRunner((inputs, options) -> - StepVerifier.create(client.recognizePiiEntitiesBatchWithResponse(inputs, options)) - .assertNext(response -> validatePiiEntitiesResultCollectionWithResponse(true, getExpectedBatchPiiEntities(), 200, response)) - .verifyComplete()); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizePiiEntitiesForListLanguageHint(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - recognizePiiLanguageHintRunner((inputs, language) -> - StepVerifier.create(client.recognizePiiEntitiesBatch(inputs, language, null)) - .assertNext(response -> validatePiiEntitiesResultCollection(false, getExpectedBatchPiiEntities(), response)) - .verifyComplete()); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizePiiEntitiesForListStringWithOptions(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - recognizeStringBatchPiiEntitiesShowStatsRunner((inputs, options) -> - StepVerifier.create(client.recognizePiiEntitiesBatch(inputs, null, options)) - .assertNext(response -> validatePiiEntitiesResultCollection(true, getExpectedBatchPiiEntities(), response)) - .verifyComplete()); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizePiiEntitiesBatchTooManyDocuments(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - tooManyDocumentsRunner(inputs -> - StepVerifier.create(client.recognizePiiEntitiesBatch(inputs, null, null)) - .verifyErrorSatisfies(ex -> { - final HttpResponseException httpResponseException = (HttpResponseException) ex; - assertEquals(400, httpResponseException.getResponse().getStatusCode()); - final TextAnalyticsError textAnalyticsError = (TextAnalyticsError) httpResponseException.getValue(); - assertEquals(INVALID_DOCUMENT_BATCH, textAnalyticsError.getErrorCode()); - })); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizePiiEntitiesEmoji(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - emojiRunner(document -> - StepVerifier.create(client.recognizePiiEntities(document)) - .assertNext(result -> result.forEach(piiEntity -> { - assertEquals(8, piiEntity.getOffset()); - })).verifyComplete(), PII_ENTITY_OFFSET_INPUT - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizePiiEntitiesEmojiWithSkinToneModifier(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - emojiWithSkinToneModifierRunner(document -> - StepVerifier.create(client.recognizePiiEntities(document)) - .assertNext(result -> result.forEach(piiEntity -> { - assertEquals(10, piiEntity.getOffset()); - })).verifyComplete(), PII_ENTITY_OFFSET_INPUT - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizePiiEntitiesEmojiFamily(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - emojiFamilyRunner(document -> - StepVerifier.create(client.recognizePiiEntities(document)) - .assertNext(result -> result.forEach(piiEntity -> { - assertEquals(17, piiEntity.getOffset()); - })).verifyComplete(), PII_ENTITY_OFFSET_INPUT - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizePiiEntitiesEmojiFamilyWIthSkinToneModifier(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - emojiFamilyWithSkinToneModifierRunner(document -> - StepVerifier.create(client.recognizePiiEntities(document)) - .assertNext(result -> result.forEach(piiEntity -> { - assertEquals(25, piiEntity.getOffset()); - })).verifyComplete(), PII_ENTITY_OFFSET_INPUT - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizePiiEntitiesDiacriticsNfc(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - diacriticsNfcRunner(document -> - StepVerifier.create(client.recognizePiiEntities(document)) - .assertNext(result -> result.forEach(piiEntity -> { - assertEquals(9, piiEntity.getOffset()); - })).verifyComplete(), PII_ENTITY_OFFSET_INPUT - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizePiiEntitiesDiacriticsNfd(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - diacriticsNfdRunner(document -> - StepVerifier.create(client.recognizePiiEntities(document)) - .assertNext(result -> result.forEach(piiEntity -> { - assertEquals(10, piiEntity.getOffset()); - })).verifyComplete(), PII_ENTITY_OFFSET_INPUT - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizePiiEntitiesKoreanNfc(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - koreanNfcRunner(document -> - StepVerifier.create(client.recognizePiiEntities(document)) - .assertNext(result -> result.forEach(piiEntity -> { - assertEquals(8, piiEntity.getOffset()); - })).verifyComplete(), PII_ENTITY_OFFSET_INPUT - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizePiiEntitiesKoreanNfd(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - koreanNfdRunner(document -> - StepVerifier.create(client.recognizePiiEntities(document)) - .assertNext(result -> result.forEach(piiEntity -> { - assertEquals(8, piiEntity.getOffset()); - })).verifyComplete(), PII_ENTITY_OFFSET_INPUT - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizePiiEntitiesZalgoText(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - zalgoTextRunner(document -> - StepVerifier.create(client.recognizePiiEntities(document)) - .assertNext(result -> result.forEach(piiEntity -> { - assertEquals(121, piiEntity.getOffset()); - })).verifyComplete(), PII_ENTITY_OFFSET_INPUT - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizePiiEntitiesForDomainFilter(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - recognizePiiDomainFilterRunner((document, options) -> - StepVerifier.create(client.recognizePiiEntities(document, "en", options)) - .assertNext(response -> validatePiiEntities(Arrays.asList(getPiiEntitiesList1().get(1)), - response.stream().collect(Collectors.toList()))) - .verifyComplete()); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizePiiEntitiesForBatchInputStringForDomainFilter(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - recognizePiiLanguageHintRunner((inputs, language) -> - StepVerifier.create(client.recognizePiiEntitiesBatch(inputs, language, - new RecognizePiiEntityOptions().setDomainFilter(PiiEntityDomainType.PROTECTED_HEALTH_INFORMATION))) - .assertNext(response -> validatePiiEntitiesResultCollection(false, getExpectedBatchPiiEntitiesForDomainFilter(), response)) - .verifyComplete()); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizePiiEntitiesForBatchInputForDomainFilter(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - recognizeBatchPiiEntitiesRunner((inputs) -> - StepVerifier.create(client.recognizePiiEntitiesBatchWithResponse(inputs, - new RecognizePiiEntityOptions().setDomainFilter(PiiEntityDomainType.PROTECTED_HEALTH_INFORMATION))) - .assertNext(response -> validatePiiEntitiesResultCollectionWithResponse(false, getExpectedBatchPiiEntitiesForDomainFilter(), 200, response)) - .verifyComplete()); + HttpResponseException exception = (HttpResponseException) ex; + assertEquals(HttpResponseException.class, exception.getClass()); + assertEquals(EXCEEDED_ALLOWED_DOCUMENTS_LIMITS_MESSAGE, exception.getMessage()); + assertEquals(INVALID_DOCUMENT_BATCH, exception.getValue().toString()); + }); + }); } // Linked Entities @@ -762,31 +334,30 @@ public void recognizePiiEntitiesForBatchInputForDomainFilter(HttpClient httpClie @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") public void recognizeLinkedEntitiesForTextInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - recognizeLinkedEntitiesForSingleTextInputRunner(input -> - StepVerifier.create(client.recognizeLinkedEntities(input)) - .assertNext(response -> validateLinkedEntity(getLinkedEntitiesList1().get(0), response.iterator().next())) - .verifyComplete()); + final LinkedEntityMatch linkedEntityMatch = new LinkedEntityMatch("Seattle", 0.0); + final LinkedEntity linkedEntity = new LinkedEntity("Seattle", new IterableStream<>(Collections.singletonList(linkedEntityMatch)), "en", "Seattle", "https://en.wikipedia.org/wiki/Seattle", "Wikipedia"); + + StepVerifier.create(client.recognizeLinkedEntities("I had a wonderful trip to Seattle last week.")) + .assertNext(response -> validateLinkedEntity(linkedEntity, response.iterator().next())) + .verifyComplete(); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") public void recognizeLinkedEntitiesForEmptyText(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - emptyTextRunner(input -> - StepVerifier.create(client.recognizeLinkedEntities(input)) - .expectErrorMatches(throwable -> throwable instanceof TextAnalyticsException - && INVALID_DOCUMENT.equals(((TextAnalyticsException) throwable).getErrorCode())) - .verify()); + StepVerifier.create(client.recognizeLinkedEntities("")) + .expectErrorMatches(throwable -> throwable instanceof TextAnalyticsException + && throwable.getMessage().equals(INVALID_DOCUMENT_EXPECTED_EXCEPTION_MESSAGE)); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") public void recognizeLinkedEntitiesForFaultyText(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - faultyTextRunner(input -> - StepVerifier.create(client.recognizeLinkedEntities(input)) - .assertNext(result -> assertFalse(result.getWarnings().iterator().hasNext())) - .verifyComplete()); + StepVerifier.create(client.recognizeLinkedEntities("!@#%%")) + .assertNext(result -> assertFalse(result.getWarnings().iterator().hasNext())) + .verifyComplete(); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -798,20 +369,6 @@ public void recognizeLinkedEntitiesDuplicateIdInput(HttpClient httpClient, TextA .verifyErrorSatisfies(ex -> assertEquals(HttpResponseException.class, ex.getClass()))); } - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizeLinkedEntitiesEmptyIdInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - textAnalyticsInputEmptyIdRunner(inputs -> - StepVerifier.create(client.recognizeLinkedEntitiesBatchWithResponse(inputs, null)) - .verifyErrorSatisfies(ex -> { - final HttpResponseException httpResponseException = (HttpResponseException) ex; - assertEquals(400, httpResponseException.getResponse().getStatusCode()); - final TextAnalyticsError textAnalyticsError = (TextAnalyticsError) httpResponseException.getValue(); - assertEquals(INVALID_DOCUMENT, textAnalyticsError.getErrorCode()); - })); - } - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") public void recognizeLinkedEntitiesForBatchInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { @@ -864,142 +421,17 @@ public void recognizeLinkedEntitiesForListStringWithOptions(HttpClient httpClien @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizeLinkedEntitiesBatchTooManyDocuments(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { + public void recognizeLinkedEntitiesTooManyDocuments(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - tooManyDocumentsRunner(inputs -> + recognizeLinkedEntitiesTooManyDocumentsRunner(inputs -> { StepVerifier.create(client.recognizeLinkedEntitiesBatch(inputs, null, null)) .verifyErrorSatisfies(ex -> { - final HttpResponseException httpResponseException = (HttpResponseException) ex; - assertEquals(400, httpResponseException.getResponse().getStatusCode()); - final TextAnalyticsError textAnalyticsError = (TextAnalyticsError) httpResponseException.getValue(); - assertEquals(INVALID_DOCUMENT_BATCH, textAnalyticsError.getErrorCode()); - })); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizeLinkedEntitiesEmoji(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - emojiRunner(document -> - StepVerifier.create(client.recognizeLinkedEntities(document)) - .assertNext(result -> result.forEach(linkedEntity -> { - linkedEntity.getMatches().forEach(linkedEntityMatch -> { - assertEquals(13, linkedEntityMatch.getOffset()); - }); - })).verifyComplete(), LINKED_ENTITY_INPUTS.get(1) - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizeLinkedEntitiesEmojiWithSkinToneModifier(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - emojiWithSkinToneModifierRunner(document -> - StepVerifier.create(client.recognizeLinkedEntities(document)) - .assertNext(result -> result.forEach(linkedEntity -> { - linkedEntity.getMatches().forEach(linkedEntityMatch -> { - assertEquals(15, linkedEntityMatch.getOffset()); - }); - })).verifyComplete(), LINKED_ENTITY_INPUTS.get(1) - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizeLinkedEntitiesEmojiFamily(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - emojiFamilyRunner(document -> - StepVerifier.create(client.recognizeLinkedEntities(document)) - .assertNext(result -> result.forEach(linkedEntity -> { - linkedEntity.getMatches().forEach(linkedEntityMatch -> { - assertEquals(22, linkedEntityMatch.getOffset()); - }); - })).verifyComplete(), LINKED_ENTITY_INPUTS.get(1) - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizeLinkedEntitiesEmojiFamilyWIthSkinToneModifier(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - emojiFamilyWithSkinToneModifierRunner(document -> - StepVerifier.create(client.recognizeLinkedEntities(document)) - .assertNext(result -> result.forEach(linkedEntity -> { - linkedEntity.getMatches().forEach(linkedEntityMatch -> { - assertEquals(30, linkedEntityMatch.getOffset()); - }); - })).verifyComplete(), LINKED_ENTITY_INPUTS.get(1) - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizeLinkedEntitiesDiacriticsNfc(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - diacriticsNfcRunner(document -> - StepVerifier.create(client.recognizeLinkedEntities(document)) - .assertNext(result -> result.forEach(linkedEntity -> { - linkedEntity.getMatches().forEach(linkedEntityMatch -> { - assertEquals(14, linkedEntityMatch.getOffset()); - }); - })).verifyComplete(), LINKED_ENTITY_INPUTS.get(1) - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizeLinkedEntitiesDiacriticsNfd(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - diacriticsNfdRunner(document -> - StepVerifier.create(client.recognizeLinkedEntities(document)) - .assertNext(result -> result.forEach(linkedEntity -> { - linkedEntity.getMatches().forEach(linkedEntityMatch -> { - assertEquals(15, linkedEntityMatch.getOffset()); - }); - })).verifyComplete(), LINKED_ENTITY_INPUTS.get(1) - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizeLinkedEntitiesKoreanNfc(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - koreanNfcRunner(document -> - StepVerifier.create(client.recognizeLinkedEntities(document)) - .assertNext(result -> result.forEach(linkedEntity -> { - linkedEntity.getMatches().forEach(linkedEntityMatch -> { - assertEquals(13, linkedEntityMatch.getOffset()); - }); - })).verifyComplete(), LINKED_ENTITY_INPUTS.get(1) - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizeLinkedEntitiesKoreanNfd(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - koreanNfdRunner(document -> - StepVerifier.create(client.recognizeLinkedEntities(document)) - .assertNext(result -> result.forEach(linkedEntity -> { - linkedEntity.getMatches().forEach(linkedEntityMatch -> { - assertEquals(13, linkedEntityMatch.getOffset()); - }); - })).verifyComplete(), LINKED_ENTITY_INPUTS.get(1) - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizeLinkedEntitiesZalgoText(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - zalgoTextRunner(document -> - StepVerifier.create(client.recognizeLinkedEntities(document)) - .assertNext(result -> result.forEach(linkedEntity -> { - linkedEntity.getMatches().forEach(linkedEntityMatch -> { - assertEquals(126, linkedEntityMatch.getOffset()); - }); - })).verifyComplete(), LINKED_ENTITY_INPUTS.get(1) - ); + HttpResponseException exception = (HttpResponseException) ex; + assertEquals(HttpResponseException.class, exception.getClass()); + assertEquals(EXCEEDED_ALLOWED_DOCUMENTS_LIMITS_MESSAGE, exception.getMessage()); + assertEquals(INVALID_DOCUMENT_BATCH, exception.getValue().toString()); + }); + }); } // Key Phrases @@ -1007,31 +439,27 @@ public void recognizeLinkedEntitiesZalgoText(HttpClient httpClient, TextAnalytic @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") public void extractKeyPhrasesForTextInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - extractKeyPhrasesForSingleTextInputRunner(input -> - StepVerifier.create(client.extractKeyPhrases(input)) - .assertNext(response -> assertEquals("monde", response.iterator().next())) - .verifyComplete()); + StepVerifier.create(client.extractKeyPhrases("Bonjour tout le monde.")) + .assertNext(response -> assertEquals("monde", response.iterator().next())) + .verifyComplete(); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") public void extractKeyPhrasesForEmptyText(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - emptyTextRunner(input -> - StepVerifier.create(client.extractKeyPhrases(input)) - .expectErrorMatches(throwable -> throwable instanceof TextAnalyticsException - && INVALID_DOCUMENT.equals(((TextAnalyticsException) throwable).getErrorCode())) - .verify()); + StepVerifier.create(client.extractKeyPhrases("")) + .expectErrorMatches(throwable -> throwable instanceof TextAnalyticsException + && throwable.getMessage().equals(INVALID_DOCUMENT_EXPECTED_EXCEPTION_MESSAGE)); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") public void extractKeyPhrasesForFaultyText(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - faultyTextRunner(input -> - StepVerifier.create(client.extractKeyPhrases(input)) - .assertNext(result -> assertFalse(result.getWarnings().iterator().hasNext())) - .verifyComplete()); + StepVerifier.create(client.extractKeyPhrases("!@#%%")) + .assertNext(result -> assertFalse(result.getWarnings().iterator().hasNext())) + .verifyComplete(); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -1043,20 +471,6 @@ public void extractKeyPhrasesDuplicateIdInput(HttpClient httpClient, TextAnalyti .verifyErrorSatisfies(ex -> assertEquals(HttpResponseException.class, ex.getClass()))); } - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void extractKeyPhrasesEmptyIdInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - textAnalyticsInputEmptyIdRunner(inputs -> - StepVerifier.create(client.extractKeyPhrasesBatchWithResponse(inputs, null)) - .verifyErrorSatisfies(ex -> { - final HttpResponseException httpResponseException = (HttpResponseException) ex; - assertEquals(400, httpResponseException.getResponse().getStatusCode()); - final TextAnalyticsError textAnalyticsError = (TextAnalyticsError) httpResponseException.getValue(); - assertEquals(INVALID_DOCUMENT, textAnalyticsError.getErrorCode()); - })); - } - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") public void extractKeyPhrasesForBatchInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { @@ -1140,20 +554,6 @@ public void extractKeyPhrasesBatchWarning(HttpClient httpClient, TextAnalyticsSe ); } - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void extractKeyPhrasesBatchTooManyDocuments(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - tooManyDocumentsRunner(inputs -> - StepVerifier.create(client.extractKeyPhrasesBatch(inputs, null, null)) - .verifyErrorSatisfies(ex -> { - final HttpResponseException httpResponseException = (HttpResponseException) ex; - assertEquals(400, httpResponseException.getResponse().getStatusCode()); - final TextAnalyticsError textAnalyticsError = (TextAnalyticsError) httpResponseException.getValue(); - assertEquals(INVALID_DOCUMENT_BATCH, textAnalyticsError.getErrorCode()); - })); - } - // Sentiment /** @@ -1163,38 +563,16 @@ public void extractKeyPhrasesBatchTooManyDocuments(HttpClient httpClient, TextAn @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") public void analyzeSentimentForTextInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - analyzeSentimentForSingleTextInputRunner(input -> - StepVerifier.create(client.analyzeSentiment(input)) - .assertNext(response -> validateAnalyzedSentiment(false, getExpectedDocumentSentiment(), response)) - .verifyComplete() - ); - } - - /** - * Test analyzing sentiment for a string input with default language hint. - */ - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void analyzeSentimentForTextInputWithDefaultLanguageHint(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - analyzeSentimentForSingleTextInputRunner(input -> - StepVerifier.create(client.analyzeSentiment(input, null)) - .assertNext(response -> validateAnalyzedSentiment(false, getExpectedDocumentSentiment(), response)) - .verifyComplete() - ); - } + final DocumentSentiment expectedDocumentSentiment = new DocumentSentiment(TextSentiment.MIXED, + new SentimentConfidenceScores(0.0, 0.0, 0.0), + new IterableStream<>(Arrays.asList( + new SentenceSentiment("", TextSentiment.NEGATIVE, new SentimentConfidenceScores(0.0, 0.0, 0.0)), + new SentenceSentiment("", TextSentiment.POSITIVE, new SentimentConfidenceScores(0.0, 0.0, 0.0)) + )), null); - /** - * Test analyzing sentiment for a string input and verifying the result of opinion mining. - */ - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void analyzeSentimentForTextInputWithOpinionMining(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - analyzeSentimentForTextInputWithOpinionMiningRunner((input, options) -> - StepVerifier.create(client.analyzeSentiment(input, "en", options)) - .assertNext(response -> validateAnalyzedSentiment(true, getExpectedDocumentSentiment(), response)) - .verifyComplete()); + StepVerifier + .create(client.analyzeSentiment("The hotel was dark and unclean. The restaurant had amazing gnocchi.")) + .assertNext(response -> validateAnalyzedSentiment(expectedDocumentSentiment, response)).verifyComplete(); } /** @@ -1204,12 +582,9 @@ public void analyzeSentimentForTextInputWithOpinionMining(HttpClient httpClient, @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") public void analyzeSentimentForEmptyText(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - emptyTextRunner(document -> - StepVerifier.create(client.analyzeSentiment(document)) - .expectErrorMatches(throwable -> throwable instanceof TextAnalyticsException - && INVALID_DOCUMENT.equals(((TextAnalyticsException) throwable).getErrorCode())) - .verify() - ); + StepVerifier.create(client.analyzeSentiment("")) + .expectErrorMatches(throwable -> throwable instanceof TextAnalyticsException + && throwable.getMessage().equals(INVALID_DOCUMENT_EXPECTED_EXCEPTION_MESSAGE)); } /** @@ -1219,18 +594,16 @@ public void analyzeSentimentForEmptyText(HttpClient httpClient, TextAnalyticsSer @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") public void analyzeSentimentForFaultyText(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - faultyTextRunner(input -> { - final DocumentSentiment expectedDocumentSentiment = new DocumentSentiment( - TextSentiment.NEUTRAL, - new SentimentConfidenceScores(0.0, 0.0, 0.0), - new IterableStream<>(Arrays.asList( - new SentenceSentiment("!", TextSentiment.NEUTRAL, new SentimentConfidenceScores(0.0, 0.0, 0.0), null, 0), - new SentenceSentiment("@#%%", TextSentiment.NEUTRAL, new SentimentConfidenceScores(0.0, 0.0, 0.0), null, 1) - )), null); - StepVerifier.create(client.analyzeSentiment(input)) - .assertNext(response -> validateAnalyzedSentiment(false, expectedDocumentSentiment, response)) - .verifyComplete(); - }); + final DocumentSentiment expectedDocumentSentiment = new DocumentSentiment( + TextSentiment.NEUTRAL, + new SentimentConfidenceScores(0.0, 0.0, 0.0), + new IterableStream<>(Arrays.asList( + new SentenceSentiment("", TextSentiment.NEUTRAL, new SentimentConfidenceScores(0.0, 0.0, 0.0)), + new SentenceSentiment("", TextSentiment.NEUTRAL, new SentimentConfidenceScores(0.0, 0.0, 0.0)) + )), null); + + StepVerifier.create(client.analyzeSentiment("!@#%%")) + .assertNext(response -> validateAnalyzedSentiment(expectedDocumentSentiment, response)).verifyComplete(); } /** @@ -1241,342 +614,72 @@ public void analyzeSentimentForFaultyText(HttpClient httpClient, TextAnalyticsSe public void analyzeSentimentDuplicateIdInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); analyzeBatchSentimentDuplicateIdRunner(inputs -> - StepVerifier.create(client.analyzeSentimentBatchWithResponse(inputs, new TextAnalyticsRequestOptions())) - .verifyErrorSatisfies(ex -> assertEquals(HttpResponseException.class, ex.getClass()))); - } - - /** - * Verifies that an invalid document exception is returned for input documents with an empty ID. - */ - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void analyzeSentimentEmptyIdInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - textAnalyticsInputEmptyIdRunner(inputs -> StepVerifier.create(client.analyzeSentimentBatchWithResponse(inputs, null)) - .verifyErrorSatisfies(ex -> { - final HttpResponseException httpResponseException = (HttpResponseException) ex; - assertEquals(400, httpResponseException.getResponse().getStatusCode()); - final TextAnalyticsError textAnalyticsError = (TextAnalyticsError) httpResponseException.getValue(); - assertEquals(INVALID_DOCUMENT, textAnalyticsError.getErrorCode()); - })); + .verifyErrorSatisfies(ex -> assertEquals(HttpResponseException.class, ex.getClass()))); } /** - * Verify that the collection result excludes request statistics and mined options when given a batch of - * String documents with null TextAnalyticsRequestOptions and null language code which will use the default language - * code, 'en'. - * - * {@link TextAnalyticsAsyncClient#analyzeSentimentBatch(Iterable, String, TextAnalyticsRequestOptions)} - * which TextAnalyticsRequestOptions is null and null language code which will use the default language code, 'en'. + * Test analyzing sentiment for a list of string input. */ @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") public void analyzeSentimentForBatchStringInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); analyzeSentimentStringInputRunner(inputs -> - StepVerifier.create(client.analyzeSentimentBatch(inputs, null, new TextAnalyticsRequestOptions())) - .assertNext(response -> validateSentimentResultCollection(false, false, getExpectedBatchTextSentiment(), response)) + StepVerifier.create(client.analyzeSentimentBatch(inputs, null, null)) + .assertNext(response -> validateSentimentResultCollection(false, getExpectedBatchTextSentiment(), response)) .verifyComplete()); } /** - * Verify that the collection result excludes request statistics and mined options when given a batch of - * String documents with null TextAnalyticsRequestOptions and given a language code. - * - * {@link TextAnalyticsAsyncClient#analyzeSentimentBatch(Iterable, String, TextAnalyticsRequestOptions)} - * which TextAnalyticsRequestOptions is null and given a language code. + * Test analyzing sentiment for a list of string input with language code. */ @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void analyzeSentimentForListStringWithLanguageHint(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { + public void analyzeSentimentForListLanguageHint(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); analyzeSentimentLanguageHintRunner((inputs, language) -> - StepVerifier.create(client.analyzeSentimentBatch(inputs, language, new TextAnalyticsRequestOptions())) - .assertNext(response -> validateSentimentResultCollection(false, false, getExpectedBatchTextSentiment(), response)) + StepVerifier.create(client.analyzeSentimentBatch(inputs, language, null)) + .assertNext(response -> validateSentimentResultCollection(false, getExpectedBatchTextSentiment(), response)) .verifyComplete()); } /** - * Verify that the collection result includes request statistics but not mined options when given a batch of - * String documents with AnalyzeSentimentOptions. - * - * {@link TextAnalyticsAsyncClient#analyzeSentimentBatch(Iterable, String, AnalyzeSentimentOptions)} - * which to show the request statistics only and verify the analyzed sentiment result. - */ - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void analyzeSentimentForListStringShowStatisticsExcludeOpinionMining(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - analyzeBatchStringSentimentShowStatsAndIncludeOpinionMiningRunner((inputs, options) -> - StepVerifier.create(client.analyzeSentimentBatch(inputs, null, options.setIncludeOpinionMining(false))) - .assertNext(response -> validateSentimentResultCollection(true, false, getExpectedBatchTextSentiment(), response)) - .verifyComplete()); - } - - /** - * Verify that the collection result includes mined options but not request statistics when given a batch of - * String documents with AnalyzeSentimentOptions. - * - * {@link TextAnalyticsAsyncClient#analyzeSentimentBatch(Iterable, String, AnalyzeSentimentOptions)} - * which AnalyzeSentimentOptions includes opinion mining and request statistics. - */ - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void analyzeSentimentForListStringNotShowStatisticsButIncludeOpinionMining(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - analyzeBatchStringSentimentShowStatsAndIncludeOpinionMiningRunner((inputs, options) -> { - options.setIncludeStatistics(false); - StepVerifier.create(client.analyzeSentimentBatch(inputs, null, options)) - .assertNext(response -> validateSentimentResultCollection(false, true, getExpectedBatchTextSentiment(), response)) - .verifyComplete(); - }); - } - - /** - * Verify that the collection result includes mined options and request statistics when given a batch of - * String documents with AnalyzeSentimentOptions. - * - * {@link TextAnalyticsAsyncClient#analyzeSentimentBatch(Iterable, String, AnalyzeSentimentOptions)} - * which AnalyzeSentimentOptions includes opinion mining and request statistics. + * Test analyzing sentiment for a list of string input with request options. */ @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void analyzeSentimentForListStringShowStatisticsAndIncludeOpinionMining(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { + public void analyzeSentimentForListStringWithOptions(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - analyzeBatchStringSentimentShowStatsAndIncludeOpinionMiningRunner((inputs, options) -> + analyzeBatchStringSentimentShowStatsRunner((inputs, options) -> StepVerifier.create(client.analyzeSentimentBatch(inputs, null, options)) - .assertNext(response -> validateSentimentResultCollection(true, true, getExpectedBatchTextSentiment(), response)) + .assertNext(response -> validateSentimentResultCollection(true, getExpectedBatchTextSentiment(), response)) .verifyComplete()); } /** - * Verify that the collection result excludes request statistics and mined options when given a batch of - * TextDocumentInput documents with null TextAnalyticsRequestOptions. - * - * {@link TextAnalyticsAsyncClient#analyzeSentimentBatchWithResponse(Iterable, TextAnalyticsRequestOptions)} - * which TextAnalyticsRequestOptions is null. + * Test analyzing sentiment for a batch of documents. */ @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void analyzeSentimentForBatchInputWithNullRequestOptions(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { + public void analyzeSentimentForBatchInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); analyzeBatchSentimentRunner(inputs -> - StepVerifier.create(client.analyzeSentimentBatchWithResponse(inputs, (TextAnalyticsRequestOptions) null)) - .assertNext(response -> validateSentimentResultCollectionWithResponse(false, false, getExpectedBatchTextSentiment(), 200, response)) + StepVerifier.create(client.analyzeSentimentBatchWithResponse(inputs, null)) + .assertNext(response -> validateSentimentResultCollectionWithResponse(false, getExpectedBatchTextSentiment(), 200, response)) .verifyComplete()); } /** - * Verify that we can get statistics on the collection result when given a batch of - * TextDocumentInput documents with TextAnalyticsRequestOptions. - * - * {@link TextAnalyticsAsyncClient#analyzeSentimentBatchWithResponse(Iterable, TextAnalyticsRequestOptions)} - * which TextAnalyticsRequestOptions includes request statistics. + * Verify that we can get statistics on the collection result when given a batch of documents with options. */ @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") public void analyzeSentimentForBatchInputShowStatistics(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - analyzeBatchSentimentShowStatsRunner((inputs, requestOptions) -> - StepVerifier.create(client.analyzeSentimentBatchWithResponse(inputs, requestOptions)) - .assertNext(response -> validateSentimentResultCollectionWithResponse(true, false, getExpectedBatchTextSentiment(), 200, response)) - .verifyComplete()); - } - - /** - * Verify that the collection result excludes request statistics and mined options when given a batch of - * TextDocumentInput documents with null AnalyzeSentimentOptions. - * - * {@link TextAnalyticsAsyncClient#analyzeSentimentBatchWithResponse(Iterable, AnalyzeSentimentOptions)} - * which AnalyzeSentimentOptions is null. - */ - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void analyzeSentimentForBatchInputWithNullAnalyzeSentimentOptions(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - analyzeBatchSentimentOpinionMining((inputs, options) -> - StepVerifier.create(client.analyzeSentimentBatchWithResponse(inputs, (AnalyzeSentimentOptions) null)) - .assertNext(response -> validateSentimentResultCollectionWithResponse(false, false, getExpectedBatchTextSentiment(), 200, response)) - .verifyComplete()); - } - - /** - * Verify that the collection result includes request statistics but not mined options when given a batch of - * TextDocumentInput documents with AnalyzeSentimentOptions. - * - * {@link TextAnalyticsAsyncClient#analyzeSentimentBatchWithResponse(Iterable, AnalyzeSentimentOptions)} - * which AnalyzeSentimentOptions includes request statistics but not opinion mining. - */ - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void analyzeSentimentForBatchInputShowStatisticsExcludeOpinionMining(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - analyzeBatchSentimentOpinionMining((inputs, options) -> - StepVerifier.create(client.analyzeSentimentBatchWithResponse(inputs, options.setIncludeOpinionMining(false))) - .assertNext(response -> validateSentimentResultCollectionWithResponse(true, false, getExpectedBatchTextSentiment(), 200, response)) - .verifyComplete()); - } - - /** - * Verify that the collection result includes mined options but not request statistics when given a batch of - * TextDocumentInput documents with AnalyzeSentimentOptions. - * - * {@link TextAnalyticsAsyncClient#analyzeSentimentBatchWithResponse(Iterable, AnalyzeSentimentOptions)} - * which AnalyzeSentimentOptions includes opinion mining but not request statistics. - */ - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void analyzeSentimentForBatchInputNotShowStatisticsButIncludeOpinionMining(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - analyzeBatchSentimentOpinionMining((inputs, options) -> { - options.setIncludeStatistics(false); + analyzeBatchSentimentShowStatsRunner((inputs, options) -> StepVerifier.create(client.analyzeSentimentBatchWithResponse(inputs, options)) - .assertNext(response -> - validateSentimentResultCollectionWithResponse(false, true, getExpectedBatchTextSentiment(), 200, response)) - .verifyComplete(); - }); - } - - /** - * Verify that the collection result includes mined options and request statistics when given a batch of - * TextDocumentInput documents with AnalyzeSentimentOptions. - * - * {@link TextAnalyticsAsyncClient#analyzeSentimentBatchWithResponse(Iterable, AnalyzeSentimentOptions)} - * which AnalyzeSentimentOptions includes opinion mining and request statistics. - */ - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void analyzeSentimentForBatchInputShowStatisticsAndIncludeOpinionMining(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - analyzeBatchSentimentOpinionMining((inputs, options) -> - StepVerifier.create(client.analyzeSentimentBatchWithResponse(inputs, options)) - .assertNext(response -> validateSentimentResultCollectionWithResponse(true, true, getExpectedBatchTextSentiment(), 200, response)) + .assertNext(response -> validateSentimentResultCollectionWithResponse(true, getExpectedBatchTextSentiment(), 200, response)) .verifyComplete()); } - - /** - * Verifies that an InvalidDocumentBatch exception is returned for input documents with too many documents. - */ - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void analyzeSentimentBatchTooManyDocuments(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - tooManyDocumentsRunner(inputs -> - StepVerifier.create(client.analyzeSentimentBatch(inputs, null, null)) - .verifyErrorSatisfies(ex -> { - final HttpResponseException httpResponseException = (HttpResponseException) ex; - assertEquals(400, httpResponseException.getResponse().getStatusCode()); - final TextAnalyticsError textAnalyticsError = (TextAnalyticsError) httpResponseException.getValue(); - assertEquals(INVALID_DOCUMENT_BATCH, textAnalyticsError.getErrorCode()); - })); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void analyzeSentimentEmoji(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - emojiRunner(document -> - StepVerifier.create(client.analyzeSentiment(document)) - .assertNext(result -> result.getSentences().forEach(sentenceSentiment -> { - assertEquals(0, sentenceSentiment.getOffset()); - })).verifyComplete(), SENTIMENT_OFFSET_INPUT - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void analyzeSentimentEmojiWithSkinToneModifier(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - emojiWithSkinToneModifierRunner(document -> - StepVerifier.create(client.analyzeSentiment(document)) - .assertNext(result -> result.getSentences().forEach(sentenceSentiment -> { - assertEquals(0, sentenceSentiment.getOffset()); - })).verifyComplete(), SENTIMENT_OFFSET_INPUT - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void analyzeSentimentEmojiFamily(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - emojiFamilyRunner(document -> - StepVerifier.create(client.analyzeSentiment(document)) - .assertNext(result -> result.getSentences().forEach(sentenceSentiment -> { - assertEquals(0, sentenceSentiment.getOffset()); - })).verifyComplete(), SENTIMENT_OFFSET_INPUT - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void analyzeSentimentEmojiFamilyWithSkinToneModifier(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - emojiFamilyWithSkinToneModifierRunner(document -> - StepVerifier.create(client.analyzeSentiment(document)) - .assertNext(result -> result.getSentences().forEach(sentenceSentiment -> { - assertEquals(0, sentenceSentiment.getOffset()); - })).verifyComplete(), SENTIMENT_OFFSET_INPUT - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void analyzeSentimentDiacriticsNfc(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - diacriticsNfcRunner(document -> - StepVerifier.create(client.analyzeSentiment(document)) - .assertNext(result -> result.getSentences().forEach(sentenceSentiment -> { - assertEquals(0, sentenceSentiment.getOffset()); - })).verifyComplete(), SENTIMENT_OFFSET_INPUT - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void analyzeSentimentDiacriticsNfd(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - diacriticsNfdRunner(document -> - StepVerifier.create(client.analyzeSentiment(document)) - .assertNext(result -> result.getSentences().forEach(sentenceSentiment -> { - assertEquals(0, sentenceSentiment.getOffset()); - })).verifyComplete(), SENTIMENT_OFFSET_INPUT - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void analyzeSentimentKoreanNfc(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - koreanNfcRunner(document -> - StepVerifier.create(client.analyzeSentiment(document)) - .assertNext(result -> result.getSentences().forEach(sentenceSentiment -> { - assertEquals(0, sentenceSentiment.getOffset()); - })).verifyComplete(), SENTIMENT_OFFSET_INPUT - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void analyzeSentimentKoreanNfd(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - koreanNfdRunner(document -> - StepVerifier.create(client.analyzeSentiment(document)) - .assertNext(result -> result.getSentences().forEach(sentenceSentiment -> { - assertEquals(0, sentenceSentiment.getOffset()); - })).verifyComplete(), SENTIMENT_OFFSET_INPUT - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void analyzeSentimentZalgoText(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); - zalgoTextRunner(document -> - StepVerifier.create(client.analyzeSentiment(document)) - .assertNext(result -> result.getSentences().forEach(sentenceSentiment -> { - assertEquals(0, sentenceSentiment.getOffset()); - })).verifyComplete(), SENTIMENT_OFFSET_INPUT - ); - } } diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsClientTest.java b/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsClientTest.java index d03979643af7b..c73ebf0755aab 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsClientTest.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsClientTest.java @@ -3,21 +3,16 @@ package com.azure.ai.textanalytics; -import com.azure.ai.textanalytics.models.AnalyzeSentimentOptions; import com.azure.ai.textanalytics.models.CategorizedEntity; +import com.azure.ai.textanalytics.models.DetectedLanguage; import com.azure.ai.textanalytics.models.DocumentSentiment; import com.azure.ai.textanalytics.models.LinkedEntity; -import com.azure.ai.textanalytics.models.PiiEntityCollection; -import com.azure.ai.textanalytics.models.PiiEntityDomainType; -import com.azure.ai.textanalytics.models.RecognizePiiEntityOptions; +import com.azure.ai.textanalytics.models.LinkedEntityMatch; +import com.azure.ai.textanalytics.util.RecognizeEntitiesResultCollection; import com.azure.ai.textanalytics.models.SentenceSentiment; import com.azure.ai.textanalytics.models.SentimentConfidenceScores; -import com.azure.ai.textanalytics.models.TextAnalyticsError; import com.azure.ai.textanalytics.models.TextAnalyticsException; -import com.azure.ai.textanalytics.models.TextAnalyticsRequestOptions; import com.azure.ai.textanalytics.models.TextSentiment; -import com.azure.ai.textanalytics.util.RecognizeEntitiesResultCollection; -import com.azure.ai.textanalytics.util.RecognizePiiEntitiesResultCollection; import com.azure.core.exception.HttpResponseException; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.Response; @@ -28,31 +23,17 @@ import java.net.HttpURLConnection; import java.util.Arrays; +import java.util.Collections; import java.util.List; import java.util.stream.Collectors; -import static com.azure.ai.textanalytics.TestUtils.CATEGORIZED_ENTITY_INPUTS; import static com.azure.ai.textanalytics.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; -import static com.azure.ai.textanalytics.TestUtils.LINKED_ENTITY_INPUTS; -import static com.azure.ai.textanalytics.TestUtils.PII_ENTITY_OFFSET_INPUT; -import static com.azure.ai.textanalytics.TestUtils.SENTIMENT_OFFSET_INPUT; import static com.azure.ai.textanalytics.TestUtils.getCategorizedEntitiesList1; -import static com.azure.ai.textanalytics.TestUtils.getDetectedLanguageEnglish; -import static com.azure.ai.textanalytics.TestUtils.getDetectedLanguageSpanish; import static com.azure.ai.textanalytics.TestUtils.getExpectedBatchCategorizedEntities; import static com.azure.ai.textanalytics.TestUtils.getExpectedBatchDetectedLanguages; import static com.azure.ai.textanalytics.TestUtils.getExpectedBatchKeyPhrases; import static com.azure.ai.textanalytics.TestUtils.getExpectedBatchLinkedEntities; -import static com.azure.ai.textanalytics.TestUtils.getExpectedBatchPiiEntities; -import static com.azure.ai.textanalytics.TestUtils.getExpectedBatchPiiEntitiesForDomainFilter; import static com.azure.ai.textanalytics.TestUtils.getExpectedBatchTextSentiment; -import static com.azure.ai.textanalytics.TestUtils.getExpectedDocumentSentiment; -import static com.azure.ai.textanalytics.TestUtils.getLinkedEntitiesList1; -import static com.azure.ai.textanalytics.TestUtils.getPiiEntitiesList1; -import static com.azure.ai.textanalytics.TestUtils.getUnknownDetectedLanguage; -import static com.azure.ai.textanalytics.models.TextAnalyticsErrorCode.INVALID_COUNTRY_HINT; -import static com.azure.ai.textanalytics.models.TextAnalyticsErrorCode.INVALID_DOCUMENT; -import static com.azure.ai.textanalytics.models.TextAnalyticsErrorCode.INVALID_DOCUMENT_BATCH; import static com.azure.ai.textanalytics.models.WarningCode.LONG_WORDS_IN_DOCUMENT; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; @@ -129,12 +110,11 @@ public void detectLanguagesBatchStringInput(HttpClient httpClient, TextAnalytics /** * Verifies that a single DetectLanguageResult is returned for a document to detect language. */ - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") public void detectSingleTextLanguage(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsClient(httpClient, serviceVersion); - detectSingleTextLanguageRunner(input -> - validatePrimaryLanguage(getDetectedLanguageEnglish(), client.detectLanguage(input))); + validatePrimaryLanguage(new DetectedLanguage("English", "en", 0.0, null), + client.detectLanguage("This is a test English Text")); } /** @@ -144,11 +124,8 @@ public void detectSingleTextLanguage(HttpClient httpClient, TextAnalyticsService @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") public void detectLanguageEmptyText(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsClient(httpClient, serviceVersion); - emptyTextRunner(input -> { - final TextAnalyticsException exception = assertThrows(TextAnalyticsException.class, - () -> client.detectLanguage(input)); - assertEquals(INVALID_DOCUMENT, exception.getErrorCode()); - }); + Exception exception = assertThrows(TextAnalyticsException.class, () -> client.detectLanguage("")); + assertTrue(exception.getMessage().equals(INVALID_DOCUMENT_EXPECTED_EXCEPTION_MESSAGE)); } /** @@ -158,73 +135,56 @@ public void detectLanguageEmptyText(HttpClient httpClient, TextAnalyticsServiceV @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") public void detectLanguageFaultyText(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsClient(httpClient, serviceVersion); - faultyTextRunner(input -> validatePrimaryLanguage(client.detectLanguage(input), getUnknownDetectedLanguage())); + DetectedLanguage primaryLanguage = new DetectedLanguage("(Unknown)", "(Unknown)", 0.0, null); + validatePrimaryLanguage(client.detectLanguage("!@#%%"), primaryLanguage); } /** - * Verifies that a bad request exception is returned for input documents with same IDs. - */ - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void detectLanguageDuplicateIdInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - detectLanguageDuplicateIdRunner((inputs, options) -> { - final HttpResponseException response = assertThrows(HttpResponseException.class, - () -> client.detectLanguageBatchWithResponse(inputs, options, Context.NONE)); - assertEquals(HttpURLConnection.HTTP_BAD_REQUEST, response.getResponse().getStatusCode()); - }); - } - - /** - * Verifies that an invalid document exception is returned for input documents with an empty ID. + * Verifies that a TextAnalyticsException is thrown for a document with invalid country hint. */ @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void detectLanguageEmptyIdInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { + public void detectLanguageInvalidCountryHint(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsClient(httpClient, serviceVersion); - detectLanguageInputEmptyIdRunner(inputs -> { - final HttpResponseException httpResponseException = assertThrows(HttpResponseException.class, - () -> client.detectLanguageBatchWithResponse(inputs, null, Context.NONE)); - assertEquals(400, httpResponseException.getResponse().getStatusCode()); - final TextAnalyticsError textAnalyticsError = (TextAnalyticsError) httpResponseException.getValue(); - assertEquals(INVALID_DOCUMENT, textAnalyticsError.getErrorCode()); - }); + Exception exception = assertThrows(TextAnalyticsException.class, () -> + client.detectLanguage("Este es un documento escrito en Español.", "en")); + assertTrue(exception.getMessage().equals(INVALID_COUNTRY_HINT_EXPECTED_EXCEPTION_MESSAGE)); } /** - * Verifies that a TextAnalyticsException is thrown for a document with invalid country hint. + * Verify that with countryHint with empty string will not throw exception. */ @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void detectLanguageInvalidCountryHint(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { + public void detectLanguageEmptyCountryHint(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsClient(httpClient, serviceVersion); - detectLanguageInvalidCountryHintRunner((input, countryHint) -> { - final TextAnalyticsException exception = assertThrows(TextAnalyticsException.class, - () -> client.detectLanguage(input, countryHint)); - assertEquals(INVALID_COUNTRY_HINT, exception.getErrorCode()); - }); + validatePrimaryLanguage(new DetectedLanguage("Spanish", "es", 0.0, null), + client.detectLanguage("Este es un documento escrito en Español", "")); } /** - * Verify that with countryHint with empty string will not throw exception. + * Verify that with countryHint with "none" will not throw exception. */ @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void detectLanguageEmptyCountryHint(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { + public void detectLanguageNoneCountryHint(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsClient(httpClient, serviceVersion); - detectLanguageEmptyCountryHintRunner((input, countryHint) -> - validatePrimaryLanguage(getDetectedLanguageSpanish(), client.detectLanguage(input, countryHint))); + validatePrimaryLanguage(new DetectedLanguage("Spanish", "es", 0.0, null), + client.detectLanguage("Este es un documento escrito en Español", "none")); } /** - * Verify that with countryHint with "none" will not throw exception. + * Verifies that a bad request exception is returned for input documents with same IDs. */ @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void detectLanguageNoneCountryHint(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { + public void detectLanguageDuplicateIdInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsClient(httpClient, serviceVersion); - detectLanguageNoneCountryHintRunner((input, countryHint) -> - validatePrimaryLanguage(getDetectedLanguageSpanish(), client.detectLanguage(input, countryHint))); + detectLanguageDuplicateIdRunner((inputs, options) -> { + HttpResponseException response = assertThrows(HttpResponseException.class, + () -> client.detectLanguageBatchWithResponse(inputs, options, Context.NONE)); + assertEquals(HttpURLConnection.HTTP_BAD_REQUEST, response.getResponse().getStatusCode()); + }); } // Recognize Entity @@ -233,28 +193,23 @@ public void detectLanguageNoneCountryHint(HttpClient httpClient, TextAnalyticsSe @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") public void recognizeEntitiesForTextInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsClient(httpClient, serviceVersion); - recognizeCategorizedEntitiesForSingleTextInputRunner(input -> { - final List entities = client.recognizeEntities(input).stream().collect(Collectors.toList()); - validateCategorizedEntities(getCategorizedEntitiesList1(), entities); - }); + final List entities = client.recognizeEntities("I had a wonderful trip to Seattle last week.").stream().collect(Collectors.toList()); + validateCategorizedEntities(getCategorizedEntitiesList1(), entities); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") public void recognizeEntitiesForEmptyText(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsClient(httpClient, serviceVersion); - emptyTextRunner(input -> { - final TextAnalyticsException exception = assertThrows(TextAnalyticsException.class, - () -> client.recognizeEntities(input).iterator().hasNext()); - assertEquals(INVALID_DOCUMENT, exception.getErrorCode()); - }); + Exception exception = assertThrows(TextAnalyticsException.class, () -> client.recognizeEntities("").iterator().hasNext()); + assertTrue(exception.getMessage().equals(INVALID_DOCUMENT_EXPECTED_EXCEPTION_MESSAGE)); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") public void recognizeEntitiesForFaultyText(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsClient(httpClient, serviceVersion); - faultyTextRunner(input -> assertFalse(client.recognizeEntities(input).iterator().hasNext())); + assertFalse(client.recognizeEntities("!@#%%").iterator().hasNext()); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -262,25 +217,12 @@ public void recognizeEntitiesForFaultyText(HttpClient httpClient, TextAnalyticsS public void recognizeEntitiesDuplicateIdInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsClient(httpClient, serviceVersion); recognizeCategorizedEntityDuplicateIdRunner(inputs -> { - final HttpResponseException response = assertThrows(HttpResponseException.class, + HttpResponseException response = assertThrows(HttpResponseException.class, () -> client.recognizeEntitiesBatchWithResponse(inputs, null, Context.NONE)); assertEquals(HttpURLConnection.HTTP_BAD_REQUEST, response.getResponse().getStatusCode()); }); } - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizeEntitiesEmptyIdInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - textAnalyticsInputEmptyIdRunner(inputs -> { - final HttpResponseException httpResponseException = assertThrows(HttpResponseException.class, - () -> client.recognizeEntitiesBatchWithResponse(inputs, null, Context.NONE)); - assertEquals(400, httpResponseException.getResponse().getStatusCode()); - final TextAnalyticsError textAnalyticsError = (TextAnalyticsError) httpResponseException.getValue(); - assertEquals(INVALID_DOCUMENT, textAnalyticsError.getErrorCode()); - }); - } - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") public void recognizeEntitiesBatchInputSingleError(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { @@ -289,7 +231,7 @@ public void recognizeEntitiesBatchInputSingleError(HttpClient httpClient, TextAn Response response = client.recognizeEntitiesBatchWithResponse(inputs, null, Context.NONE); response.getValue().forEach(recognizeEntitiesResult -> { Exception exception = assertThrows(TextAnalyticsException.class, recognizeEntitiesResult::getEntities); - assertEquals(String.format(BATCH_ERROR_EXCEPTION_MESSAGE, "RecognizeEntitiesResult"), exception.getMessage()); + assertEquals(exception.getMessage(), BATCH_ERROR_EXCEPTION_MESSAGE); }); }); } @@ -309,7 +251,7 @@ public void recognizeEntitiesForBatchInput(HttpClient httpClient, TextAnalyticsS public void recognizeEntitiesForBatchInputShowStatistics(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsClient(httpClient, serviceVersion); recognizeBatchCategorizedEntitiesShowStatsRunner((inputs, options) -> - validateCategorizedEntitiesResultCollectionWithResponse(true, getExpectedBatchCategorizedEntities(), 200, + validateCategorizedEntitiesResultCollectionWithResponse(false, getExpectedBatchCategorizedEntities(), 200, client.recognizeEntitiesBatchWithResponse(inputs, options, Context.NONE)) ); } @@ -338,395 +280,20 @@ public void recognizeEntitiesForListLanguageHint(HttpClient httpClient, TextAnal public void recognizeEntitiesForListWithOptions(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsClient(httpClient, serviceVersion); recognizeStringBatchCategorizedEntitiesShowStatsRunner((inputs, options) -> - validateCategorizedEntitiesResultCollection(true, getExpectedBatchCategorizedEntities(), + validateCategorizedEntitiesResultCollection(false, getExpectedBatchCategorizedEntities(), client.recognizeEntitiesBatch(inputs, null, options)) ); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizeEntitiesBatchTooManyDocuments(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { + public void recognizeEntitiesTooManyDocuments(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsClient(httpClient, serviceVersion); - tooManyDocumentsRunner(inputs -> { - final HttpResponseException httpResponseException = assertThrows(HttpResponseException.class, + recognizeEntitiesTooManyDocumentsRunner(inputs -> { + HttpResponseException exception = assertThrows(HttpResponseException.class, () -> client.recognizeEntitiesBatch(inputs, null, null).stream().findFirst().get()); - assertEquals(400, httpResponseException.getResponse().getStatusCode()); - final TextAnalyticsError textAnalyticsError = (TextAnalyticsError) httpResponseException.getValue(); - assertEquals(INVALID_DOCUMENT_BATCH, textAnalyticsError.getErrorCode()); - }); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizeEntitiesEmoji(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - emojiRunner(document -> - client.recognizeEntities(document).forEach( - categorizedEntity -> { - assertEquals(13, categorizedEntity.getOffset()); - }), - CATEGORIZED_ENTITY_INPUTS.get(1) - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizeEntitiesEmojiWithSkinToneModifier(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - emojiWithSkinToneModifierRunner(document -> - client.recognizeEntities(document).forEach( - categorizedEntity -> { - assertEquals(15, categorizedEntity.getOffset()); - }), - CATEGORIZED_ENTITY_INPUTS.get(1) - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizeEntitiesEmojiFamily(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - emojiFamilyRunner(document -> - client.recognizeEntities(document).forEach( - categorizedEntity -> { - assertEquals(22, categorizedEntity.getOffset()); - }), - CATEGORIZED_ENTITY_INPUTS.get(1) - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizeEntitiesEmojiFamilyWIthSkinToneModifier(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - emojiFamilyWithSkinToneModifierRunner(document -> - client.recognizeEntities(document).forEach( - categorizedEntity -> { - assertEquals(30, categorizedEntity.getOffset()); - }), - CATEGORIZED_ENTITY_INPUTS.get(1) - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizeEntitiesDiacriticsNfc(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - diacriticsNfcRunner(document -> - client.recognizeEntities(document).forEach( - categorizedEntity -> { - assertEquals(14, categorizedEntity.getOffset()); - }), - CATEGORIZED_ENTITY_INPUTS.get(1) - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizeEntitiesDiacriticsNfd(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - diacriticsNfdRunner(document -> - client.recognizeEntities(document).forEach( - categorizedEntity -> { - assertEquals(15, categorizedEntity.getOffset()); - }), - CATEGORIZED_ENTITY_INPUTS.get(1) - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizeEntitiesKoreanNfc(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - koreanNfcRunner(document -> - client.recognizeEntities(document).forEach( - categorizedEntity -> { - assertEquals(13, categorizedEntity.getOffset()); - }), - CATEGORIZED_ENTITY_INPUTS.get(1) - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizeEntitiesKoreanNfd(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - koreanNfdRunner(document -> - client.recognizeEntities(document).forEach( - categorizedEntity -> { - assertEquals(13, categorizedEntity.getOffset()); - }), - CATEGORIZED_ENTITY_INPUTS.get(1) - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizeEntitiesZalgoText(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - zalgoTextRunner(document -> - client.recognizeEntities(document).forEach( - categorizedEntity -> { - assertEquals(126, categorizedEntity.getOffset()); - }), - CATEGORIZED_ENTITY_INPUTS.get(1) - ); - } - - // Recognize Personally Identifiable Information entity - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizePiiEntitiesForTextInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - recognizePiiSingleDocumentRunner(document -> { - final PiiEntityCollection entities = client.recognizePiiEntities(document); - validatePiiEntities(getPiiEntitiesList1(), entities.stream().collect(Collectors.toList())); - }); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizePiiEntitiesForEmptyText(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - emptyTextRunner(document -> { - final TextAnalyticsException exception = assertThrows(TextAnalyticsException.class, () -> - client.recognizePiiEntities(document).iterator().hasNext()); - assertEquals(INVALID_DOCUMENT, exception.getErrorCode()); - }); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizePiiEntitiesForFaultyText(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - faultyTextRunner(document -> assertFalse(client.recognizePiiEntities(document).iterator().hasNext())); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizePiiEntitiesDuplicateIdInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - recognizeBatchPiiEntityDuplicateIdRunner(inputs -> { - final HttpResponseException response = assertThrows(HttpResponseException.class, - () -> client.recognizePiiEntitiesBatchWithResponse(inputs, null, Context.NONE)); - assertEquals(HttpURLConnection.HTTP_BAD_REQUEST, response.getResponse().getStatusCode()); - }); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizePiiEntitiesEmptyIdInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - textAnalyticsInputEmptyIdRunner(inputs -> { - final HttpResponseException httpResponseException = assertThrows(HttpResponseException.class, - () -> client.recognizePiiEntitiesBatchWithResponse(inputs, null, Context.NONE)); - assertEquals(400, httpResponseException.getResponse().getStatusCode()); - final TextAnalyticsError textAnalyticsError = (TextAnalyticsError) httpResponseException.getValue(); - assertEquals(INVALID_DOCUMENT, textAnalyticsError.getErrorCode()); - }); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizePiiEntitiesBatchInputSingleError(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - recognizeBatchPiiEntitySingleErrorRunner((inputs) -> { - Response response = client.recognizePiiEntitiesBatchWithResponse(inputs, null, Context.NONE); - response.getValue().forEach(recognizePiiEntitiesResult -> { - Exception exception = assertThrows(TextAnalyticsException.class, recognizePiiEntitiesResult::getEntities); - assertEquals(String.format(BATCH_ERROR_EXCEPTION_MESSAGE, "RecognizePiiEntitiesResult"), exception.getMessage()); - }); - }); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizePiiEntitiesForBatchInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - recognizeBatchPiiEntitiesRunner(inputs -> - validatePiiEntitiesResultCollectionWithResponse(false, getExpectedBatchPiiEntities(), 200, - client.recognizePiiEntitiesBatchWithResponse(inputs, null, Context.NONE))); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizePiiEntitiesForBatchInputShowStatistics(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - recognizeBatchPiiEntitiesShowStatsRunner((inputs, options) -> - validatePiiEntitiesResultCollectionWithResponse(true, getExpectedBatchPiiEntities(), 200, - client.recognizePiiEntitiesBatchWithResponse(inputs, options, Context.NONE))); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizePiiEntitiesForListLanguageHint(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - recognizePiiEntitiesLanguageHintRunner((inputs, language) -> - validatePiiEntitiesResultCollection(false, getExpectedBatchPiiEntities(), - client.recognizePiiEntitiesBatch(inputs, language, null)) - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizePiiEntitiesForListStringWithOptions(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - recognizeStringBatchPiiEntitiesShowStatsRunner((inputs, options) -> - validatePiiEntitiesResultCollection(true, getExpectedBatchPiiEntities(), - client.recognizePiiEntitiesBatch(inputs, null, options))); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizePiiEntitiesBatchTooManyDocuments(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - tooManyDocumentsRunner(inputs -> { - final HttpResponseException httpResponseException = assertThrows(HttpResponseException.class, - () -> client.recognizePiiEntitiesBatch(inputs, null, null).stream().findFirst().get()); - assertEquals(400, httpResponseException.getResponse().getStatusCode()); - final TextAnalyticsError textAnalyticsError = (TextAnalyticsError) httpResponseException.getValue(); - assertEquals(INVALID_DOCUMENT_BATCH, textAnalyticsError.getErrorCode()); - }); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizePiiEntitiesEmoji(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - emojiRunner(document -> { - final PiiEntityCollection result = client.recognizePiiEntities(document); - result.forEach(piiEntity -> { - assertEquals(8, piiEntity.getOffset()); - }); - }, PII_ENTITY_OFFSET_INPUT); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizePiiEntitiesEmojiWithSkinToneModifier(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - emojiWithSkinToneModifierRunner(document -> { - final PiiEntityCollection result = client.recognizePiiEntities(document); - result.forEach(piiEntity -> { - assertEquals(10, piiEntity.getOffset()); - }); - }, PII_ENTITY_OFFSET_INPUT); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizePiiEntitiesEmojiFamily(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - emojiFamilyRunner(document -> { - final PiiEntityCollection result = client.recognizePiiEntities(document); - result.forEach(piiEntity -> { - assertEquals(17, piiEntity.getOffset()); - }); - }, PII_ENTITY_OFFSET_INPUT); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizePiiEntitiesEmojiFamilyWIthSkinToneModifier(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - emojiFamilyWithSkinToneModifierRunner(document -> { - final PiiEntityCollection result = client.recognizePiiEntities(document); - result.forEach(piiEntity -> { - assertEquals(25, piiEntity.getOffset()); - }); - }, PII_ENTITY_OFFSET_INPUT); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizePiiEntitiesDiacriticsNfc(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - diacriticsNfcRunner(document -> { - final PiiEntityCollection result = client.recognizePiiEntities(document); - result.forEach(piiEntity -> { - assertEquals(9, piiEntity.getOffset()); - }); - }, PII_ENTITY_OFFSET_INPUT); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizePiiEntitiesDiacriticsNfd(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - diacriticsNfdRunner(document -> { - final PiiEntityCollection result = client.recognizePiiEntities(document); - result.forEach(piiEntity -> { - assertEquals(10, piiEntity.getOffset()); - }); - }, PII_ENTITY_OFFSET_INPUT); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizePiiEntitiesKoreanNfc(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - koreanNfcRunner(document -> { - final PiiEntityCollection result = client.recognizePiiEntities(document); - result.forEach(piiEntity -> { - assertEquals(8, piiEntity.getOffset()); - }); - }, PII_ENTITY_OFFSET_INPUT); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizePiiEntitiesKoreanNfd(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - koreanNfdRunner(document -> { - final PiiEntityCollection result = client.recognizePiiEntities(document); - result.forEach(piiEntity -> { - assertEquals(8, piiEntity.getOffset()); - }); - }, PII_ENTITY_OFFSET_INPUT); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizePiiEntitiesZalgoText(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - zalgoTextRunner(document -> { - final PiiEntityCollection result = client.recognizePiiEntities(document); - result.forEach(piiEntity -> { - assertEquals(121, piiEntity.getOffset()); - }); - }, PII_ENTITY_OFFSET_INPUT); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizePiiEntitiesForDomainFilter(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - recognizePiiDomainFilterRunner((document, options) -> { - final PiiEntityCollection entities = client.recognizePiiEntities(document, "en", options); - validatePiiEntities(Arrays.asList(getPiiEntitiesList1().get(1)), entities.stream().collect(Collectors.toList())); - }); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizePiiEntitiesForBatchInputStringForDomainFilter(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - recognizePiiLanguageHintRunner((inputs, language) -> { - final RecognizePiiEntitiesResultCollection response = client.recognizePiiEntitiesBatch(inputs, language, - new RecognizePiiEntityOptions().setDomainFilter(PiiEntityDomainType.PROTECTED_HEALTH_INFORMATION)); - validatePiiEntitiesResultCollection(false, getExpectedBatchPiiEntitiesForDomainFilter(), response); - }); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizePiiEntitiesForBatchInputForDomainFilter(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - recognizeBatchPiiEntitiesRunner((inputs) -> { - final Response response = client.recognizePiiEntitiesBatchWithResponse(inputs, - new RecognizePiiEntityOptions().setDomainFilter(PiiEntityDomainType.PROTECTED_HEALTH_INFORMATION), Context.NONE); - validatePiiEntitiesResultCollectionWithResponse(false, getExpectedBatchPiiEntitiesForDomainFilter(), 200, response); + assertEquals(EXCEEDED_ALLOWED_DOCUMENTS_LIMITS_MESSAGE, exception.getMessage()); + assertEquals(INVALID_DOCUMENT_BATCH, exception.getValue().toString()); }); } @@ -736,30 +303,28 @@ public void recognizePiiEntitiesForBatchInputForDomainFilter(HttpClient httpClie @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") public void recognizeLinkedEntitiesForTextInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsClient(httpClient, serviceVersion); - recognizeLinkedEntitiesForSingleTextInputRunner(input -> { - final List linkedEntities = client.recognizeLinkedEntities(input) - .stream().collect(Collectors.toList()); - validateLinkedEntity(getLinkedEntitiesList1().get(0), linkedEntities.get(0)); - }); + final LinkedEntityMatch linkedEntityMatch1 = new LinkedEntityMatch("Seattle", 0.0); + final LinkedEntity linkedEntity1 = new LinkedEntity("Seattle", + new IterableStream<>(Collections.singletonList(linkedEntityMatch1)), + "en", "Seattle", "https://en.wikipedia.org/wiki/Seattle", "Wikipedia"); + final List linkedEntities = client.recognizeLinkedEntities("I had a wonderful trip to Seattle last week.") + .stream().collect(Collectors.toList()); + validateLinkedEntity(linkedEntity1, linkedEntities.get(0)); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") public void recognizeLinkedEntitiesForEmptyText(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsClient(httpClient, serviceVersion); - emptyTextRunner(input -> { - final TextAnalyticsException exception = assertThrows(TextAnalyticsException.class, - () -> client.recognizeLinkedEntities(input).iterator().hasNext()); - assertEquals(INVALID_DOCUMENT, exception.getErrorCode()); - }); + TextAnalyticsException exception = assertThrows(TextAnalyticsException.class, () -> client.recognizeLinkedEntities("").iterator().hasNext()); + assertTrue(exception.getMessage().equals(INVALID_DOCUMENT_EXPECTED_EXCEPTION_MESSAGE)); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") public void recognizeLinkedEntitiesForFaultyText(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsClient(httpClient, serviceVersion); - faultyTextRunner(input -> - assertFalse(client.recognizeLinkedEntities(input).iterator().hasNext())); + assertFalse(client.recognizeLinkedEntities("!@#%%").iterator().hasNext()); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -767,25 +332,12 @@ public void recognizeLinkedEntitiesForFaultyText(HttpClient httpClient, TextAnal public void recognizeLinkedEntitiesDuplicateIdInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsClient(httpClient, serviceVersion); recognizeBatchLinkedEntityDuplicateIdRunner(inputs -> { - final HttpResponseException response = assertThrows(HttpResponseException.class, + HttpResponseException response = assertThrows(HttpResponseException.class, () -> client.recognizeLinkedEntitiesBatchWithResponse(inputs, null, Context.NONE)); assertEquals(HttpURLConnection.HTTP_BAD_REQUEST, response.getResponse().getStatusCode()); }); } - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizeLinkedEntitiesEmptyIdInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - textAnalyticsInputEmptyIdRunner(inputs -> { - final HttpResponseException httpResponseException = assertThrows(HttpResponseException.class, - () -> client.recognizeLinkedEntitiesBatchWithResponse(inputs, null, Context.NONE)); - assertEquals(400, httpResponseException.getResponse().getStatusCode()); - final TextAnalyticsError textAnalyticsError = (TextAnalyticsError) httpResponseException.getValue(); - assertEquals(INVALID_DOCUMENT, textAnalyticsError.getErrorCode()); - }); - } - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") public void recognizeLinkedEntitiesForBatchInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { @@ -831,168 +383,38 @@ public void recognizeLinkedEntitiesForListStringWithOptions(HttpClient httpClien @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizeLinkedEntitiesBatchTooManyDocuments(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { + public void recognizeLinkedEntitiesTooManyDocuments(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsClient(httpClient, serviceVersion); - tooManyDocumentsRunner(inputs -> { - final HttpResponseException httpResponseException = assertThrows(HttpResponseException.class, + recognizeLinkedEntitiesTooManyDocumentsRunner(inputs -> { + HttpResponseException exception = assertThrows(HttpResponseException.class, () -> client.recognizeLinkedEntitiesBatch(inputs, null, null).stream().findFirst().get()); - assertEquals(400, httpResponseException.getResponse().getStatusCode()); - final TextAnalyticsError textAnalyticsError = (TextAnalyticsError) httpResponseException.getValue(); - assertEquals(INVALID_DOCUMENT_BATCH, textAnalyticsError.getErrorCode()); + assertEquals(EXCEEDED_ALLOWED_DOCUMENTS_LIMITS_MESSAGE, exception.getMessage()); + assertEquals(INVALID_DOCUMENT_BATCH, exception.getValue().toString()); }); } - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizeLinkedEntitiesEmoji(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - emojiRunner(document -> - client.recognizeLinkedEntities(document).forEach( - linkedEntity -> linkedEntity.getMatches().forEach( - linkedEntityMatch -> { - assertEquals(13, linkedEntityMatch.getOffset()); - })), - LINKED_ENTITY_INPUTS.get(1) - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizeLinkedEntitiesEmojiWithSkinToneModifier(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - emojiWithSkinToneModifierRunner(document -> - client.recognizeLinkedEntities(document).forEach( - linkedEntity -> linkedEntity.getMatches().forEach( - linkedEntityMatch -> { - assertEquals(15, linkedEntityMatch.getOffset()); - })), - LINKED_ENTITY_INPUTS.get(1) - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizeLinkedEntitiesEmojiFamily(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - emojiFamilyRunner(document -> - client.recognizeLinkedEntities(document).forEach( - linkedEntity -> linkedEntity.getMatches().forEach( - linkedEntityMatch -> { - assertEquals(22, linkedEntityMatch.getOffset()); - })), - LINKED_ENTITY_INPUTS.get(1) - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizeLinkedEntitiesEmojiFamilyWIthSkinToneModifier(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - emojiFamilyWithSkinToneModifierRunner(document -> - client.recognizeLinkedEntities(document).forEach(linkedEntity -> - linkedEntity.getMatches().forEach(linkedEntityMatch -> { - assertEquals(30, linkedEntityMatch.getOffset()); - })), - LINKED_ENTITY_INPUTS.get(1) - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizeLinkedEntitiesDiacriticsNfc(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - diacriticsNfcRunner(document -> - client.recognizeLinkedEntities(document).forEach( - linkedEntity -> linkedEntity.getMatches().forEach( - linkedEntityMatch -> { - assertEquals(14, linkedEntityMatch.getOffset()); - })), - LINKED_ENTITY_INPUTS.get(1) - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizeLinkedEntitiesDiacriticsNfd(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - diacriticsNfdRunner(document -> - client.recognizeLinkedEntities(document).forEach( - linkedEntity -> linkedEntity.getMatches().forEach( - linkedEntityMatch -> { - assertEquals(15, linkedEntityMatch.getOffset()); - })), - LINKED_ENTITY_INPUTS.get(1) - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizeLinkedEntitiesKoreanNfc(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - koreanNfcRunner(document -> - client.recognizeLinkedEntities(document).forEach( - linkedEntity -> linkedEntity.getMatches().forEach( - linkedEntityMatch -> { - assertEquals(13, linkedEntityMatch.getOffset()); - })), - LINKED_ENTITY_INPUTS.get(1) - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizeLinkedEntitiesKoreanNfd(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - koreanNfdRunner(document -> - client.recognizeLinkedEntities(document).forEach( - linkedEntity -> linkedEntity.getMatches().forEach( - linkedEntityMatch -> { - assertEquals(13, linkedEntityMatch.getOffset()); - })), - LINKED_ENTITY_INPUTS.get(1)); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void recognizeLinkedEntitiesZalgoText(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - zalgoTextRunner(document -> - client.recognizeLinkedEntities(document).forEach( - linkedEntity -> - linkedEntity.getMatches().forEach(linkedEntityMatch -> { - assertEquals(126, linkedEntityMatch.getOffset()); - })), - LINKED_ENTITY_INPUTS.get(1) - ); - } - // Extract key phrase @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") public void extractKeyPhrasesForTextInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsClient(httpClient, serviceVersion); - extractKeyPhrasesForSingleTextInputRunner(input -> - assertEquals("monde", - client.extractKeyPhrases(input).iterator().next())); + assertEquals("monde", client.extractKeyPhrases("Bonjour tout le monde.").iterator().next()); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") public void extractKeyPhrasesForEmptyText(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsClient(httpClient, serviceVersion); - emptyTextRunner(input -> { - final TextAnalyticsException exception = assertThrows(TextAnalyticsException.class, - () -> client.extractKeyPhrases(input).iterator().hasNext()); - assertEquals(INVALID_DOCUMENT, exception.getErrorCode()); - }); + Exception exception = assertThrows(TextAnalyticsException.class, () -> client.extractKeyPhrases("").iterator().hasNext()); + assertTrue(exception.getMessage().equals(INVALID_DOCUMENT_EXPECTED_EXCEPTION_MESSAGE)); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") public void extractKeyPhrasesForFaultyText(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsClient(httpClient, serviceVersion); - faultyTextRunner(input -> assertFalse(client.extractKeyPhrases(input).iterator().hasNext())); + assertFalse(client.extractKeyPhrases("!@#%%").iterator().hasNext()); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -1000,25 +422,12 @@ public void extractKeyPhrasesForFaultyText(HttpClient httpClient, TextAnalyticsS public void extractKeyPhrasesDuplicateIdInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsClient(httpClient, serviceVersion); extractBatchKeyPhrasesDuplicateIdRunner(inputs -> { - final HttpResponseException response = assertThrows(HttpResponseException.class, + HttpResponseException response = assertThrows(HttpResponseException.class, () -> client.extractKeyPhrasesBatchWithResponse(inputs, null, Context.NONE)); assertEquals(HttpURLConnection.HTTP_BAD_REQUEST, response.getResponse().getStatusCode()); }); } - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void extractKeyPhrasesEmptyIdInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - textAnalyticsInputEmptyIdRunner(inputs -> { - final HttpResponseException httpResponseException = assertThrows(HttpResponseException.class, - () -> client.extractKeyPhrasesBatchWithResponse(inputs, null, Context.NONE)); - assertEquals(400, httpResponseException.getResponse().getStatusCode()); - final TextAnalyticsError textAnalyticsError = (TextAnalyticsError) httpResponseException.getValue(); - assertEquals(INVALID_DOCUMENT, textAnalyticsError.getErrorCode()); - }); - } - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") public void extractKeyPhrasesForBatchInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { @@ -1085,19 +494,6 @@ public void extractKeyPhrasesBatchWarning(HttpClient httpClient, TextAnalyticsSe )); } - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void extractKeyPhrasesBatchTooManyDocuments(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - tooManyDocumentsRunner(inputs -> { - final HttpResponseException httpResponseException = assertThrows(HttpResponseException.class, - () -> client.extractKeyPhrasesBatch(inputs, null, null).stream().findFirst().get()); - assertEquals(400, httpResponseException.getResponse().getStatusCode()); - final TextAnalyticsError textAnalyticsError = (TextAnalyticsError) httpResponseException.getValue(); - assertEquals(INVALID_DOCUMENT_BATCH, textAnalyticsError.getErrorCode()); - }); - } - // Sentiment /** @@ -1107,36 +503,17 @@ public void extractKeyPhrasesBatchTooManyDocuments(HttpClient httpClient, TextAn @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") public void analyzeSentimentForTextInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsClient(httpClient, serviceVersion); - analyzeSentimentForSingleTextInputRunner(input -> { - validateAnalyzedSentiment(false, getExpectedDocumentSentiment(), client.analyzeSentiment(input)); - }); - } - - /** - * Test analyzing sentiment for a string input with default language hint. - */ - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void analyzeSentimentForTextInputWithDefaultLanguageHint(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - analyzeSentimentForSingleTextInputRunner(input -> { - final DocumentSentiment analyzeSentimentResult = client.analyzeSentiment(input, null); - validateAnalyzedSentiment(false, getExpectedDocumentSentiment(), analyzeSentimentResult); - }); - } + final DocumentSentiment expectedDocumentSentiment = new DocumentSentiment( + TextSentiment.MIXED, + new SentimentConfidenceScores(0.0, 0.0, 0.0), + new IterableStream<>(Arrays.asList( + new SentenceSentiment("", TextSentiment.NEGATIVE, new SentimentConfidenceScores(0.0, 0.0, 0.0)), + new SentenceSentiment("", TextSentiment.POSITIVE, new SentimentConfidenceScores(0.0, 0.0, 0.0)) + )), null); + DocumentSentiment analyzeSentimentResult = + client.analyzeSentiment("The hotel was dark and unclean. The restaurant had amazing gnocchi."); - /** - * Test analyzing sentiment for a string input and verifying the result of opinion mining. - */ - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void analyzeSentimentForTextInputWithOpinionMining(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - analyzeSentimentForTextInputWithOpinionMiningRunner((input, options) -> { - final DocumentSentiment analyzeSentimentResult = - client.analyzeSentiment(input, "en", options); - validateAnalyzedSentiment(true, getExpectedDocumentSentiment(), analyzeSentimentResult); - }); + validateAnalyzedSentiment(expectedDocumentSentiment, analyzeSentimentResult); } /** @@ -1146,11 +523,8 @@ public void analyzeSentimentForTextInputWithOpinionMining(HttpClient httpClient, @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") public void analyzeSentimentForEmptyText(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsClient(httpClient, serviceVersion); - emptyTextRunner(document -> { - final TextAnalyticsException exception = assertThrows(TextAnalyticsException.class, - () -> client.analyzeSentiment(document)); - assertEquals(INVALID_DOCUMENT, exception.getErrorCode()); - }); + Exception exception = assertThrows(TextAnalyticsException.class, () -> client.analyzeSentiment("")); + assertTrue(exception.getMessage().equals(INVALID_DOCUMENT_EXPECTED_EXCEPTION_MESSAGE)); } /** @@ -1160,16 +534,16 @@ public void analyzeSentimentForEmptyText(HttpClient httpClient, TextAnalyticsSer @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") public void analyzeSentimentForFaultyText(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsClient(httpClient, serviceVersion); - faultyTextRunner(input -> { - final DocumentSentiment expectedDocumentSentiment = new DocumentSentiment( - TextSentiment.NEUTRAL, - new SentimentConfidenceScores(0.0, 0.0, 0.0), - new IterableStream<>(Arrays.asList( - new SentenceSentiment("!", TextSentiment.NEUTRAL, new SentimentConfidenceScores(0.0, 0.0, 0.0), null, 0), - new SentenceSentiment("@#%%", TextSentiment.NEUTRAL, new SentimentConfidenceScores(0.0, 0.0, 0.0), null, 1) - )), null); - validateAnalyzedSentiment(false, expectedDocumentSentiment, client.analyzeSentiment(input)); - }); + final DocumentSentiment expectedDocumentSentiment = new DocumentSentiment(TextSentiment.NEUTRAL, + new SentimentConfidenceScores(0.0, 0.0, 0.0), + new IterableStream<>(Arrays.asList( + new SentenceSentiment("", TextSentiment.NEUTRAL, new SentimentConfidenceScores(0.0, 0.0, 0.0)), + new SentenceSentiment("", TextSentiment.NEUTRAL, new SentimentConfidenceScores(0.0, 0.0, 0.0)) + )), null); + + DocumentSentiment analyzeSentimentResult = client.analyzeSentiment("!@#%%"); + + validateAnalyzedSentiment(expectedDocumentSentiment, analyzeSentimentResult); } /** @@ -1180,339 +554,69 @@ public void analyzeSentimentForFaultyText(HttpClient httpClient, TextAnalyticsSe public void analyzeSentimentDuplicateIdInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsClient(httpClient, serviceVersion); analyzeBatchSentimentDuplicateIdRunner(inputs -> { - final HttpResponseException response = assertThrows(HttpResponseException.class, - () -> client.analyzeSentimentBatchWithResponse(inputs, new TextAnalyticsRequestOptions(), Context.NONE)); - assertEquals(HttpURLConnection.HTTP_BAD_REQUEST, response.getResponse().getStatusCode()); - }); - } - - /** - * Verifies that an invalid document exception is returned for input documents with an empty ID. - */ - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void analyzeSentimentEmptyIdInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - textAnalyticsInputEmptyIdRunner(inputs -> { - final HttpResponseException httpResponseException = assertThrows(HttpResponseException.class, + HttpResponseException response = assertThrows(HttpResponseException.class, () -> client.analyzeSentimentBatchWithResponse(inputs, null, Context.NONE)); - assertEquals(400, httpResponseException.getResponse().getStatusCode()); - TextAnalyticsError textAnalyticsError = (TextAnalyticsError) httpResponseException.getValue(); - assertEquals(INVALID_DOCUMENT, textAnalyticsError.getErrorCode()); + assertEquals(HttpURLConnection.HTTP_BAD_REQUEST, response.getResponse().getStatusCode()); }); } /** - * Verify that the collection result excludes request statistics and mined options when given a batch of - * String documents with null TextAnalyticsRequestOptions and null language code which will use the default language - * code, 'en'. - * - * {@link TextAnalyticsClient#analyzeSentimentBatch(Iterable, String, TextAnalyticsRequestOptions)} - * which TextAnalyticsRequestOptions is null and null language code which will use the default language code, 'en'. + * Test analyzing sentiment for a list of string input. */ @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") public void analyzeSentimentForBatchStringInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsClient(httpClient, serviceVersion); analyzeSentimentStringInputRunner(inputs -> - validateSentimentResultCollection(false, false, getExpectedBatchTextSentiment(), - client.analyzeSentimentBatch(inputs, null, new TextAnalyticsRequestOptions()))); + validateSentimentResultCollection(false, getExpectedBatchTextSentiment(), + client.analyzeSentimentBatch(inputs, null, null))); } /** - * Verify that the collection result excludes request statistics and mined options when given a batch of - * String documents with null TextAnalyticsRequestOptions and given a language code. - * - * {@link TextAnalyticsClient#analyzeSentimentBatch(Iterable, String, TextAnalyticsRequestOptions)} - * which TextAnalyticsRequestOptions is null and given a language code. + * Test analyzing sentiment for a list of string input with language code. */ @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void analyzeSentimentForListStringWithLanguageHint(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { + public void analyzeSentimentForListLanguageHint(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsClient(httpClient, serviceVersion); analyzeSentimentLanguageHintRunner((inputs, language) -> - validateSentimentResultCollection(false, false, getExpectedBatchTextSentiment(), - client.analyzeSentimentBatch(inputs, language, new TextAnalyticsRequestOptions()))); - } - - /** - * Verify that the collection result includes request statistics but not mined options when given a batch of - * String documents with AnalyzeSentimentOptions. - * - * {@link TextAnalyticsClient#analyzeSentimentBatch(Iterable, String, AnalyzeSentimentOptions)} - * which to show the request statistics only and verify the analyzed sentiment result. - */ - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void analyzeSentimentForListStringShowStatisticsExcludeOpinionMining(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - analyzeBatchStringSentimentShowStatsAndIncludeOpinionMiningRunner((inputs, options) -> - validateSentimentResultCollection(true, false, getExpectedBatchTextSentiment(), - client.analyzeSentimentBatch(inputs, null, options.setIncludeOpinionMining(false)))); - } - - /** - * Verify that the collection result includes mined options but not request statistics when given a batch of - * String documents with AnalyzeSentimentOptions. - * - * {@link TextAnalyticsClient#analyzeSentimentBatch(Iterable, String, AnalyzeSentimentOptions)} - * which AnalyzeSentimentOptions includes opinion mining and request statistics. - */ - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void analyzeSentimentForListStringNotShowStatisticsButIncludeOpinionMining(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - analyzeBatchStringSentimentShowStatsAndIncludeOpinionMiningRunner((inputs, options) -> { - options.setIncludeStatistics(false); - validateSentimentResultCollection(false, true, getExpectedBatchTextSentiment(), - client.analyzeSentimentBatch(inputs, null, options)); - }); + validateSentimentResultCollection(false, getExpectedBatchTextSentiment(), + client.analyzeSentimentBatch(inputs, language, null))); } /** - * Verify that the collection result includes mined options and request statistics when given a batch of - * String documents with AnalyzeSentimentOptions. - * - * {@link TextAnalyticsClient#analyzeSentimentBatch(Iterable, String, AnalyzeSentimentOptions)} - * which AnalyzeSentimentOptions includes opinion mining and request statistics. + * Verify that we can get statistics on the collection result when given a batch of documents with request options. */ @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void analyzeSentimentForListStringShowStatisticsAndIncludeOpinionMining(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { + public void analyzeSentimentForListStringWithOptions(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsClient(httpClient, serviceVersion); - analyzeBatchStringSentimentShowStatsAndIncludeOpinionMiningRunner((inputs, options) -> - validateSentimentResultCollection(true, true, getExpectedBatchTextSentiment(), + analyzeBatchStringSentimentShowStatsRunner((inputs, options) -> + validateSentimentResultCollection(true, getExpectedBatchTextSentiment(), client.analyzeSentimentBatch(inputs, null, options))); } /** - * Verify that the collection result excludes request statistics and mined options when given a batch of - * TextDocumentInput documents with null TextAnalyticsRequestOptions. - * - * {@link TextAnalyticsClient#analyzeSentimentBatchWithResponse(Iterable, TextAnalyticsRequestOptions, Context)} - * which TextAnalyticsRequestOptions is null. + * Test analyzing sentiment for batch of documents. */ @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void analyzeSentimentForBatchInputWithNullRequestOptions(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { + public void analyzeSentimentForBatchInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsClient(httpClient, serviceVersion); analyzeBatchSentimentRunner(inputs -> - validateSentimentResultCollectionWithResponse(false, false, getExpectedBatchTextSentiment(), 200, - client.analyzeSentimentBatchWithResponse(inputs, (TextAnalyticsRequestOptions) null, Context.NONE))); + validateSentimentResultCollectionWithResponse(false, getExpectedBatchTextSentiment(), 200, + client.analyzeSentimentBatchWithResponse(inputs, null, Context.NONE))); } /** - * Verify that we can get statistics on the collection result when given a batch of - * TextDocumentInput documents with TextAnalyticsRequestOptions. - * - * {@link TextAnalyticsClient#analyzeSentimentBatchWithResponse(Iterable, TextAnalyticsRequestOptions, Context)} - * which TextAnalyticsRequestOptions includes request statistics. + * Verify that we can get statistics on the collection result when given a batch of documents with request options. */ @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") public void analyzeSentimentForBatchInputShowStatistics(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsClient(httpClient, serviceVersion); - analyzeBatchSentimentShowStatsRunner((inputs, requestOptions) -> - validateSentimentResultCollectionWithResponse(true, false, getExpectedBatchTextSentiment(), 200, - client.analyzeSentimentBatchWithResponse(inputs, requestOptions, Context.NONE))); - } - - /** - * Verify that the collection result excludes request statistics and mined options when given a batch of - * TextDocumentInput documents with null AnalyzeSentimentOptions. - * - * {@link TextAnalyticsClient#analyzeSentimentBatchWithResponse(Iterable, AnalyzeSentimentOptions, Context)} - * which AnalyzeSentimentOptions is null. - */ - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void analyzeSentimentForBatchInputWithNullAnalyzeSentimentOptions(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - analyzeBatchSentimentOpinionMining((inputs, options) -> - validateSentimentResultCollectionWithResponse(false, false, getExpectedBatchTextSentiment(), 200, - client.analyzeSentimentBatchWithResponse(inputs, (AnalyzeSentimentOptions) null, Context.NONE))); - } - - /** - * Verify that the collection result includes request statistics but not mined options when given a batch of - * TextDocumentInput documents with AnalyzeSentimentOptions. - * - * {@link TextAnalyticsClient#analyzeSentimentBatchWithResponse(Iterable, AnalyzeSentimentOptions, Context)} - * which AnalyzeSentimentOptions includes request statistics but not opinion mining. - */ - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void analyzeSentimentForBatchInputShowStatisticsExcludeOpinionMining(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - analyzeBatchSentimentOpinionMining((inputs, options) -> - validateSentimentResultCollectionWithResponse(true, false, getExpectedBatchTextSentiment(), 200, - client.analyzeSentimentBatchWithResponse(inputs, options.setIncludeOpinionMining(false), Context.NONE))); - } - - /** - * Verify that the collection result includes mined options but not request statistics when given a batch of - * TextDocumentInput documents with AnalyzeSentimentOptions. - * - * {@link TextAnalyticsClient#analyzeSentimentBatchWithResponse(Iterable, AnalyzeSentimentOptions, Context)} - * which AnalyzeSentimentOptions includes opinion mining but not request statistics. - */ - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void analyzeSentimentForBatchInputNotShowStatisticsButIncludeOpinionMining(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - analyzeBatchSentimentOpinionMining((inputs, options) -> { - options.setIncludeStatistics(false); - validateSentimentResultCollectionWithResponse(false, true, getExpectedBatchTextSentiment(), 200, - client.analyzeSentimentBatchWithResponse(inputs, options, Context.NONE)); - }); - } - - /** - * Verify that the collection result includes mined options and request statistics when given a batch of - * TextDocumentInput documents with AnalyzeSentimentOptions. - * - * {@link TextAnalyticsClient#analyzeSentimentBatchWithResponse(Iterable, AnalyzeSentimentOptions, Context)} - * which AnalyzeSentimentOptions includes opinion mining and request statistics. - */ - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void analyzeSentimentForBatchInputShowStatisticsAndIncludeOpinionMining(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - analyzeBatchSentimentOpinionMining((inputs, options) -> - validateSentimentResultCollectionWithResponse(true, true, getExpectedBatchTextSentiment(), 200, + analyzeBatchSentimentShowStatsRunner((inputs, options) -> + validateSentimentResultCollectionWithResponse(true, getExpectedBatchTextSentiment(), 200, client.analyzeSentimentBatchWithResponse(inputs, options, Context.NONE))); } - - /** - * Verifies that an InvalidDocumentBatch exception is returned for input documents with too many documents. - */ - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void analyzeSentimentBatchTooManyDocuments(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - tooManyDocumentsRunner(inputs -> { - final HttpResponseException httpResponseException = assertThrows(HttpResponseException.class, - () -> client.analyzeSentimentBatch(inputs, null, null).stream().findFirst().get()); - assertEquals(400, httpResponseException.getResponse().getStatusCode()); - final TextAnalyticsError textAnalyticsError = (TextAnalyticsError) httpResponseException.getValue(); - assertEquals(INVALID_DOCUMENT_BATCH, textAnalyticsError.getErrorCode()); - }); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void analyzeSentimentEmoji(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - emojiRunner(document -> - client.analyzeSentiment(document).getSentences().forEach( - sentenceSentiment -> { - assertEquals(0, sentenceSentiment.getOffset()); - }), - SENTIMENT_OFFSET_INPUT - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void analyzeSentimentEmojiWithSkinToneModifier(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - emojiWithSkinToneModifierRunner(document -> - client.analyzeSentiment(document).getSentences().forEach( - sentenceSentiment -> { - assertEquals(0, sentenceSentiment.getOffset()); - }), - SENTIMENT_OFFSET_INPUT - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void analyzeSentimentEmojiFamily(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - emojiFamilyRunner(document -> - client.analyzeSentiment(document).getSentences().forEach( - sentenceSentiment -> { - assertEquals(0, sentenceSentiment.getOffset()); - }), - SENTIMENT_OFFSET_INPUT - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void analyzeSentimentEmojiFamilyWithSkinToneModifier(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - emojiFamilyWithSkinToneModifierRunner(document -> - client.analyzeSentiment(document).getSentences().forEach( - sentenceSentiment -> { - assertEquals(0, sentenceSentiment.getOffset()); - }), - SENTIMENT_OFFSET_INPUT - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void analyzeSentimentDiacriticsNfc(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - diacriticsNfcRunner(document -> - client.analyzeSentiment(document).getSentences().forEach( - sentenceSentiment -> { - assertEquals(0, sentenceSentiment.getOffset()); - }), - SENTIMENT_OFFSET_INPUT - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void analyzeSentimentDiacriticsNfd(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - diacriticsNfdRunner(document -> - client.analyzeSentiment(document).getSentences().forEach( - sentenceSentiment -> { - assertEquals(0, sentenceSentiment.getOffset()); - }), - SENTIMENT_OFFSET_INPUT - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void analyzeSentimentKoreanNfc(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - koreanNfcRunner(document -> - client.analyzeSentiment(document).getSentences().forEach( - sentenceSentiment -> { - assertEquals(0, sentenceSentiment.getOffset()); - }), - SENTIMENT_OFFSET_INPUT - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void analyzeSentimentKoreanNfd(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - koreanNfdRunner(document -> - client.analyzeSentiment(document).getSentences().forEach( - sentenceSentiment -> { - assertEquals(0, sentenceSentiment.getOffset()); - }), - SENTIMENT_OFFSET_INPUT - ); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") - public void analyzeSentimentZalgoText(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { - client = getTextAnalyticsClient(httpClient, serviceVersion); - zalgoTextRunner(document -> - client.analyzeSentiment(document).getSentences().forEach( - sentenceSentiment -> { - assertEquals(0, sentenceSentiment.getOffset()); - }), - SENTIMENT_OFFSET_INPUT - ); - } } diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsClientTestBase.java b/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsClientTestBase.java index 28c554b4e8f61..f4fcfcd46bd3f 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsClientTestBase.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsClientTestBase.java @@ -3,20 +3,12 @@ package com.azure.ai.textanalytics; -import com.azure.ai.textanalytics.models.AnalyzeSentimentOptions; -import com.azure.ai.textanalytics.models.AspectSentiment; import com.azure.ai.textanalytics.models.CategorizedEntity; import com.azure.ai.textanalytics.models.DetectLanguageInput; import com.azure.ai.textanalytics.models.DetectedLanguage; import com.azure.ai.textanalytics.models.DocumentSentiment; import com.azure.ai.textanalytics.models.LinkedEntity; import com.azure.ai.textanalytics.models.LinkedEntityMatch; -import com.azure.ai.textanalytics.models.MinedOpinion; -import com.azure.ai.textanalytics.models.OpinionSentiment; -import com.azure.ai.textanalytics.models.PiiEntity; -import com.azure.ai.textanalytics.models.PiiEntityCollection; -import com.azure.ai.textanalytics.models.PiiEntityDomainType; -import com.azure.ai.textanalytics.models.RecognizePiiEntityOptions; import com.azure.ai.textanalytics.models.SentenceSentiment; import com.azure.ai.textanalytics.models.TextAnalyticsError; import com.azure.ai.textanalytics.models.TextAnalyticsRequestOptions; @@ -29,7 +21,6 @@ import com.azure.ai.textanalytics.util.ExtractKeyPhrasesResultCollection; import com.azure.ai.textanalytics.util.RecognizeEntitiesResultCollection; import com.azure.ai.textanalytics.util.RecognizeLinkedEntitiesResultCollection; -import com.azure.ai.textanalytics.util.RecognizePiiEntitiesResultCollection; import com.azure.core.credential.AzureKeyCredential; import com.azure.core.http.HttpClient; import com.azure.core.http.policy.HttpLogDetailLevel; @@ -56,7 +47,6 @@ import static com.azure.ai.textanalytics.TestUtils.FAKE_API_KEY; import static com.azure.ai.textanalytics.TestUtils.KEY_PHRASE_INPUTS; import static com.azure.ai.textanalytics.TestUtils.LINKED_ENTITY_INPUTS; -import static com.azure.ai.textanalytics.TestUtils.PII_ENTITY_INPUTS; import static com.azure.ai.textanalytics.TestUtils.SENTIMENT_INPUTS; import static com.azure.ai.textanalytics.TestUtils.TOO_LONG_INPUT; import static com.azure.ai.textanalytics.TestUtils.getDuplicateTextDocumentInputs; @@ -66,9 +56,13 @@ import static org.junit.jupiter.api.Assertions.assertNull; public abstract class TextAnalyticsClientTestBase extends TestBase { - static final String BATCH_ERROR_EXCEPTION_MESSAGE = "Error in accessing the property on document id: 2, when %s returned with an error: Document text is empty. ErrorCodeValue: {InvalidDocument}"; + static final String BATCH_ERROR_EXCEPTION_MESSAGE = "Error in accessing the property on document id: 2, when RecognizeEntitiesResult returned with an error: Document text is empty. ErrorCodeValue: {invalidDocument}"; + static final String EXCEEDED_ALLOWED_DOCUMENTS_LIMITS_MESSAGE = "The number of documents in the request have exceeded the data limitations. See https://aka.ms/text-analytics-data-limits for additional information"; + static final String INVALID_COUNTRY_HINT_EXPECTED_EXCEPTION_MESSAGE = "Country hint is not valid. Please specify an ISO 3166-1 alpha-2 two letter country code. ErrorCodeValue: {invalidCountryHint}"; + static final String INVALID_DOCUMENT_BATCH = "invalidDocumentBatch"; static final String INVALID_DOCUMENT_BATCH_NPE_MESSAGE = "'documents' cannot be null."; static final String INVALID_DOCUMENT_EMPTY_LIST_EXCEPTION_MESSAGE = "'documents' cannot be empty."; + static final String INVALID_DOCUMENT_EXPECTED_EXCEPTION_MESSAGE = "Document text is empty. ErrorCodeValue: {invalidDocument}"; static final String INVALID_DOCUMENT_NPE_MESSAGE = "'document' cannot be null."; static final String WARNING_TOO_LONG_DOCUMENT_INPUT_MESSAGE = "The document contains very long words (longer than 64 characters). These words will be truncated and may result in unreliable model predictions."; @@ -82,12 +76,6 @@ public abstract class TextAnalyticsClientTestBase extends TestBase { @Test abstract void detectLanguageFaultyText(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); - @Test - abstract void detectLanguageDuplicateIdInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); - - @Test - abstract void detectLanguageEmptyIdInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); - @Test abstract void detectLanguagesBatchInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); @@ -107,12 +95,6 @@ public abstract class TextAnalyticsClientTestBase extends TestBase { @Test abstract void recognizeEntitiesForFaultyText(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); - @Test - abstract void recognizeEntitiesDuplicateIdInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); - - @Test - abstract void recognizeEntitiesEmptyIdInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); - @Test abstract void recognizeEntitiesBatchInputSingleError(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); @@ -126,47 +108,7 @@ public abstract class TextAnalyticsClientTestBase extends TestBase { abstract void recognizeEntitiesForListLanguageHint(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); @Test - abstract void recognizeEntitiesBatchTooManyDocuments(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); - - // Personally Identifiable Information Entities - @Test - abstract void recognizePiiEntitiesForTextInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); - - @Test - abstract void recognizePiiEntitiesForEmptyText(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); - - @Test - abstract void recognizePiiEntitiesForFaultyText(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); - - @Test - abstract void recognizePiiEntitiesDuplicateIdInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); - - @Test - abstract void recognizePiiEntitiesEmptyIdInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); - - @Test - abstract void recognizePiiEntitiesBatchInputSingleError(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); - - @Test - abstract void recognizePiiEntitiesForBatchInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); - - @Test - abstract void recognizePiiEntitiesForBatchInputShowStatistics(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); - - @Test - abstract void recognizePiiEntitiesForListLanguageHint(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); - - @Test - abstract void recognizePiiEntitiesBatchTooManyDocuments(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); - - @Test - abstract void recognizePiiEntitiesForDomainFilter(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); - - @Test - abstract void recognizePiiEntitiesForBatchInputStringForDomainFilter(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); - - @Test - abstract void recognizePiiEntitiesForBatchInputForDomainFilter(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); + abstract void recognizeEntitiesTooManyDocuments(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); // Linked Entities @Test @@ -178,12 +120,6 @@ public abstract class TextAnalyticsClientTestBase extends TestBase { @Test abstract void recognizeLinkedEntitiesForFaultyText(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); - @Test - abstract void recognizeLinkedEntitiesDuplicateIdInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); - - @Test - abstract void recognizeLinkedEntitiesEmptyIdInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); - @Test abstract void recognizeLinkedEntitiesForBatchInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); @@ -194,7 +130,7 @@ public abstract class TextAnalyticsClientTestBase extends TestBase { abstract void recognizeLinkedEntitiesForListLanguageHint(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); @Test - abstract void recognizeLinkedEntitiesBatchTooManyDocuments(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); + abstract void recognizeLinkedEntitiesTooManyDocuments(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); // Key Phrases @Test @@ -206,12 +142,6 @@ public abstract class TextAnalyticsClientTestBase extends TestBase { @Test abstract void extractKeyPhrasesForFaultyText(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); - @Test - abstract void extractKeyPhrasesDuplicateIdInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); - - @Test - abstract void extractKeyPhrasesEmptyIdInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); - @Test abstract void extractKeyPhrasesForBatchInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); @@ -227,19 +157,10 @@ public abstract class TextAnalyticsClientTestBase extends TestBase { @Test abstract void extractKeyPhrasesBatchWarning(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); - @Test - abstract void extractKeyPhrasesBatchTooManyDocuments(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); - // Sentiment @Test abstract void analyzeSentimentForTextInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); - @Test - abstract void analyzeSentimentForTextInputWithDefaultLanguageHint(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); - - @Test - abstract void analyzeSentimentForTextInputWithOpinionMining(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); - @Test abstract void analyzeSentimentForEmptyText(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); @@ -247,46 +168,16 @@ public abstract class TextAnalyticsClientTestBase extends TestBase { abstract void analyzeSentimentForFaultyText(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); @Test - abstract void analyzeSentimentDuplicateIdInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); - - @Test - abstract void analyzeSentimentEmptyIdInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); - - @Test - abstract void analyzeSentimentForBatchStringInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); - - @Test - abstract void analyzeSentimentForListStringWithLanguageHint(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); - - @Test - abstract void analyzeSentimentForListStringShowStatisticsExcludeOpinionMining(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); - - @Test - abstract void analyzeSentimentForListStringNotShowStatisticsButIncludeOpinionMining(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); - - @Test - abstract void analyzeSentimentForListStringShowStatisticsAndIncludeOpinionMining(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); - - @Test - abstract void analyzeSentimentForBatchInputWithNullRequestOptions(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); + abstract void analyzeSentimentForBatchInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); @Test abstract void analyzeSentimentForBatchInputShowStatistics(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); @Test - abstract void analyzeSentimentForBatchInputWithNullAnalyzeSentimentOptions(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); - - @Test - abstract void analyzeSentimentForBatchInputShowStatisticsExcludeOpinionMining(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); - - @Test - abstract void analyzeSentimentForBatchInputNotShowStatisticsButIncludeOpinionMining(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); - - @Test - abstract void analyzeSentimentForBatchInputShowStatisticsAndIncludeOpinionMining(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); + abstract void analyzeSentimentForBatchStringInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); @Test - abstract void analyzeSentimentBatchTooManyDocuments(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); + abstract void analyzeSentimentForListLanguageHint(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion); // Detect Language runner void detectLanguageShowStatisticsRunner(BiConsumer, @@ -320,27 +211,7 @@ void detectLanguageRunner(Consumer> testRunner) { testRunner.accept(TestUtils.getDetectLanguageInputs()); } - void detectSingleTextLanguageRunner(Consumer testRunner) { - testRunner.accept(DETECT_LANGUAGE_INPUTS.get(0)); - } - - void detectLanguageInvalidCountryHintRunner(BiConsumer testRunner) { - testRunner.accept(DETECT_LANGUAGE_INPUTS.get(1), "en"); - } - - void detectLanguageEmptyCountryHintRunner(BiConsumer testRunner) { - testRunner.accept(DETECT_LANGUAGE_INPUTS.get(1), ""); - } - - void detectLanguageNoneCountryHintRunner(BiConsumer testRunner) { - testRunner.accept(DETECT_LANGUAGE_INPUTS.get(1), "none"); - } - // Categorized Entity runner - void recognizeCategorizedEntitiesForSingleTextInputRunner(Consumer testRunner) { - testRunner.accept(CATEGORIZED_ENTITY_INPUTS.get(0)); - } - void recognizeCategorizedEntityStringInputRunner(Consumer> testRunner) { testRunner.accept(CATEGORIZED_ENTITY_INPUTS); } @@ -375,55 +246,15 @@ void recognizeStringBatchCategorizedEntitiesShowStatsRunner( testRunner.accept(CATEGORIZED_ENTITY_INPUTS, new TextAnalyticsRequestOptions().setIncludeStatistics(true)); } - // Personally Identifiable Information Entity runner - void recognizePiiSingleDocumentRunner(Consumer testRunner) { - testRunner.accept(PII_ENTITY_INPUTS.get(0)); - } - - void recognizePiiDomainFilterRunner(BiConsumer testRunner) { - testRunner.accept(PII_ENTITY_INPUTS.get(0), - new RecognizePiiEntityOptions().setDomainFilter(PiiEntityDomainType.PROTECTED_HEALTH_INFORMATION)); - } - - void recognizePiiLanguageHintRunner(BiConsumer, String> testRunner) { - testRunner.accept(PII_ENTITY_INPUTS, "en"); - } - - void recognizeBatchPiiEntityDuplicateIdRunner(Consumer> testRunner) { - testRunner.accept(getDuplicateTextDocumentInputs()); - } - - void recognizePiiEntitiesLanguageHintRunner(BiConsumer, String> testRunner) { - testRunner.accept(PII_ENTITY_INPUTS, "en"); - } - - void recognizeBatchPiiEntitySingleErrorRunner(Consumer> testRunner) { - List inputs = Collections.singletonList(new TextDocumentInput("2", " ")); - testRunner.accept(inputs); - } - - void recognizeBatchPiiEntitiesRunner(Consumer> testRunner) { - testRunner.accept(TestUtils.getTextDocumentInputs(PII_ENTITY_INPUTS)); - } - - void recognizeBatchPiiEntitiesShowStatsRunner( - BiConsumer, RecognizePiiEntityOptions> testRunner) { - final List textDocumentInputs = TestUtils.getTextDocumentInputs(PII_ENTITY_INPUTS); - RecognizePiiEntityOptions options = new RecognizePiiEntityOptions().setIncludeStatistics(true); - - testRunner.accept(textDocumentInputs, options); - } - - void recognizeStringBatchPiiEntitiesShowStatsRunner( - BiConsumer, RecognizePiiEntityOptions> testRunner) { - testRunner.accept(PII_ENTITY_INPUTS, new RecognizePiiEntityOptions().setIncludeStatistics(true)); + void recognizeEntitiesTooManyDocumentsRunner( + Consumer> testRunner) { + final String documentInput = CATEGORIZED_ENTITY_INPUTS.get(0); + // max num of document size is 5 + testRunner.accept( + Arrays.asList(documentInput, documentInput, documentInput, documentInput, documentInput, documentInput)); } // Linked Entity runner - void recognizeLinkedEntitiesForSingleTextInputRunner(Consumer testRunner) { - testRunner.accept(LINKED_ENTITY_INPUTS.get(0)); - } - void recognizeBatchStringLinkedEntitiesShowStatsRunner( BiConsumer, TextAnalyticsRequestOptions> testRunner) { testRunner.accept(LINKED_ENTITY_INPUTS, new TextAnalyticsRequestOptions().setIncludeStatistics(true)); @@ -452,11 +283,15 @@ void recognizeBatchLinkedEntityDuplicateIdRunner(Consumer testRunner) { - testRunner.accept(KEY_PHRASE_INPUTS.get(1)); + void recognizeLinkedEntitiesTooManyDocumentsRunner( + Consumer> testRunner) { + final String documentInput = LINKED_ENTITY_INPUTS.get(0); + // max num of document size is 5 + testRunner.accept( + Arrays.asList(documentInput, documentInput, documentInput, documentInput, documentInput, documentInput)); } + // Key Phrases runner void extractBatchStringKeyPhrasesShowStatsRunner(BiConsumer, TextAnalyticsRequestOptions> testRunner) { testRunner.accept(KEY_PHRASE_INPUTS, new TextAnalyticsRequestOptions().setIncludeStatistics(true)); } @@ -493,14 +328,6 @@ void extractKeyPhrasesBatchWarningRunner(Consumer> testR } // Sentiment Runner - void analyzeSentimentForSingleTextInputRunner(Consumer testRunner) { - testRunner.accept(SENTIMENT_INPUTS.get(0)); - } - - void analyzeSentimentForTextInputWithOpinionMiningRunner(BiConsumer testRunner) { - testRunner.accept(SENTIMENT_INPUTS.get(0), new AnalyzeSentimentOptions().setIncludeOpinionMining(true)); - } - void analyzeSentimentLanguageHintRunner(BiConsumer, String> testRunner) { testRunner.accept(SENTIMENT_INPUTS, "en"); } @@ -517,83 +344,16 @@ void analyzeBatchSentimentDuplicateIdRunner(Consumer> te testRunner.accept(getDuplicateTextDocumentInputs()); } - void analyzeBatchStringSentimentShowStatsAndIncludeOpinionMiningRunner(BiConsumer, AnalyzeSentimentOptions> testRunner) { - testRunner.accept(SENTIMENT_INPUTS, - new AnalyzeSentimentOptions().setIncludeStatistics(true).setIncludeOpinionMining(true)); + void analyzeBatchStringSentimentShowStatsRunner(BiConsumer, TextAnalyticsRequestOptions> testRunner) { + testRunner.accept(SENTIMENT_INPUTS, new TextAnalyticsRequestOptions().setIncludeStatistics(true)); } - void analyzeBatchSentimentShowStatsRunner(BiConsumer, TextAnalyticsRequestOptions> testRunner) { - final List textDocumentInputs = TestUtils.getTextDocumentInputs(SENTIMENT_INPUTS); - testRunner.accept(textDocumentInputs, new TextAnalyticsRequestOptions().setIncludeStatistics(true)); - } - - void analyzeBatchSentimentOpinionMining(BiConsumer, AnalyzeSentimentOptions> testRunner) { + void analyzeBatchSentimentShowStatsRunner( + BiConsumer, TextAnalyticsRequestOptions> testRunner) { final List textDocumentInputs = TestUtils.getTextDocumentInputs(SENTIMENT_INPUTS); - testRunner.accept(textDocumentInputs, new AnalyzeSentimentOptions().setIncludeOpinionMining(true) - .setIncludeStatistics(true)); - } - - // other Runners - void emptyTextRunner(Consumer testRunner) { - testRunner.accept(""); - } - - void faultyTextRunner(Consumer testRunner) { - testRunner.accept("!@#%%"); - } - - void detectLanguageInputEmptyIdRunner(Consumer> testRunner) { - testRunner.accept(Arrays.asList(new DetectLanguageInput("", DETECT_LANGUAGE_INPUTS.get(0)))); - } - - void textAnalyticsInputEmptyIdRunner(Consumer> testRunner) { - testRunner.accept(Arrays.asList(new TextDocumentInput("", CATEGORIZED_ENTITY_INPUTS.get(0)))); - } - void tooManyDocumentsRunner(Consumer> testRunner) { - final String documentInput = CATEGORIZED_ENTITY_INPUTS.get(0); - // max num of document size is 10 - testRunner.accept(Arrays.asList( - documentInput, documentInput, documentInput, documentInput, documentInput, documentInput, - documentInput, documentInput, documentInput, documentInput, documentInput, documentInput)); - } - - // offset runners - void emojiRunner(Consumer testRunner, String text) { - testRunner.accept("👩 " + text); // count as 3 units - } - - void emojiWithSkinToneModifierRunner(Consumer testRunner, String text) { - testRunner.accept("👩🏻 " + text); // count as 5 units - } - - void emojiFamilyRunner(Consumer testRunner, String text) { - testRunner.accept("👩‍👩‍👧‍👧 " + text); // count as 12 units - } - - void emojiFamilyWithSkinToneModifierRunner(Consumer testRunner, String text) { - testRunner.accept("👩🏻‍👩🏽‍👧🏾‍👦🏿 " + text); // count as 20 units - } - - void diacriticsNfcRunner(Consumer testRunner, String text) { - testRunner.accept("año " + text); // count as 4 units - } - - void diacriticsNfdRunner(Consumer testRunner, String text) { - testRunner.accept("año " + text); // count as 5 units - } - - void koreanNfcRunner(Consumer testRunner, String text) { - testRunner.accept("아가 " + text); // count as 3 units - } - - void koreanNfdRunner(Consumer testRunner, String text) { - testRunner.accept("아가 " + text); // count as 3 units - } - - void zalgoTextRunner(Consumer testRunner, String text) { - // count as 116 units - testRunner.accept("ơ̵̧̧̢̳̘̘͕͔͕̭̟̙͎͈̞͔̈̇̒̃͋̇̅͛̋͛̎́͑̄̐̂̎͗͝m̵͍͉̗̄̏͌̂̑̽̕͝͠g̵̢̡̢̡̨̡̧̛͉̞̯̠̤̣͕̟̫̫̼̰͓̦͖̣̣͎̋͒̈́̓̒̈̍̌̓̅͑̒̓̅̅͒̿̏́͗̀̇͛̏̀̈́̀̊̾̀̔͜͠͝ͅ " + text); + TextAnalyticsRequestOptions options = new TextAnalyticsRequestOptions().setIncludeStatistics(true); + testRunner.accept(textDocumentInputs, options); } String getEndpoint() { @@ -615,13 +375,14 @@ TextAnalyticsClientBuilder getTextAnalyticsAsyncClientBuilder(HttpClient httpCli if (getTestMode() == TestMode.PLAYBACK) { builder.credential(new AzureKeyCredential(FAKE_API_KEY)); } else { - builder.credential((new DefaultAzureCredentialBuilder().build())); + builder.credential(new DefaultAzureCredentialBuilder().build()); } return builder; } static void validateDetectLanguageResultCollectionWithResponse(boolean showStatistics, - DetectLanguageResultCollection expected, int expectedStatusCode, + DetectLanguageResultCollection expected, + int expectedStatusCode, Response response) { assertNotNull(response); assertEquals(expectedStatusCode, response.getStatusCode()); @@ -629,57 +390,40 @@ static void validateDetectLanguageResultCollectionWithResponse(boolean showStati } static void validateDetectLanguageResultCollection(boolean showStatistics, - DetectLanguageResultCollection expected, DetectLanguageResultCollection actual) { + DetectLanguageResultCollection expected, + DetectLanguageResultCollection actual) { validateTextAnalyticsResult(showStatistics, expected, actual, (expectedItem, actualItem) -> validatePrimaryLanguage(expectedItem.getPrimaryLanguage(), actualItem.getPrimaryLanguage())); } static void validateCategorizedEntitiesResultCollectionWithResponse(boolean showStatistics, - RecognizeEntitiesResultCollection expected, int expectedStatusCode, - Response response) { + RecognizeEntitiesResultCollection expected, + int expectedStatusCode, Response response) { assertNotNull(response); assertEquals(expectedStatusCode, response.getStatusCode()); validateCategorizedEntitiesResultCollection(showStatistics, expected, response.getValue()); } static void validateCategorizedEntitiesResultCollection(boolean showStatistics, - RecognizeEntitiesResultCollection expected, RecognizeEntitiesResultCollection actual) { + RecognizeEntitiesResultCollection expected, + RecognizeEntitiesResultCollection actual) { validateTextAnalyticsResult(showStatistics, expected, actual, (expectedItem, actualItem) -> validateCategorizedEntities( expectedItem.getEntities().stream().collect(Collectors.toList()), actualItem.getEntities().stream().collect(Collectors.toList()))); } - static void validatePiiEntitiesResultCollectionWithResponse(boolean showStatistics, - RecognizePiiEntitiesResultCollection expected, int expectedStatusCode, - Response response) { - assertNotNull(response); - assertEquals(expectedStatusCode, response.getStatusCode()); - validatePiiEntitiesResultCollection(showStatistics, expected, response.getValue()); - } - - static void validatePiiEntitiesResultCollection(boolean showStatistics, - RecognizePiiEntitiesResultCollection expected, RecognizePiiEntitiesResultCollection actual) { - validateTextAnalyticsResult(showStatistics, expected, actual, (expectedItem, actualItem) -> { - final PiiEntityCollection expectedPiiEntityCollection = expectedItem.getEntities(); - final PiiEntityCollection actualPiiEntityCollection = actualItem.getEntities(); - assertEquals(expectedPiiEntityCollection.getRedactedText(), actualPiiEntityCollection.getRedactedText()); - validatePiiEntities( - expectedPiiEntityCollection.stream().collect(Collectors.toList()), - actualPiiEntityCollection.stream().collect(Collectors.toList())); - }); - } - static void validateLinkedEntitiesResultCollectionWithResponse(boolean showStatistics, - RecognizeLinkedEntitiesResultCollection expected, int expectedStatusCode, - Response response) { + RecognizeLinkedEntitiesResultCollection expected, + int expectedStatusCode, Response response) { assertNotNull(response); assertEquals(expectedStatusCode, response.getStatusCode()); validateLinkedEntitiesResultCollection(showStatistics, expected, response.getValue()); } static void validateLinkedEntitiesResultCollection(boolean showStatistics, - RecognizeLinkedEntitiesResultCollection expected, RecognizeLinkedEntitiesResultCollection actual) { + RecognizeLinkedEntitiesResultCollection expected, + RecognizeLinkedEntitiesResultCollection actual) { validateTextAnalyticsResult(showStatistics, expected, actual, (expectedItem, actualItem) -> validateLinkedEntities( expectedItem.getEntities().stream().collect(Collectors.toList()), @@ -687,33 +431,35 @@ static void validateLinkedEntitiesResultCollection(boolean showStatistics, } static void validateExtractKeyPhrasesResultCollectionWithResponse(boolean showStatistics, - ExtractKeyPhrasesResultCollection expected, int expectedStatusCode, - Response response) { + ExtractKeyPhrasesResultCollection expected, + int expectedStatusCode, Response response) { assertNotNull(response); assertEquals(expectedStatusCode, response.getStatusCode()); validateExtractKeyPhrasesResultCollection(showStatistics, expected, response.getValue()); } static void validateExtractKeyPhrasesResultCollection(boolean showStatistics, - ExtractKeyPhrasesResultCollection expected, ExtractKeyPhrasesResultCollection actual) { + ExtractKeyPhrasesResultCollection expected, + ExtractKeyPhrasesResultCollection actual) { validateTextAnalyticsResult(showStatistics, expected, actual, (expectedItem, actualItem) -> validateKeyPhrases( expectedItem.getKeyPhrases().stream().collect(Collectors.toList()), actualItem.getKeyPhrases().stream().collect(Collectors.toList()))); } - static void validateSentimentResultCollectionWithResponse(boolean showStatistics, boolean includeOpinionMining, + static void validateSentimentResultCollectionWithResponse(boolean showStatistics, AnalyzeSentimentResultCollection expected, int expectedStatusCode, Response response) { assertNotNull(response); assertEquals(expectedStatusCode, response.getStatusCode()); - validateSentimentResultCollection(showStatistics, includeOpinionMining, expected, response.getValue()); + validateSentimentResultCollection(showStatistics, expected, response.getValue()); } - static void validateSentimentResultCollection(boolean showStatistics, boolean includeOpinionMining, - AnalyzeSentimentResultCollection expected, AnalyzeSentimentResultCollection actual) { + static void validateSentimentResultCollection(boolean showStatistics, + AnalyzeSentimentResultCollection expected, + AnalyzeSentimentResultCollection actual) { validateTextAnalyticsResult(showStatistics, expected, actual, (expectedItem, actualItem) -> - validateAnalyzedSentiment(includeOpinionMining, expectedItem.getDocumentSentiment(), actualItem.getDocumentSentiment())); + validateAnalyzedSentiment(expectedItem.getDocumentSentiment(), actualItem.getDocumentSentiment())); } /** @@ -723,9 +469,8 @@ static void validateSentimentResultCollection(boolean showStatistics, boolean in * @param actualLanguage detectedLanguage returned by the API. */ static void validatePrimaryLanguage(DetectedLanguage expectedLanguage, DetectedLanguage actualLanguage) { - // TODO: issue https://github.com/Azure/azure-sdk-for-java/issues/13841 - assertNotNull(actualLanguage.getIso6391Name()); - assertNotNull(actualLanguage.getName()); + assertEquals(expectedLanguage.getIso6391Name(), actualLanguage.getIso6391Name()); + assertEquals(expectedLanguage.getName(), actualLanguage.getName()); assertNotNull(actualLanguage.getConfidenceScore()); } @@ -739,25 +484,10 @@ static void validateCategorizedEntity( CategorizedEntity expectedCategorizedEntity, CategorizedEntity actualCategorizedEntity) { assertEquals(expectedCategorizedEntity.getSubcategory(), actualCategorizedEntity.getSubcategory()); assertEquals(expectedCategorizedEntity.getText(), actualCategorizedEntity.getText()); - assertEquals(expectedCategorizedEntity.getOffset(), actualCategorizedEntity.getOffset()); assertEquals(expectedCategorizedEntity.getCategory(), actualCategorizedEntity.getCategory()); assertNotNull(actualCategorizedEntity.getConfidenceScore()); } - /** - * Helper method to validate a single Personally Identifiable Information entity. - * - * @param expectedPiiEntity PiiEntity returned by the service. - * @param actualPiiEntity PiiEntity returned by the API. - */ - static void validatePiiEntity(PiiEntity expectedPiiEntity, PiiEntity actualPiiEntity) { - assertEquals(expectedPiiEntity.getOffset(), actualPiiEntity.getOffset()); - assertEquals(expectedPiiEntity.getSubcategory(), actualPiiEntity.getSubcategory()); - assertEquals(expectedPiiEntity.getText(), actualPiiEntity.getText()); - assertEquals(expectedPiiEntity.getCategory(), actualPiiEntity.getCategory()); - assertNotNull(actualPiiEntity.getConfidenceScore()); - } - /** * Helper method to validate a single linked entity. * @@ -770,7 +500,6 @@ static void validateLinkedEntity(LinkedEntity expectedLinkedEntity, LinkedEntity assertEquals(expectedLinkedEntity.getLanguage(), actualLinkedEntity.getLanguage()); assertEquals(expectedLinkedEntity.getUrl(), actualLinkedEntity.getUrl()); assertEquals(expectedLinkedEntity.getDataSourceEntityId(), actualLinkedEntity.getDataSourceEntityId()); - assertEquals(expectedLinkedEntity.getBingEntitySearchApiId(), actualLinkedEntity.getBingEntitySearchApiId()); validateLinkedEntityMatches(expectedLinkedEntity.getMatches().stream().collect(Collectors.toList()), actualLinkedEntity.getMatches().stream().collect(Collectors.toList())); } @@ -809,24 +538,6 @@ static void validateCategorizedEntities(List expectedCategori } } - /** - * Helper method to validate the list of Personally Identifiable Information entities. - * - * @param expectedPiiEntityList piiEntities returned by the service. - * @param actualPiiEntityList piiEntities returned by the API. - */ - static void validatePiiEntities(List expectedPiiEntityList, List actualPiiEntityList) { - assertEquals(expectedPiiEntityList.size(), actualPiiEntityList.size()); - expectedPiiEntityList.sort(Comparator.comparing(PiiEntity::getText)); - actualPiiEntityList.sort(Comparator.comparing(PiiEntity::getText)); - - for (int i = 0; i < expectedPiiEntityList.size(); i++) { - PiiEntity expectedPiiEntity = expectedPiiEntityList.get(i); - PiiEntity actualPiiEntity = actualPiiEntityList.get(i); - validatePiiEntity(expectedPiiEntity, actualPiiEntity); - } - } - /** * Helper method to validate the list of linked entities. * @@ -853,12 +564,12 @@ static void validateLinkedEntities(List expectedLinkedEntityList, * @param expectedSentimentList a list of analyzed sentence sentiment returned by the service. * @param actualSentimentList a list of analyzed sentence sentiment returned by the API. */ - static void validateAnalyzedSentenceSentiment(boolean includeOpinionMining, List expectedSentimentList, + static void validateAnalyzedSentenceSentiment(List expectedSentimentList, List actualSentimentList) { assertEquals(expectedSentimentList.size(), actualSentimentList.size()); for (int i = 0; i < expectedSentimentList.size(); i++) { - validateSentenceSentiment(includeOpinionMining, expectedSentimentList.get(i), actualSentimentList.get(i)); + validateSentenceSentiment(expectedSentimentList.get(i), actualSentimentList.get(i)); } } @@ -869,73 +580,8 @@ static void validateAnalyzedSentenceSentiment(boolean includeOpinionMining, List * @param expectedSentiment analyzed sentence sentiment returned by the service. * @param actualSentiment analyzed sentence sentiment returned by the API. */ - static void validateSentenceSentiment(boolean includeOpinionMining, SentenceSentiment expectedSentiment, SentenceSentiment actualSentiment) { + static void validateSentenceSentiment(SentenceSentiment expectedSentiment, SentenceSentiment actualSentiment) { assertEquals(expectedSentiment.getSentiment(), actualSentiment.getSentiment()); - assertEquals(expectedSentiment.getText(), actualSentiment.getText()); - assertEquals(expectedSentiment.getOffset(), actualSentiment.getOffset()); - - if (includeOpinionMining) { - validateSentenceMinedOpinions(expectedSentiment.getMinedOpinions().stream().collect(Collectors.toList()), - actualSentiment.getMinedOpinions().stream().collect(Collectors.toList())); - } else { - assertNull(actualSentiment.getMinedOpinions()); - } - } - - /** - * Helper method to validate sentence's mined opinions. - * - * @param expectedMinedOpinions a list of mined opinions returned by the service. - * @param actualMinedOpinions a list of mined opinions returned by the API. - */ - static void validateSentenceMinedOpinions(List expectedMinedOpinions, - List actualMinedOpinions) { - assertEquals(expectedMinedOpinions.size(), actualMinedOpinions.size()); - for (int i = 0; i < actualMinedOpinions.size(); i++) { - final MinedOpinion expectedMinedOpinion = expectedMinedOpinions.get(i); - final MinedOpinion actualMinedOpinion = actualMinedOpinions.get(i); - validateAspectSentiment(expectedMinedOpinion.getAspect(), actualMinedOpinion.getAspect()); - validateAspectOpinionList(expectedMinedOpinion.getOpinions().stream().collect(Collectors.toList()), - actualMinedOpinion.getOpinions().stream().collect(Collectors.toList())); - } - } - - /** - * Helper method to validate aspect sentiment. - * - * @param expectedAspectSentiment An expected aspect sentiment. - * @param actualAspectSentiment An actual aspect sentiment. - */ - static void validateAspectSentiment(AspectSentiment expectedAspectSentiment, AspectSentiment actualAspectSentiment) { - assertEquals(expectedAspectSentiment.getSentiment(), actualAspectSentiment.getSentiment()); - assertEquals(expectedAspectSentiment.getText(), actualAspectSentiment.getText()); - assertEquals(expectedAspectSentiment.getOffset(), actualAspectSentiment.getOffset()); - } - - /** - * Helper method to validate a list of {@link OpinionSentiment}. - * - * @param expectedOpinionSentiments A list of expected opinion sentiments. - * @param actualOpinionSentiments A list of actual opinion sentiments. - */ - static void validateAspectOpinionList(List expectedOpinionSentiments, List actualOpinionSentiments) { - assertEquals(expectedOpinionSentiments.size(), actualOpinionSentiments.size()); - for (int i = 0; i < expectedOpinionSentiments.size(); i++) { - validateAspectOpinion(expectedOpinionSentiments.get(i), actualOpinionSentiments.get(i)); - } - } - - /** - * Helper method to validate opinion sentiment. - * - * @param expectedAspectOpinion An expected opinion sentiment. - * @param actualAspectOpinion An actual opinion sentiment. - */ - static void validateAspectOpinion(OpinionSentiment expectedAspectOpinion, OpinionSentiment actualAspectOpinion) { - assertEquals(expectedAspectOpinion.getSentiment(), actualAspectOpinion.getSentiment()); - assertEquals(expectedAspectOpinion.getText(), actualAspectOpinion.getText()); - assertEquals(expectedAspectOpinion.isNegated(), actualAspectOpinion.isNegated()); - assertEquals(expectedAspectOpinion.getOffset(), actualAspectOpinion.getOffset()); } /** @@ -945,12 +591,10 @@ static void validateAspectOpinion(OpinionSentiment expectedAspectOpinion, Opinio * @param expectedSentiment analyzed document sentiment returned by the service. * @param actualSentiment analyzed document sentiment returned by the API. */ - static void validateAnalyzedSentiment(boolean includeOpinionMining, DocumentSentiment expectedSentiment, - DocumentSentiment actualSentiment) { + static void validateAnalyzedSentiment(DocumentSentiment expectedSentiment, DocumentSentiment actualSentiment) { assertEquals(expectedSentiment.getSentiment(), actualSentiment.getSentiment()); - validateAnalyzedSentenceSentiment(includeOpinionMining, - expectedSentiment.getSentences().stream().collect(Collectors.toList()), - actualSentiment.getSentences().stream().collect(Collectors.toList())); + validateAnalyzedSentenceSentiment(expectedSentiment.getSentences().stream().collect(Collectors.toList()), + expectedSentiment.getSentences().stream().collect(Collectors.toList())); } /** @@ -983,18 +627,6 @@ static > void validat validateBatchStatistics(((RecognizeLinkedEntitiesResultCollection) expectedResults).getStatistics(), ((RecognizeLinkedEntitiesResultCollection) actualResults).getStatistics()); } - } else { - if (expectedResults instanceof AnalyzeSentimentResultCollection) { - assertNull(((AnalyzeSentimentResultCollection) actualResults).getStatistics()); - } else if (expectedResults instanceof DetectLanguageResultCollection) { - assertNull(((DetectLanguageResultCollection) actualResults).getStatistics()); - } else if (expectedResults instanceof ExtractKeyPhrasesResultCollection) { - assertNull(((ExtractKeyPhrasesResultCollection) actualResults).getStatistics()); - } else if (expectedResults instanceof RecognizeEntitiesResultCollection) { - assertNull(((RecognizeEntitiesResultCollection) actualResults).getStatistics()); - } else if (expectedResults instanceof RecognizeLinkedEntitiesResultCollection) { - assertNull(((RecognizeLinkedEntitiesResultCollection) actualResults).getStatistics()); - } } expected.forEach((key, expectedValue) -> { @@ -1059,7 +691,6 @@ private static void validateLinkedEntityMatches(List expected LinkedEntityMatch expectedLinkedEntity = expectedLinkedEntityMatches.get(i); LinkedEntityMatch actualLinkedEntity = actualLinkedEntityMatches.get(i); assertEquals(expectedLinkedEntity.getText(), actualLinkedEntity.getText()); - assertEquals(expectedLinkedEntity.getOffset(), actualLinkedEntity.getOffset()); assertNotNull(actualLinkedEntity.getConfidenceScore()); } } diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker deleted file mode 100644 index 1f0955d450f0d..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker +++ /dev/null @@ -1 +0,0 @@ -mock-maker-inline diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentBatchTooManyDocuments.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentBatchTooManyDocuments.json deleted file mode 100644 index 1ac7c3abdbdb5..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentBatchTooManyDocuments.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//sentiment?stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "5c6c2929-ed11-4d0e-8fd8-70f787885835", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "5", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "apim-request-id" : "ef67b446-45a7-43ba-9cbd-c26715c80e21", - "retry-after" : "0", - "StatusCode" : "400", - "Body" : "{\"error\":{\"code\":\"InvalidRequest\",\"message\":\"Invalid document in request.\",\"innererror\":{\"code\":\"InvalidDocumentBatch\",\"message\":\"Batch request contains too many records. Max 10 records are permitted.\"}}}", - "Date" : "Thu, 03 Sep 2020 19:03:51 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentDiacriticsNfc.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentDiacriticsNfc.json deleted file mode 100644 index 83ea2257e0d6c..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentDiacriticsNfc.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//sentiment?stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "a83f8ab8-164a-461f-a08d-aaabce2dea8a", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "95", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "1cf570ca-80f2-4df4-8bd0-598893d32f43", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"sentences\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":0,\"length\":35,\"text\":\"año The hotel was dark and unclean.\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}", - "Date" : "Thu, 03 Sep 2020 17:50:16 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentDiacriticsNfd.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentDiacriticsNfd.json deleted file mode 100644 index b395e475577e7..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentDiacriticsNfd.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//sentiment?stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "0843202a-667b-49a6-82bd-94330f97b993", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "94", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "a05b3f83-1f72-482f-a4a8-40015ceb49e0", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"sentences\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":0,\"length\":36,\"text\":\"año The hotel was dark and unclean.\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}", - "Date" : "Thu, 03 Sep 2020 17:50:17 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentDuplicateIdInput.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentDuplicateIdInput.json index 99c4de9bdee33..981578e39fb65 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentDuplicateIdInput.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentDuplicateIdInput.json @@ -1,22 +1,22 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//sentiment?showStats=false&opinionMining=false&stringIndexType=Utf16CodeUnit", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//sentiment", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "d596b89d-5b58-4224-9b7b-5f1be0a2d32a", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "6157e5fc-f3a3-4917-8509-cf4d293c4444", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "5", + "x-envoy-upstream-service-time" : "7", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", - "apim-request-id" : "d9ba76be-0ca0-4ae9-ab28-66861bcce9bc", + "apim-request-id" : "cc8ae190-2e4c-4271-b95e-0ccbd1d57cdb", "retry-after" : "0", "StatusCode" : "400", - "Body" : "{\"error\":{\"code\":\"InvalidRequest\",\"message\":\"Invalid document in request.\",\"innererror\":{\"code\":\"InvalidDocument\",\"message\":\"Request contains duplicated Ids. Make sure each document has a unique Id.\"}}}", - "Date" : "Thu, 03 Sep 2020 19:03:54 GMT", + "Body" : "{\"error\":{\"code\":\"InvalidRequest\",\"message\":\"Invalid document in request.\",\"innerError\":{\"code\":\"InvalidDocument\",\"message\":\"Request contains duplicated Ids. Make sure each document has a unique Id.\"}}}", + "Date" : "Thu, 30 Apr 2020 04:52:39 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentEmoji.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentEmoji.json deleted file mode 100644 index 3a71ecbb71d8d..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentEmoji.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//sentiment?stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "e2f1e123-866a-4846-91d1-8484ced8b94e", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "85", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "1aaf699e-3980-4734-9483-cc60f9cdad5b", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"sentences\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":0,\"length\":34,\"text\":\"\uD83D\uDC69 The hotel was dark and unclean.\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}", - "Date" : "Thu, 03 Sep 2020 17:50:07 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentEmojiFamily.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentEmojiFamily.json deleted file mode 100644 index f2f8cf5a8486d..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentEmojiFamily.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//sentiment?stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "591bf922-9a34-4131-8fdc-50d3c44cb392", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "97", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "2bbcbcfb-5a27-4649-83e1-25b0eebce3dc", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"sentences\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":0,\"length\":43,\"text\":\"\uD83D\uDC69‍\uD83D\uDC69‍\uD83D\uDC67‍\uD83D\uDC67 The hotel was dark and unclean.\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}", - "Date" : "Thu, 03 Sep 2020 17:49:59 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentEmojiFamilyWithSkinToneModifier.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentEmojiFamilyWithSkinToneModifier.json deleted file mode 100644 index 0e2e7ea59a997..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentEmojiFamilyWithSkinToneModifier.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//sentiment?stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "0fecf14e-1a09-43d5-8d6e-97af232058e1", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "85", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "5e555ee2-a2be-4448-82dd-aeaaa2b14504", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"sentences\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":0,\"length\":51,\"text\":\"\uD83D\uDC69\uD83C\uDFFB‍\uD83D\uDC69\uD83C\uDFFD‍\uD83D\uDC67\uD83C\uDFFE‍\uD83D\uDC66\uD83C\uDFFF The hotel was dark and unclean.\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}", - "Date" : "Thu, 03 Sep 2020 17:50:11 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentEmojiWithSkinToneModifier.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentEmojiWithSkinToneModifier.json deleted file mode 100644 index 26c59bb162df7..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentEmojiWithSkinToneModifier.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//sentiment?stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "0514eaf1-871d-4c75-8dcd-5fcebfff3eca", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "84", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "9c380cc5-f3e0-47ab-bf1f-1d1b6f76dcd5", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"sentences\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":0,\"length\":36,\"text\":\"\uD83D\uDC69\uD83C\uDFFB The hotel was dark and unclean.\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}", - "Date" : "Thu, 03 Sep 2020 17:50:06 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentEmptyIdInput.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentEmptyIdInput.json deleted file mode 100644 index 4f58fa6be18ff..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentEmptyIdInput.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//sentiment?stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "e12d2cd0-895a-4c8c-8528-1b25be38063e", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "6", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "apim-request-id" : "9d9eb3c0-0092-483f-b6d7-94d649e19f50", - "retry-after" : "0", - "StatusCode" : "400", - "Body" : "{\"error\":{\"code\":\"InvalidRequest\",\"message\":\"Invalid document in request.\",\"innererror\":{\"code\":\"InvalidDocument\",\"message\":\"At least one document is missing an Id attribute.\"}}}", - "Date" : "Thu, 03 Sep 2020 19:03:56 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForBatchInputWithNullAnalyzeSentimentOptions.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForBatchInput.json similarity index 76% rename from sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForBatchInputWithNullAnalyzeSentimentOptions.json rename to sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForBatchInput.json index dbefe112f87ec..db9e4dfdaed6a 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForBatchInputWithNullAnalyzeSentimentOptions.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForBatchInput.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//sentiment?stringIndexType=Utf16CodeUnit", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//sentiment", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "0a65f274-d47a-4f7f-b488-649df4652157", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "a5fdc3a0-3fa7-4b80-98e8-7a739d4c352a", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "104", + "x-envoy-upstream-service-time" : "109", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", - "apim-request-id" : "c626ed90-988d-4f69-ac4d-f3d9c0c4f430", + "apim-request-id" : "48f66acf-87f2-4d9b-96e1-e782aff54539", "retry-after" : "0", "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"sentiment\":\"mixed\",\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":0,\"length\":31,\"text\":\"The hotel was dark and unclean.\"},{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":32,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\"}],\"warnings\":[]},{\"id\":\"1\",\"sentiment\":\"mixed\",\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":0,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\"},{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":36,\"length\":31,\"text\":\"The hotel was dark and unclean.\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}", - "Date" : "Thu, 03 Sep 2020 19:04:03 GMT", + "Body" : "{\"documents\":[{\"id\":\"0\",\"sentiment\":\"mixed\",\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":0,\"length\":31,\"text\":\"The hotel was dark and unclean.\"},{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":32,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\"}],\"warnings\":[]},{\"id\":\"1\",\"sentiment\":\"mixed\",\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":0,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\"},{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":36,\"length\":31,\"text\":\"The hotel was dark and unclean.\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Wed, 29 Apr 2020 17:12:19 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForBatchInputNotShowStatisticsButIncludeOpinionMining.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForBatchInputNotShowStatisticsButIncludeOpinionMining.json deleted file mode 100644 index 62de7e36223dc..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForBatchInputNotShowStatisticsButIncludeOpinionMining.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//sentiment?showStats=false&opinionMining=true&stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "3a16be16-d742-4bff-b7cd-f08ba2f1fbf3", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "95", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", - "apim-request-id" : "b7fb713d-7d2f-43e9-bb9c-a270fecf7560", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"sentiment\":\"mixed\",\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":0,\"length\":31,\"text\":\"The hotel was dark and unclean.\",\"aspects\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"negative\":1.0},\"offset\":4,\"length\":5,\"text\":\"hotel\",\"relations\":[{\"relationType\":\"opinion\",\"ref\":\"#/documents/0/sentences/0/opinions/0\"},{\"relationType\":\"opinion\",\"ref\":\"#/documents/0/sentences/0/opinions/1\"}]}],\"opinions\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"negative\":1.0},\"offset\":14,\"length\":4,\"text\":\"dark\",\"isNegated\":false},{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"negative\":1.0},\"offset\":23,\"length\":7,\"text\":\"unclean\",\"isNegated\":false}]},{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":32,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\",\"aspects\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"negative\":0.0},\"offset\":59,\"length\":7,\"text\":\"gnocchi\",\"relations\":[{\"relationType\":\"opinion\",\"ref\":\"#/documents/0/sentences/1/opinions/0\"}]}],\"opinions\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"negative\":0.0},\"offset\":51,\"length\":7,\"text\":\"amazing\",\"isNegated\":false}]}],\"warnings\":[]},{\"id\":\"1\",\"sentiment\":\"mixed\",\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":0,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\",\"aspects\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"negative\":0.0},\"offset\":27,\"length\":7,\"text\":\"gnocchi\",\"relations\":[{\"relationType\":\"opinion\",\"ref\":\"#/documents/1/sentences/0/opinions/0\"}]}],\"opinions\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"negative\":0.0},\"offset\":19,\"length\":7,\"text\":\"amazing\",\"isNegated\":false}]},{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":36,\"length\":31,\"text\":\"The hotel was dark and unclean.\",\"aspects\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"negative\":1.0},\"offset\":40,\"length\":5,\"text\":\"hotel\",\"relations\":[{\"relationType\":\"opinion\",\"ref\":\"#/documents/1/sentences/1/opinions/0\"},{\"relationType\":\"opinion\",\"ref\":\"#/documents/1/sentences/1/opinions/1\"}]}],\"opinions\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"negative\":1.0},\"offset\":50,\"length\":4,\"text\":\"dark\",\"isNegated\":false},{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"negative\":1.0},\"offset\":59,\"length\":7,\"text\":\"unclean\",\"isNegated\":false}]}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}", - "Date" : "Thu, 03 Sep 2020 19:03:55 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForBatchInputShowStatistics.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForBatchInputShowStatistics.json index 239bb9c5e05ac..b207bb28e59d7 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForBatchInputShowStatistics.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForBatchInputShowStatistics.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//sentiment?showStats=true&opinionMining=false&stringIndexType=Utf16CodeUnit", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//sentiment?showStats=true", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "23c9b4c8-324c-43a2-9d25-4f8e01d525bd", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "5bfc2f94-994e-4501-bc55-7bef62ab587a", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "105", + "x-envoy-upstream-service-time" : "120", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", - "apim-request-id" : "6d6e3eff-e7ed-45d4-bfb6-a1a830ae7a17", + "apim-request-id" : "baf52579-73a8-4377-8a02-d5ab016d55ca", "retry-after" : "0", "StatusCode" : "200", - "Body" : "{\"statistics\":{\"documentsCount\":2,\"validDocumentsCount\":2,\"erroneousDocumentsCount\":0,\"transactionsCount\":2},\"documents\":[{\"id\":\"0\",\"sentiment\":\"mixed\",\"statistics\":{\"charactersCount\":67,\"transactionsCount\":1},\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":0,\"length\":31,\"text\":\"The hotel was dark and unclean.\"},{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":32,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\"}],\"warnings\":[]},{\"id\":\"1\",\"sentiment\":\"mixed\",\"statistics\":{\"charactersCount\":67,\"transactionsCount\":1},\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":0,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\"},{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":36,\"length\":31,\"text\":\"The hotel was dark and unclean.\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}", - "Date" : "Thu, 03 Sep 2020 19:04:07 GMT", + "Body" : "{\"statistics\":{\"documentsCount\":2,\"validDocumentsCount\":2,\"erroneousDocumentsCount\":0,\"transactionsCount\":2},\"documents\":[{\"id\":\"0\",\"sentiment\":\"mixed\",\"statistics\":{\"charactersCount\":67,\"transactionsCount\":1},\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":0,\"length\":31,\"text\":\"The hotel was dark and unclean.\"},{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":32,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\"}],\"warnings\":[]},{\"id\":\"1\",\"sentiment\":\"mixed\",\"statistics\":{\"charactersCount\":67,\"transactionsCount\":1},\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":0,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\"},{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":36,\"length\":31,\"text\":\"The hotel was dark and unclean.\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Wed, 29 Apr 2020 17:12:18 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForBatchInputShowStatisticsAndIncludeOpinionMining.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForBatchInputShowStatisticsAndIncludeOpinionMining.json deleted file mode 100644 index 0b0b2c29c4065..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForBatchInputShowStatisticsAndIncludeOpinionMining.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//sentiment?showStats=true&opinionMining=true&stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "c8ee1e2f-7305-4f0d-a2ac-5bf6e519010d", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "89", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", - "apim-request-id" : "502b9b10-8fc4-4234-8104-3f6c79f473a2", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"statistics\":{\"documentsCount\":2,\"validDocumentsCount\":2,\"erroneousDocumentsCount\":0,\"transactionsCount\":2},\"documents\":[{\"id\":\"0\",\"sentiment\":\"mixed\",\"statistics\":{\"charactersCount\":67,\"transactionsCount\":1},\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":0,\"length\":31,\"text\":\"The hotel was dark and unclean.\",\"aspects\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"negative\":1.0},\"offset\":4,\"length\":5,\"text\":\"hotel\",\"relations\":[{\"relationType\":\"opinion\",\"ref\":\"#/documents/0/sentences/0/opinions/0\"},{\"relationType\":\"opinion\",\"ref\":\"#/documents/0/sentences/0/opinions/1\"}]}],\"opinions\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"negative\":1.0},\"offset\":14,\"length\":4,\"text\":\"dark\",\"isNegated\":false},{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"negative\":1.0},\"offset\":23,\"length\":7,\"text\":\"unclean\",\"isNegated\":false}]},{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":32,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\",\"aspects\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"negative\":0.0},\"offset\":59,\"length\":7,\"text\":\"gnocchi\",\"relations\":[{\"relationType\":\"opinion\",\"ref\":\"#/documents/0/sentences/1/opinions/0\"}]}],\"opinions\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"negative\":0.0},\"offset\":51,\"length\":7,\"text\":\"amazing\",\"isNegated\":false}]}],\"warnings\":[]},{\"id\":\"1\",\"sentiment\":\"mixed\",\"statistics\":{\"charactersCount\":67,\"transactionsCount\":1},\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":0,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\",\"aspects\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"negative\":0.0},\"offset\":27,\"length\":7,\"text\":\"gnocchi\",\"relations\":[{\"relationType\":\"opinion\",\"ref\":\"#/documents/1/sentences/0/opinions/0\"}]}],\"opinions\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"negative\":0.0},\"offset\":19,\"length\":7,\"text\":\"amazing\",\"isNegated\":false}]},{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":36,\"length\":31,\"text\":\"The hotel was dark and unclean.\",\"aspects\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"negative\":1.0},\"offset\":40,\"length\":5,\"text\":\"hotel\",\"relations\":[{\"relationType\":\"opinion\",\"ref\":\"#/documents/1/sentences/1/opinions/0\"},{\"relationType\":\"opinion\",\"ref\":\"#/documents/1/sentences/1/opinions/1\"}]}],\"opinions\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"negative\":1.0},\"offset\":50,\"length\":4,\"text\":\"dark\",\"isNegated\":false},{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"negative\":1.0},\"offset\":59,\"length\":7,\"text\":\"unclean\",\"isNegated\":false}]}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}", - "Date" : "Thu, 03 Sep 2020 19:03:53 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForBatchInputShowStatisticsExcludeOpinionMining.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForBatchInputShowStatisticsExcludeOpinionMining.json deleted file mode 100644 index fb28be0793c3d..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForBatchInputShowStatisticsExcludeOpinionMining.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//sentiment?showStats=true&opinionMining=false&stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "878483d8-b1a1-4f45-b1cd-8343acb1b6e1", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "91", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", - "apim-request-id" : "53512d48-4ba2-46ad-8a1c-16f7ac3f2fec", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"statistics\":{\"documentsCount\":2,\"validDocumentsCount\":2,\"erroneousDocumentsCount\":0,\"transactionsCount\":2},\"documents\":[{\"id\":\"0\",\"sentiment\":\"mixed\",\"statistics\":{\"charactersCount\":67,\"transactionsCount\":1},\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":0,\"length\":31,\"text\":\"The hotel was dark and unclean.\"},{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":32,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\"}],\"warnings\":[]},{\"id\":\"1\",\"sentiment\":\"mixed\",\"statistics\":{\"charactersCount\":67,\"transactionsCount\":1},\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":0,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\"},{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":36,\"length\":31,\"text\":\"The hotel was dark and unclean.\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}", - "Date" : "Thu, 03 Sep 2020 19:03:50 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForBatchStringInput.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForBatchStringInput.json index 65165d0d93873..aca336e6ecb31 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForBatchStringInput.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForBatchStringInput.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//sentiment?showStats=false&opinionMining=false&stringIndexType=Utf16CodeUnit", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//sentiment", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "7d6c73a9-e9ec-4b39-99ba-9be6c8d3535a", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "390d98ec-ee3c-46d8-9157-8fb209d916d4", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "83", + "x-envoy-upstream-service-time" : "137", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", - "apim-request-id" : "0a287224-ee0a-48a5-8bc1-869a30468a4d", + "apim-request-id" : "dc845cbb-ed0b-4139-8690-ffa5ce91d351", "retry-after" : "0", "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"sentiment\":\"mixed\",\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":0,\"length\":31,\"text\":\"The hotel was dark and unclean.\"},{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":32,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\"}],\"warnings\":[]},{\"id\":\"1\",\"sentiment\":\"mixed\",\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":0,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\"},{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":36,\"length\":31,\"text\":\"The hotel was dark and unclean.\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}", - "Date" : "Thu, 03 Sep 2020 19:03:57 GMT", + "Body" : "{\"documents\":[{\"id\":\"0\",\"sentiment\":\"mixed\",\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":0,\"length\":31,\"text\":\"The hotel was dark and unclean.\"},{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":32,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\"}],\"warnings\":[]},{\"id\":\"1\",\"sentiment\":\"mixed\",\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":0,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\"},{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":36,\"length\":31,\"text\":\"The hotel was dark and unclean.\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Wed, 29 Apr 2020 17:12:19 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForEmptyText.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForEmptyText.json index 6bae8aa1d14f0..ea87abfb662a0 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForEmptyText.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForEmptyText.json @@ -1,10 +1,10 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//sentiment?stringIndexType=Utf16CodeUnit", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//sentiment", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "50986742-9343-4f38-946f-458b88a5604d", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "c7f450bb-9aa1-46a1-bd87-e76c7441bc67", "Content-Type" : "application/json" }, "Response" : { @@ -12,11 +12,11 @@ "x-envoy-upstream-service-time" : "2", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", - "apim-request-id" : "61914af3-7de6-4860-9fc5-dde1b97e69cb", + "apim-request-id" : "efbe390c-f5c2-41a3-886b-d6dcc12c2ab5", "retry-after" : "0", "StatusCode" : "200", - "Body" : "{\"documents\":[],\"errors\":[{\"id\":\"0\",\"error\":{\"code\":\"InvalidArgument\",\"message\":\"Invalid document in request.\",\"innererror\":{\"code\":\"InvalidDocument\",\"message\":\"Document text is empty.\"}}}],\"modelVersion\":\"2020-04-01\"}", - "Date" : "Thu, 03 Sep 2020 19:04:00 GMT", + "Body" : "{\"documents\":[],\"errors\":[{\"id\":\"0\",\"error\":{\"code\":\"InvalidArgument\",\"message\":\"Invalid document in request.\",\"innererror\":{\"code\":\"InvalidDocument\",\"message\":\"Document text is empty.\"}}}],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Wed, 29 Apr 2020 17:12:19 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForFaultyText.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForFaultyText.json index 8ddc4504b72be..190918010d9d7 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForFaultyText.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForFaultyText.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//sentiment?stringIndexType=Utf16CodeUnit", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//sentiment", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "8aa696ca-9a04-4bf4-bb17-b5030d971d6e", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "c715c68e-bf05-43a7-92e6-152e7c0833d2", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "83", + "x-envoy-upstream-service-time" : "110", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "a7a12972-48ad-4c69-8ea0-5773f581ffb7", + "apim-request-id" : "7d859041-8a10-45dc-b769-662885e9ee7e", "retry-after" : "0", "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"sentiment\":\"neutral\",\"confidenceScores\":{\"positive\":0.06,\"neutral\":0.91,\"negative\":0.03},\"sentences\":[{\"sentiment\":\"neutral\",\"confidenceScores\":{\"positive\":0.06,\"neutral\":0.91,\"negative\":0.03},\"offset\":0,\"length\":1,\"text\":\"!\"},{\"sentiment\":\"neutral\",\"confidenceScores\":{\"positive\":0.06,\"neutral\":0.91,\"negative\":0.03},\"offset\":1,\"length\":4,\"text\":\"@#%%\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}", - "Date" : "Thu, 03 Sep 2020 19:04:02 GMT", + "Body" : "{\"documents\":[{\"id\":\"0\",\"sentiment\":\"neutral\",\"confidenceScores\":{\"positive\":0.06,\"neutral\":0.91,\"negative\":0.03},\"sentences\":[{\"sentiment\":\"neutral\",\"confidenceScores\":{\"positive\":0.06,\"neutral\":0.91,\"negative\":0.03},\"offset\":0,\"length\":1,\"text\":\"!\"},{\"sentiment\":\"neutral\",\"confidenceScores\":{\"positive\":0.06,\"neutral\":0.91,\"negative\":0.03},\"offset\":1,\"length\":4,\"text\":\"@#%%\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Wed, 29 Apr 2020 17:12:20 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForBatchInputWithNullRequestOptions.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForListLanguageHint.json similarity index 74% rename from sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForBatchInputWithNullRequestOptions.json rename to sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForListLanguageHint.json index 4696e49a71486..5416b59e4f20e 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForBatchInputWithNullRequestOptions.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForListLanguageHint.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//sentiment?showStats=false&opinionMining=false&stringIndexType=Utf16CodeUnit", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//sentiment", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "9f14fd52-8b61-4601-90a3-a90d8b05a9b8", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "8c4f6331-de27-4bd5-94e9-62694e7bf1ce", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "88", + "x-envoy-upstream-service-time" : "111", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", - "apim-request-id" : "423a12c2-5c61-4d66-9b2b-d048a2adc58c", + "apim-request-id" : "94a7a5af-8561-4e49-a42d-2c4691b42f94", "retry-after" : "0", "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"sentiment\":\"mixed\",\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":0,\"length\":31,\"text\":\"The hotel was dark and unclean.\"},{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":32,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\"}],\"warnings\":[]},{\"id\":\"1\",\"sentiment\":\"mixed\",\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":0,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\"},{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":36,\"length\":31,\"text\":\"The hotel was dark and unclean.\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}", - "Date" : "Thu, 03 Sep 2020 19:03:53 GMT", + "Body" : "{\"documents\":[{\"id\":\"0\",\"sentiment\":\"mixed\",\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":0,\"length\":31,\"text\":\"The hotel was dark and unclean.\"},{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":32,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\"}],\"warnings\":[]},{\"id\":\"1\",\"sentiment\":\"mixed\",\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":0,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\"},{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":36,\"length\":31,\"text\":\"The hotel was dark and unclean.\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Wed, 29 Apr 2020 17:12:19 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForListStringNotShowStatisticsButIncludeOpinionMining.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForListStringNotShowStatisticsButIncludeOpinionMining.json deleted file mode 100644 index b42925c1e26c3..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForListStringNotShowStatisticsButIncludeOpinionMining.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//sentiment?showStats=false&opinionMining=true&stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "6d4d94c1-88d1-489e-89b6-c90affc8c21c", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "115", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", - "apim-request-id" : "a0e71879-feb1-4671-9669-585895d909ae", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"sentiment\":\"mixed\",\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":0,\"length\":31,\"text\":\"The hotel was dark and unclean.\",\"aspects\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"negative\":1.0},\"offset\":4,\"length\":5,\"text\":\"hotel\",\"relations\":[{\"relationType\":\"opinion\",\"ref\":\"#/documents/0/sentences/0/opinions/0\"},{\"relationType\":\"opinion\",\"ref\":\"#/documents/0/sentences/0/opinions/1\"}]}],\"opinions\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"negative\":1.0},\"offset\":14,\"length\":4,\"text\":\"dark\",\"isNegated\":false},{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"negative\":1.0},\"offset\":23,\"length\":7,\"text\":\"unclean\",\"isNegated\":false}]},{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":32,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\",\"aspects\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"negative\":0.0},\"offset\":59,\"length\":7,\"text\":\"gnocchi\",\"relations\":[{\"relationType\":\"opinion\",\"ref\":\"#/documents/0/sentences/1/opinions/0\"}]}],\"opinions\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"negative\":0.0},\"offset\":51,\"length\":7,\"text\":\"amazing\",\"isNegated\":false}]}],\"warnings\":[]},{\"id\":\"1\",\"sentiment\":\"mixed\",\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":0,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\",\"aspects\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"negative\":0.0},\"offset\":27,\"length\":7,\"text\":\"gnocchi\",\"relations\":[{\"relationType\":\"opinion\",\"ref\":\"#/documents/1/sentences/0/opinions/0\"}]}],\"opinions\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"negative\":0.0},\"offset\":19,\"length\":7,\"text\":\"amazing\",\"isNegated\":false}]},{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":36,\"length\":31,\"text\":\"The hotel was dark and unclean.\",\"aspects\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"negative\":1.0},\"offset\":40,\"length\":5,\"text\":\"hotel\",\"relations\":[{\"relationType\":\"opinion\",\"ref\":\"#/documents/1/sentences/1/opinions/0\"},{\"relationType\":\"opinion\",\"ref\":\"#/documents/1/sentences/1/opinions/1\"}]}],\"opinions\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"negative\":1.0},\"offset\":50,\"length\":4,\"text\":\"dark\",\"isNegated\":false},{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"negative\":1.0},\"offset\":59,\"length\":7,\"text\":\"unclean\",\"isNegated\":false}]}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}", - "Date" : "Thu, 03 Sep 2020 19:04:00 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForListStringShowStatisticsAndIncludeOpinionMining.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForListStringShowStatisticsAndIncludeOpinionMining.json deleted file mode 100644 index 23e3a7e708f01..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForListStringShowStatisticsAndIncludeOpinionMining.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//sentiment?showStats=true&opinionMining=true&stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "1ddf7dba-de38-4b70-af2f-d7338f676beb", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "85", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", - "apim-request-id" : "1dbdc0e4-a92b-414c-a5fd-01bfaa539ec3", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"statistics\":{\"documentsCount\":2,\"validDocumentsCount\":2,\"erroneousDocumentsCount\":0,\"transactionsCount\":2},\"documents\":[{\"id\":\"0\",\"sentiment\":\"mixed\",\"statistics\":{\"charactersCount\":67,\"transactionsCount\":1},\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":0,\"length\":31,\"text\":\"The hotel was dark and unclean.\",\"aspects\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"negative\":1.0},\"offset\":4,\"length\":5,\"text\":\"hotel\",\"relations\":[{\"relationType\":\"opinion\",\"ref\":\"#/documents/0/sentences/0/opinions/0\"},{\"relationType\":\"opinion\",\"ref\":\"#/documents/0/sentences/0/opinions/1\"}]}],\"opinions\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"negative\":1.0},\"offset\":14,\"length\":4,\"text\":\"dark\",\"isNegated\":false},{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"negative\":1.0},\"offset\":23,\"length\":7,\"text\":\"unclean\",\"isNegated\":false}]},{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":32,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\",\"aspects\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"negative\":0.0},\"offset\":59,\"length\":7,\"text\":\"gnocchi\",\"relations\":[{\"relationType\":\"opinion\",\"ref\":\"#/documents/0/sentences/1/opinions/0\"}]}],\"opinions\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"negative\":0.0},\"offset\":51,\"length\":7,\"text\":\"amazing\",\"isNegated\":false}]}],\"warnings\":[]},{\"id\":\"1\",\"sentiment\":\"mixed\",\"statistics\":{\"charactersCount\":67,\"transactionsCount\":1},\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":0,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\",\"aspects\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"negative\":0.0},\"offset\":27,\"length\":7,\"text\":\"gnocchi\",\"relations\":[{\"relationType\":\"opinion\",\"ref\":\"#/documents/1/sentences/0/opinions/0\"}]}],\"opinions\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"negative\":0.0},\"offset\":19,\"length\":7,\"text\":\"amazing\",\"isNegated\":false}]},{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":36,\"length\":31,\"text\":\"The hotel was dark and unclean.\",\"aspects\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"negative\":1.0},\"offset\":40,\"length\":5,\"text\":\"hotel\",\"relations\":[{\"relationType\":\"opinion\",\"ref\":\"#/documents/1/sentences/1/opinions/0\"},{\"relationType\":\"opinion\",\"ref\":\"#/documents/1/sentences/1/opinions/1\"}]}],\"opinions\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"negative\":1.0},\"offset\":50,\"length\":4,\"text\":\"dark\",\"isNegated\":false},{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"negative\":1.0},\"offset\":59,\"length\":7,\"text\":\"unclean\",\"isNegated\":false}]}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}", - "Date" : "Thu, 03 Sep 2020 19:04:06 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForListStringWithLanguageHint.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForListStringWithLanguageHint.json deleted file mode 100644 index 375f3391c7617..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForListStringWithLanguageHint.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//sentiment?showStats=false&opinionMining=false&stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "eeeb8809-db08-434d-9a04-72d93a5e25d5", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "82", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", - "apim-request-id" : "01173e0a-b07b-4057-aad5-c2de004dda97", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"sentiment\":\"mixed\",\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":0,\"length\":31,\"text\":\"The hotel was dark and unclean.\"},{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":32,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\"}],\"warnings\":[]},{\"id\":\"1\",\"sentiment\":\"mixed\",\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":0,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\"},{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":36,\"length\":31,\"text\":\"The hotel was dark and unclean.\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}", - "Date" : "Thu, 03 Sep 2020 19:03:59 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForListStringShowStatisticsExcludeOpinionMining.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForListStringWithOptions.json similarity index 77% rename from sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForListStringShowStatisticsExcludeOpinionMining.json rename to sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForListStringWithOptions.json index 929d332bb75a1..0e5fe7cae062f 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForListStringShowStatisticsExcludeOpinionMining.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForListStringWithOptions.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//sentiment?showStats=true&opinionMining=false&stringIndexType=Utf16CodeUnit", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//sentiment?showStats=true", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "7d04a7af-12f2-4105-baf7-e843ca68421d", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "7a71ad5f-9e38-46d3-a97f-7d22b6be4147", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "91", + "x-envoy-upstream-service-time" : "116", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", - "apim-request-id" : "b146517e-ff23-4ec5-9240-6a2e71c5ad39", + "apim-request-id" : "f81daae1-a4e8-4afa-be62-a6b466a0c7b5", "retry-after" : "0", "StatusCode" : "200", - "Body" : "{\"statistics\":{\"documentsCount\":2,\"validDocumentsCount\":2,\"erroneousDocumentsCount\":0,\"transactionsCount\":2},\"documents\":[{\"id\":\"0\",\"sentiment\":\"mixed\",\"statistics\":{\"charactersCount\":67,\"transactionsCount\":1},\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":0,\"length\":31,\"text\":\"The hotel was dark and unclean.\"},{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":32,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\"}],\"warnings\":[]},{\"id\":\"1\",\"sentiment\":\"mixed\",\"statistics\":{\"charactersCount\":67,\"transactionsCount\":1},\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":0,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\"},{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":36,\"length\":31,\"text\":\"The hotel was dark and unclean.\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}", - "Date" : "Thu, 03 Sep 2020 19:03:55 GMT", + "Body" : "{\"statistics\":{\"documentsCount\":2,\"validDocumentsCount\":2,\"erroneousDocumentsCount\":0,\"transactionsCount\":2},\"documents\":[{\"id\":\"0\",\"sentiment\":\"mixed\",\"statistics\":{\"charactersCount\":67,\"transactionsCount\":1},\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":0,\"length\":31,\"text\":\"The hotel was dark and unclean.\"},{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":32,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\"}],\"warnings\":[]},{\"id\":\"1\",\"sentiment\":\"mixed\",\"statistics\":{\"charactersCount\":67,\"transactionsCount\":1},\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":0,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\"},{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":36,\"length\":31,\"text\":\"The hotel was dark and unclean.\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Wed, 29 Apr 2020 17:12:20 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForTextInput.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForTextInput.json index 63d086299c6c7..98a159515f80e 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForTextInput.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForTextInput.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//sentiment?stringIndexType=Utf16CodeUnit", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//sentiment", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "9e3d2772-dac1-4494-a88f-a2858f74c67c", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "3a1c8bc7-9278-4a60-8baa-c5c304b349f3", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "86", + "x-envoy-upstream-service-time" : "116", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "77aa98c3-b571-4f66-a3e9-877b434184da", + "apim-request-id" : "75039135-fa22-4c6c-825d-6452b99e24ca", "retry-after" : "0", "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"sentiment\":\"mixed\",\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":0,\"length\":31,\"text\":\"The hotel was dark and unclean.\"},{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":32,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}", - "Date" : "Thu, 03 Sep 2020 19:04:03 GMT", + "Body" : "{\"documents\":[{\"id\":\"0\",\"sentiment\":\"mixed\",\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":0,\"length\":31,\"text\":\"The hotel was dark and unclean.\"},{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":32,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Wed, 29 Apr 2020 17:12:19 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForTextInputWithDefaultLanguageHint.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForTextInputWithDefaultLanguageHint.json deleted file mode 100644 index 6dce9e2c66d5a..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForTextInputWithDefaultLanguageHint.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//sentiment?stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "5c51283b-1648-44c6-8694-5520ebb725e8", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "95", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "3f66e0b8-8320-493d-b7e3-56dc0dada3ae", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"sentiment\":\"mixed\",\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":0,\"length\":31,\"text\":\"The hotel was dark and unclean.\"},{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":32,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}", - "Date" : "Thu, 03 Sep 2020 19:04:05 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForTextInputWithOpinionMining.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForTextInputWithOpinionMining.json deleted file mode 100644 index 2b6626a1fa2ff..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForTextInputWithOpinionMining.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//sentiment?showStats=false&opinionMining=true&stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "8dc4b5aa-7cb5-46f9-bb31-632c3b2a4918", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "100", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "42ecb5a9-ad62-474d-a72b-7f7dc9e93078", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"sentiment\":\"mixed\",\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":0,\"length\":31,\"text\":\"The hotel was dark and unclean.\",\"aspects\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"negative\":1.0},\"offset\":4,\"length\":5,\"text\":\"hotel\",\"relations\":[{\"relationType\":\"opinion\",\"ref\":\"#/documents/0/sentences/0/opinions/0\"},{\"relationType\":\"opinion\",\"ref\":\"#/documents/0/sentences/0/opinions/1\"}]}],\"opinions\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"negative\":1.0},\"offset\":14,\"length\":4,\"text\":\"dark\",\"isNegated\":false},{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"negative\":1.0},\"offset\":23,\"length\":7,\"text\":\"unclean\",\"isNegated\":false}]},{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":32,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\",\"aspects\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"negative\":0.0},\"offset\":59,\"length\":7,\"text\":\"gnocchi\",\"relations\":[{\"relationType\":\"opinion\",\"ref\":\"#/documents/0/sentences/1/opinions/0\"}]}],\"opinions\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"negative\":0.0},\"offset\":51,\"length\":7,\"text\":\"amazing\",\"isNegated\":false}]}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}", - "Date" : "Thu, 03 Sep 2020 19:03:50 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentKoreanNfc.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentKoreanNfc.json deleted file mode 100644 index 0a5a112078dde..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentKoreanNfc.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//sentiment?stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "a49433b3-0322-4693-b89d-f2581e0f761c", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "83", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "b0201888-b6f0-443d-9e7e-b5ad6ab7d84f", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"sentences\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":0,\"length\":34,\"text\":\"아가 The hotel was dark and unclean.\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}", - "Date" : "Thu, 03 Sep 2020 17:49:55 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentKoreanNfd.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentKoreanNfd.json deleted file mode 100644 index 69bfb11171059..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentKoreanNfd.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//sentiment?stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "1674b82d-4585-4f6b-aac7-3cb3e3a8fda4", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "91", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "4f46bebf-4001-4702-b805-d009656cb164", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"sentences\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":0,\"length\":34,\"text\":\"아가 The hotel was dark and unclean.\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}", - "Date" : "Thu, 03 Sep 2020 17:49:55 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentZalgoText.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentZalgoText.json deleted file mode 100644 index c068fa3c74722..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentZalgoText.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//sentiment?stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "ee22488f-8cbb-4e00-87ba-98749c645b14", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "81", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "5737603d-ebc9-4b89-9583-8bc2eb07d3c3", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"sentences\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":0,\"length\":147,\"text\":\"ơ̵̧̧̢̳̘̘͕͔͕̭̟̙͎͈̞͔̈̇̒̃͋̇̅͛̋͛̎́͑̄̐̂̎͗͝m̵͍͉̗̄̏͌̂̑̽̕͝͠g̵̢̡̢̡̨̡̧̛͉̞̯̠̤̣͕̟̫̫̼̰͓̦͖̣̣͎̋͒̈́̓̒̈̍̌̓̅͑̒̓̅̅͒̿̏́͗̀̇͛̏̀̈́̀̊̾̀̔͜͠͝ͅ The hotel was dark and unclean.\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}", - "Date" : "Thu, 03 Sep 2020 17:50:13 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithDefaultCountryHint.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithDefaultCountryHint.json index e159a49d0c8e2..474e09f6baf73 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithDefaultCountryHint.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithDefaultCountryHint.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//languages", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//languages", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "f7eccc75-2242-4798-9fef-4c73f5b32665", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "d29baca1-0bf4-47f1-927d-f04f6f2f1f43", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "7", + "x-envoy-upstream-service-time" : "3", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "dec2687f-0d06-43cd-bfd7-e9d1230c923a", + "apim-request-id" : "219091a3-23fd-4e8f-af46-51788a011907", "retry-after" : "0", "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"detectedLanguage\":{\"name\":\"Spanish\",\"iso6391Name\":\"es\",\"confidenceScore\":1.0},\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-07-01\"}", - "Date" : "Tue, 01 Sep 2020 06:14:58 GMT", + "Body" : "{\"documents\":[{\"id\":\"0\",\"detectedLanguage\":{\"name\":\"Spanish\",\"iso6391Name\":\"es\",\"confidenceScore\":1.0},\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Wed, 29 Apr 2020 17:12:17 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithDefaultCountryHintForBatchOperation.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithDefaultCountryHintForBatchOperation.json index f6fd9ef8f30d9..e5982a5888669 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithDefaultCountryHintForBatchOperation.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithDefaultCountryHintForBatchOperation.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//languages", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//languages", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "5134811a-6154-40d9-8299-9097dcbc6783", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "0e50d1aa-13ce-4b88-aa46-cb6786bc979e", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "8", + "x-envoy-upstream-service-time" : "2", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", - "apim-request-id" : "a1aca27a-893b-45b9-8b82-202920a2bddd", + "apim-request-id" : "0dbd716c-942a-46fd-abca-a903c3e12a1d", "retry-after" : "0", "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"detectedLanguage\":{\"name\":\"Spanish\",\"iso6391Name\":\"es\",\"confidenceScore\":1.0},\"warnings\":[]},{\"id\":\"1\",\"detectedLanguage\":{\"name\":\"Spanish\",\"iso6391Name\":\"es\",\"confidenceScore\":1.0},\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-07-01\"}", - "Date" : "Tue, 01 Sep 2020 06:14:57 GMT", + "Body" : "{\"documents\":[{\"id\":\"0\",\"detectedLanguage\":{\"name\":\"Spanish\",\"iso6391Name\":\"es\",\"confidenceScore\":1.0},\"warnings\":[]},{\"id\":\"1\",\"detectedLanguage\":{\"name\":\"Spanish\",\"iso6391Name\":\"es\",\"confidenceScore\":1.0},\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Wed, 29 Apr 2020 17:12:17 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithDefaultLanguage.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithDefaultLanguage.json index adddd014a8efc..cb08dfb81944e 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithDefaultLanguage.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithDefaultLanguage.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//keyPhrases", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//keyPhrases", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "0a456e2a-dbf9-40f9-b9df-f54fce09cf02", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "d2a6d6de-e582-4584-87f8-129704d4a54a", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "7", + "x-envoy-upstream-service-time" : "2", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "981d941e-cc58-4188-8e49-8578836c7f39", + "apim-request-id" : "39eb45d0-ea4e-4ed5-88b3-be834a3329b1", "retry-after" : "0", "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"keyPhrases\":[\"Mondly\"],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-07-01\"}", - "Date" : "Tue, 01 Sep 2020 06:14:58 GMT", + "Body" : "{\"documents\":[{\"id\":\"0\",\"keyPhrases\":[\"Mondly\"],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Wed, 29 Apr 2020 17:12:18 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithDefaultLanguageForBatchOperation.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithDefaultLanguageForBatchOperation.json index 087584d7263c3..96ed69d31d140 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithDefaultLanguageForBatchOperation.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithDefaultLanguageForBatchOperation.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//keyPhrases", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//keyPhrases", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "3f758411-44a1-4f9b-99cf-aff644ea13d8", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "5cf9ac37-da20-4c6b-9f71-ab4b9fa90e83", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "6", + "x-envoy-upstream-service-time" : "4", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", - "apim-request-id" : "695b93f6-aab7-499e-bca3-15fad420625e", + "apim-request-id" : "f57d2158-f80f-4193-a069-ec2f610974b0", "retry-after" : "0", "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"keyPhrases\":[\"monde\"],\"warnings\":[]},{\"id\":\"1\",\"keyPhrases\":[\"Mondly\"],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-07-01\"}", - "Date" : "Tue, 01 Sep 2020 06:14:58 GMT", + "Body" : "{\"documents\":[{\"id\":\"0\",\"keyPhrases\":[\"monde\"],\"warnings\":[]},{\"id\":\"1\",\"keyPhrases\":[\"Mondly\"],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Wed, 29 Apr 2020 17:12:17 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithDefaultPipeline.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithDefaultPipeline.json index 0ec074b2977cf..0002fdce69f26 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithDefaultPipeline.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithDefaultPipeline.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//languages", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//languages", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "8d4945bf-584b-46e4-a696-744d148e46b8", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "1d791e03-8ed9-4525-b738-129fc648fb45", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "8", + "x-envoy-upstream-service-time" : "3", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "362d5603-705f-49f9-9d43-2a4dcad800ce", + "apim-request-id" : "3cab5f4e-4710-43a9-acbd-bbed7e479147", "retry-after" : "0", "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"detectedLanguage\":{\"name\":\"English\",\"iso6391Name\":\"en\",\"confidenceScore\":1.0},\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-07-01\"}", - "Date" : "Tue, 01 Sep 2020 06:14:57 GMT", + "Body" : "{\"documents\":[{\"id\":\"0\",\"detectedLanguage\":{\"name\":\"English\",\"iso6391Name\":\"en\",\"confidenceScore\":1.0},\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Wed, 29 Apr 2020 17:12:17 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithInvalidApiKeyCredential.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithInvalidApiKeyCredential.json index 083a2cb08bcbb..04880f0930333 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithInvalidApiKeyCredential.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithInvalidApiKeyCredential.json @@ -1,18 +1,23 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//languages", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//languages", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "5a0bf3eb-e79f-4913-976d-18d81ee584d5", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "7668c3a1-18fe-4517-aec6-807f6464d047", "Content-Type" : "application/json" }, "Response" : { + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "2ef43920-d9b5-4c04-bb25-834463644188", + "WWW-Authenticate" : "AzureApiManagementKey realm=\"https://westus2.ppe.cognitiveservices.azure.com/text/analytics\",name=\"Ocp-Apim-Subscription-Key\",type=\"header\"", "retry-after" : "0", - "Content-Length" : "224", + "Content-Length" : "225", "StatusCode" : "401", - "Body" : "{\"error\":{\"code\":\"401\",\"message\":\"Access denied due to invalid subscription key or wrong API endpoint. Make sure to provide a valid key for an active subscription and use a correct regional API endpoint for your resource.\"}}", - "Date" : "Tue, 01 Sep 2020 06:14:58 GMT" + "Body" : "{\"error\":{\"code\":\"401\",\"message\": \"Access denied due to invalid subscription key or wrong API endpoint. Make sure to provide a valid key for an active subscription and use a correct regional API endpoint for your resource.\"}}", + "Date" : "Wed, 29 Apr 2020 17:12:18 GMT", + "Content-Type" : "application/json" }, "Exception" : null } ], diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithNewCountryHint.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithNewCountryHint.json index ec34ecc214f46..13d83b442b6d1 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithNewCountryHint.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithNewCountryHint.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//languages", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//languages", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "9e864f6e-94c8-4e8b-bb3b-02fd4db3ad23", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "ec96c7c2-36eb-4a6b-9fa2-0761348f2233", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "7", + "x-envoy-upstream-service-time" : "2", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "a5e4b3a2-9c2d-422c-aa41-e891ca42e825", + "apim-request-id" : "8b6a679f-87fb-4b48-8de6-d733c232700f", "retry-after" : "0", "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"detectedLanguage\":{\"name\":\"Spanish\",\"iso6391Name\":\"es\",\"confidenceScore\":1.0},\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-07-01\"}", - "Date" : "Tue, 01 Sep 2020 06:14:58 GMT", + "Body" : "{\"documents\":[{\"id\":\"0\",\"detectedLanguage\":{\"name\":\"Spanish\",\"iso6391Name\":\"es\",\"confidenceScore\":1.0},\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Wed, 29 Apr 2020 17:12:18 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithNewCountryHintForBatchOperation.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithNewCountryHintForBatchOperation.json index 7ec3e78527352..9a167ad1897a4 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithNewCountryHintForBatchOperation.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithNewCountryHintForBatchOperation.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//languages", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//languages", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "b34c63b0-9733-4698-9e37-bd7eb0e7daa5", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "ea9b85d5-fd0b-4b53-91e8-ebc4d05c664a", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "7", + "x-envoy-upstream-service-time" : "2", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", - "apim-request-id" : "17c77533-9b69-4ab1-94b4-27007db1e357", + "apim-request-id" : "2d4567a0-347c-4706-8772-1b84e5c92e32", "retry-after" : "0", "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"detectedLanguage\":{\"name\":\"English\",\"iso6391Name\":\"en\",\"confidenceScore\":0.58},\"warnings\":[]},{\"id\":\"1\",\"detectedLanguage\":{\"name\":\"English\",\"iso6391Name\":\"en\",\"confidenceScore\":0.9},\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-07-01\"}", - "Date" : "Tue, 01 Sep 2020 06:14:58 GMT", + "Body" : "{\"documents\":[{\"id\":\"0\",\"detectedLanguage\":{\"name\":\"English\",\"iso6391Name\":\"en\",\"confidenceScore\":1.0},\"warnings\":[]},{\"id\":\"1\",\"detectedLanguage\":{\"name\":\"English\",\"iso6391Name\":\"en\",\"confidenceScore\":1.0},\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Wed, 29 Apr 2020 17:12:17 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithNewLanguage.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithNewLanguage.json index 4fb2138eb3f2d..46528694c0674 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithNewLanguage.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithNewLanguage.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//keyPhrases", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//keyPhrases", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "d295894b-41e9-49bc-a5ba-2739e06a8428", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "5e23dec1-dd4a-415e-b600-e109fc2f925c", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "9", + "x-envoy-upstream-service-time" : "3", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "3215e239-4127-423a-be8a-428f03491c57", + "apim-request-id" : "5a8ac46c-9125-46d2-804b-8e08fdc03089", "retry-after" : "0", "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"keyPhrases\":[\"Je m'appelle Mondly\"],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-07-01\"}", - "Date" : "Tue, 01 Sep 2020 06:14:58 GMT", + "Body" : "{\"documents\":[{\"id\":\"0\",\"keyPhrases\":[\"Je m'appelle Mondly\"],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Wed, 29 Apr 2020 17:12:18 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithNewLanguageForBatchOperation.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithNewLanguageForBatchOperation.json index 1ed06f6f063f0..a717ba37d52a4 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithNewLanguageForBatchOperation.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithNewLanguageForBatchOperation.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//keyPhrases", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//keyPhrases", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "7d02effa-9a18-46b4-b91e-9b4bba11d129", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "c0635dfd-294d-4cee-bb49-56849619da59", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "7", + "x-envoy-upstream-service-time" : "3", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", - "apim-request-id" : "1e0a1388-11d9-4157-a874-0942ec234d07", + "apim-request-id" : "723acc13-583f-435c-bb27-9fe3bd416fe9", "retry-after" : "0", "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"keyPhrases\":[\"monde\"],\"warnings\":[]},{\"id\":\"1\",\"keyPhrases\":[\"Je m'appelle Mondly\"],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-07-01\"}", - "Date" : "Tue, 01 Sep 2020 06:14:57 GMT", + "Body" : "{\"documents\":[{\"id\":\"0\",\"keyPhrases\":[\"monde\"],\"warnings\":[]},{\"id\":\"1\",\"keyPhrases\":[\"Je m'appelle Mondly\"],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Wed, 29 Apr 2020 17:12:17 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithNullServiceVersion.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithNullServiceVersion.json index 66c633883cd2c..b130c60189f8a 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithNullServiceVersion.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithNullServiceVersion.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//languages", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//languages", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "7c7662a0-ae4f-4201-bee5-23f4fd74b7c6", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "c26cf288-c912-49f8-89db-f4e93a69ef4e", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "7", + "x-envoy-upstream-service-time" : "2", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "01230994-2ab5-496a-b186-db815d02bd25", + "apim-request-id" : "3e7b8e1a-71c0-4cd5-b5b3-8ca28fe65a0a", "retry-after" : "0", "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"detectedLanguage\":{\"name\":\"English\",\"iso6391Name\":\"en\",\"confidenceScore\":1.0},\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-07-01\"}", - "Date" : "Tue, 01 Sep 2020 06:14:57 GMT", + "Body" : "{\"documents\":[{\"id\":\"0\",\"detectedLanguage\":{\"name\":\"English\",\"iso6391Name\":\"en\",\"confidenceScore\":1.0},\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Wed, 29 Apr 2020 17:12:17 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithRotateToInvalidKey.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithRotateToInvalidKey.json index c339b49c0c498..29c306958b925 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithRotateToInvalidKey.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithRotateToInvalidKey.json @@ -1,18 +1,23 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//languages", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//languages", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "3cea85e5-707c-4377-acd6-e0c2c776aba2", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "7263d388-8337-4f34-bd89-091877803b4e", "Content-Type" : "application/json" }, "Response" : { + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "8b1cf6a6-aa5b-44b4-8c44-8ab8038c5913", + "WWW-Authenticate" : "AzureApiManagementKey realm=\"https://westus2.ppe.cognitiveservices.azure.com/text/analytics\",name=\"Ocp-Apim-Subscription-Key\",type=\"header\"", "retry-after" : "0", - "Content-Length" : "224", + "Content-Length" : "225", "StatusCode" : "401", - "Body" : "{\"error\":{\"code\":\"401\",\"message\":\"Access denied due to invalid subscription key or wrong API endpoint. Make sure to provide a valid key for an active subscription and use a correct regional API endpoint for your resource.\"}}", - "Date" : "Tue, 01 Sep 2020 06:14:58 GMT" + "Body" : "{\"error\":{\"code\":\"401\",\"message\": \"Access denied due to invalid subscription key or wrong API endpoint. Make sure to provide a valid key for an active subscription and use a correct regional API endpoint for your resource.\"}}", + "Date" : "Wed, 29 Apr 2020 17:12:18 GMT", + "Content-Type" : "application/json" }, "Exception" : null } ], diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithRotateToValidKey.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithRotateToValidKey.json index dd41b509d77d9..038740b6f6fc5 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithRotateToValidKey.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithRotateToValidKey.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//languages", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//languages", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "b0d78eda-3f6b-4683-b017-36d0641f26b2", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "bd554a3b-56e6-428a-b9c1-ca85499d1396", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "7", + "x-envoy-upstream-service-time" : "3", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "0f69d279-9ab6-44ae-b0e0-9c37e52546bb", + "apim-request-id" : "814618b0-a84b-4329-8bf1-5c6b00e7dc2b", "retry-after" : "0", "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"detectedLanguage\":{\"name\":\"English\",\"iso6391Name\":\"en\",\"confidenceScore\":1.0},\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-07-01\"}", - "Date" : "Tue, 01 Sep 2020 06:14:57 GMT", + "Body" : "{\"documents\":[{\"id\":\"0\",\"detectedLanguage\":{\"name\":\"English\",\"iso6391Name\":\"en\",\"confidenceScore\":1.0},\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Wed, 29 Apr 2020 17:12:17 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithValidApiKeyCredential.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithValidApiKeyCredential.json index c76ca619e539c..e0f2a7a8be6d1 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithValidApiKeyCredential.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/clientBuilderWithValidApiKeyCredential.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//languages", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//languages", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "cb931e99-7541-41b1-a08d-dbe338dcfe72", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "15007527-5e92-4b9e-9a43-4ff1a2153247", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "7", + "x-envoy-upstream-service-time" : "2", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "833c1672-d889-478c-89fa-9156d3ee63dd", + "apim-request-id" : "6a90988f-83ad-4a6f-9598-62c3a5958ff7", "retry-after" : "0", "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"detectedLanguage\":{\"name\":\"English\",\"iso6391Name\":\"en\",\"confidenceScore\":1.0},\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-07-01\"}", - "Date" : "Tue, 01 Sep 2020 06:14:57 GMT", + "Body" : "{\"documents\":[{\"id\":\"0\",\"detectedLanguage\":{\"name\":\"English\",\"iso6391Name\":\"en\",\"confidenceScore\":1.0},\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Wed, 29 Apr 2020 17:12:17 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguageDuplicateIdInput.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguageDuplicateIdInput.json index 6e0a37ef65a0b..0129d844b940b 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguageDuplicateIdInput.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguageDuplicateIdInput.json @@ -1,22 +1,22 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//languages", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//languages", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "20f05c0a-4717-48a3-9e72-378a5c2c512d", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "b27774bc-d2d4-4f86-94fa-8af830bf480f", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "5", + "x-envoy-upstream-service-time" : "131", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", - "apim-request-id" : "8850792e-52e0-4b9f-9f50-f6dbf5a8f283", + "apim-request-id" : "0c3ce8d9-fd5f-4ee9-9148-ef246412161d", "retry-after" : "0", "StatusCode" : "400", - "Body" : "{\"error\":{\"code\":\"InvalidRequest\",\"message\":\"Invalid document in request.\",\"innererror\":{\"code\":\"InvalidDocument\",\"message\":\"Request contains duplicated Ids. Make sure each document has a unique Id.\"}}}", - "Date" : "Tue, 01 Sep 2020 06:14:53 GMT", + "Body" : "{\"error\":{\"code\":\"InvalidRequest\",\"message\":\"Invalid document in request.\",\"innerError\":{\"code\":\"InvalidDocument\",\"message\":\"Request contains duplicated Ids. Make sure each document has a unique Id.\"}}}", + "Date" : "Thu, 30 Apr 2020 03:19:53 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguageEmptyCountryHint.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguageEmptyCountryHint.json index 6f6843971e4a6..171ff3acffe4f 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguageEmptyCountryHint.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguageEmptyCountryHint.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//languages", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//languages", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "d36aa3f3-f430-492a-8c2b-47c01c84858e", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "fc50ed8b-a253-44a0-9a3d-b3ddf8b735ad", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "7", + "x-envoy-upstream-service-time" : "2", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "43ab9dd8-3534-48ad-8bb5-66161f08cdc2", + "apim-request-id" : "29ffb9f3-a27e-4153-a3b7-e9b81394c68e", "retry-after" : "0", "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"detectedLanguage\":{\"name\":\"Spanish\",\"iso6391Name\":\"es\",\"confidenceScore\":1.0},\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-07-01\"}", - "Date" : "Tue, 01 Sep 2020 06:14:53 GMT", + "Body" : "{\"documents\":[{\"id\":\"0\",\"detectedLanguage\":{\"name\":\"Spanish\",\"iso6391Name\":\"es\",\"confidenceScore\":1.0},\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Wed, 29 Apr 2020 17:12:19 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguageEmptyIdInput.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguageEmptyIdInput.json deleted file mode 100644 index e867b0d3be148..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguageEmptyIdInput.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//languages", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "83b94598-4918-47c8-b7c9-4509a386319a", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "5", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "apim-request-id" : "1639c8dd-3d17-49d6-8107-eace4ec93a7f", - "retry-after" : "0", - "StatusCode" : "400", - "Body" : "{\"error\":{\"code\":\"InvalidRequest\",\"message\":\"Invalid document in request.\",\"innererror\":{\"code\":\"InvalidDocument\",\"message\":\"At least one document is missing an Id attribute.\"}}}", - "Date" : "Tue, 01 Sep 2020 06:14:54 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguageEmptyText.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguageEmptyText.json index b671815b41807..dfa19617cca60 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguageEmptyText.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguageEmptyText.json @@ -1,22 +1,23 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//languages", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//languages", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "e0638242-e3f4-40e7-a09d-9d50ccd8f0c5", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "fda541db-a54d-40ce-9af8-9c7c31b6720b", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "2", + "x-envoy-upstream-service-time" : "3", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", - "apim-request-id" : "904d2fe7-31d8-4be9-8ddf-a094b7ffe8ce", + "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=0", + "apim-request-id" : "67ed867c-981d-459c-b069-8a83a61f7fbb", "retry-after" : "0", "StatusCode" : "200", - "Body" : "{\"documents\":[],\"errors\":[{\"id\":\"0\",\"error\":{\"code\":\"InvalidArgument\",\"message\":\"Invalid document in request.\",\"innererror\":{\"code\":\"InvalidDocument\",\"message\":\"Document text is empty.\"}}}],\"modelVersion\":\"2020-07-01\"}", - "Date" : "Tue, 01 Sep 2020 06:14:51 GMT", + "Body" : "{\"documents\":[],\"errors\":[{\"id\":\"0\",\"error\":{\"code\":\"InvalidArgument\",\"message\":\"Invalid document in request.\",\"innererror\":{\"code\":\"InvalidDocument\",\"message\":\"Document text is empty.\"}}}],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Wed, 29 Apr 2020 17:12:19 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguageFaultyText.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguageFaultyText.json index a99e0cd69703e..cd50802112dc7 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguageFaultyText.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguageFaultyText.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//languages", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//languages", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "4580fddf-92c5-4e5b-9352-e65a443d496c", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "b4798dac-a6de-414c-b454-9015fc274e4c", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "7", + "x-envoy-upstream-service-time" : "3", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "5ab6b35f-6d47-4e90-8aee-3e8fe1ea6877", + "apim-request-id" : "8464a8c1-5b12-43ed-83ba-57ae307d8daa", "retry-after" : "0", "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"detectedLanguage\":{\"name\":\"(Unknown)\",\"iso6391Name\":\"(Unknown)\",\"confidenceScore\":0.0},\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-07-01\"}", - "Date" : "Tue, 01 Sep 2020 06:14:57 GMT", + "Body" : "{\"documents\":[{\"id\":\"0\",\"detectedLanguage\":{\"name\":\"(Unknown)\",\"iso6391Name\":\"(Unknown)\",\"confidenceScore\":0.0},\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Wed, 29 Apr 2020 17:12:20 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguageInvalidCountryHint.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguageInvalidCountryHint.json index 4c0d4581629c1..7053f03099883 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguageInvalidCountryHint.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguageInvalidCountryHint.json @@ -1,10 +1,10 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//languages", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//languages", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "9722e589-4af5-4cbf-b68c-ed640ac0bf3b", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "b9cbba15-0057-4127-adf9-02a6573dbf20", "Content-Type" : "application/json" }, "Response" : { @@ -12,11 +12,12 @@ "x-envoy-upstream-service-time" : "2", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", - "apim-request-id" : "75fdced4-d890-4c82-bd91-a286751c09b0", + "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=0", + "apim-request-id" : "d3048c6a-f280-4303-a500-6fbe274e42de", "retry-after" : "0", "StatusCode" : "200", - "Body" : "{\"documents\":[],\"errors\":[{\"id\":\"0\",\"error\":{\"code\":\"InvalidArgument\",\"message\":\"Invalid Country Hint.\",\"innererror\":{\"code\":\"InvalidCountryHint\",\"message\":\"Country hint is not valid. Please specify an ISO 3166-1 alpha-2 two letter country code.\"}}}],\"modelVersion\":\"2020-07-01\"}", - "Date" : "Tue, 01 Sep 2020 06:14:56 GMT", + "Body" : "{\"documents\":[],\"errors\":[{\"id\":\"0\",\"error\":{\"code\":\"InvalidArgument\",\"message\":\"Invalid Country Hint.\",\"innererror\":{\"code\":\"InvalidCountryHint\",\"message\":\"Country hint is not valid. Please specify an ISO 3166-1 alpha-2 two letter country code.\"}}}],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Wed, 29 Apr 2020 17:12:20 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguageNoneCountryHint.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguageNoneCountryHint.json index 8453f660aa681..6c14fdd167380 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguageNoneCountryHint.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguageNoneCountryHint.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//languages", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//languages", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "efae7fbe-55cf-4b26-8592-45f9c021ef90", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "b85ce7a1-93c9-4757-ae1e-8aa42c1efb2f", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "7", + "x-envoy-upstream-service-time" : "2", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "63266073-b00e-4161-87e1-8846c1172735", + "apim-request-id" : "650c3b64-125a-4045-aded-945ff682c6aa", "retry-after" : "0", "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"detectedLanguage\":{\"name\":\"Spanish\",\"iso6391Name\":\"es\",\"confidenceScore\":1.0},\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-07-01\"}", - "Date" : "Tue, 01 Sep 2020 06:14:47 GMT", + "Body" : "{\"documents\":[{\"id\":\"0\",\"detectedLanguage\":{\"name\":\"Spanish\",\"iso6391Name\":\"es\",\"confidenceScore\":1.0},\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Wed, 29 Apr 2020 17:12:18 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguagesBatchInput.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguagesBatchInput.json index f032a64da886c..a0acc03c88e35 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguagesBatchInput.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguagesBatchInput.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//languages", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//languages", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "059dde47-14a3-4a5a-a3d4-99aee2f4d13b", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "944c5c64-c881-4308-a447-816f72df9ab0", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "9", + "x-envoy-upstream-service-time" : "3", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=3", - "apim-request-id" : "323dd16a-3faf-4ea1-b84f-2ee00d4bba7a", + "apim-request-id" : "52ef94e1-4b42-49db-b8f2-5bd6bfed78de", "retry-after" : "0", "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"detectedLanguage\":{\"name\":\"English\",\"iso6391Name\":\"en\",\"confidenceScore\":1.0},\"warnings\":[]},{\"id\":\"1\",\"detectedLanguage\":{\"name\":\"Spanish\",\"iso6391Name\":\"es\",\"confidenceScore\":1.0},\"warnings\":[]},{\"id\":\"2\",\"detectedLanguage\":{\"name\":\"Polish\",\"iso6391Name\":\"pl\",\"confidenceScore\":0.4},\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-07-01\"}", - "Date" : "Tue, 01 Sep 2020 06:14:57 GMT", + "Body" : "{\"documents\":[{\"id\":\"0\",\"detectedLanguage\":{\"name\":\"English\",\"iso6391Name\":\"en\",\"confidenceScore\":1.0},\"warnings\":[]},{\"id\":\"1\",\"detectedLanguage\":{\"name\":\"Spanish\",\"iso6391Name\":\"es\",\"confidenceScore\":1.0},\"warnings\":[]},{\"id\":\"2\",\"detectedLanguage\":{\"name\":\"(Unknown)\",\"iso6391Name\":\"(Unknown)\",\"confidenceScore\":0.0},\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Wed, 29 Apr 2020 17:12:20 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguagesBatchInputShowStatistics.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguagesBatchInputShowStatistics.json index b0db80970e0b6..188f68f3e61f6 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguagesBatchInputShowStatistics.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguagesBatchInputShowStatistics.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//languages?showStats=true", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//languages?showStats=true", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "c7e2564e-dba8-4bc1-8c83-22c3ad851b52", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "e1e1b615-a26b-4c9e-961e-ae73b2168cf1", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "8", + "x-envoy-upstream-service-time" : "3", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=3", - "apim-request-id" : "7bd47753-874e-4a43-bdb7-98ac3f807531", + "apim-request-id" : "48410bc9-b67c-4615-8bcf-2cadfe4f2d46", "retry-after" : "0", "StatusCode" : "200", - "Body" : "{\"statistics\":{\"documentsCount\":3,\"validDocumentsCount\":3,\"erroneousDocumentsCount\":0,\"transactionsCount\":3},\"documents\":[{\"id\":\"0\",\"detectedLanguage\":{\"name\":\"English\",\"iso6391Name\":\"en\",\"confidenceScore\":1.0},\"statistics\":{\"charactersCount\":26,\"transactionsCount\":1},\"warnings\":[]},{\"id\":\"1\",\"detectedLanguage\":{\"name\":\"Spanish\",\"iso6391Name\":\"es\",\"confidenceScore\":1.0},\"statistics\":{\"charactersCount\":40,\"transactionsCount\":1},\"warnings\":[]},{\"id\":\"2\",\"detectedLanguage\":{\"name\":\"Polish\",\"iso6391Name\":\"pl\",\"confidenceScore\":0.4},\"statistics\":{\"charactersCount\":6,\"transactionsCount\":1},\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-07-01\"}", - "Date" : "Tue, 01 Sep 2020 06:14:51 GMT", + "Body" : "{\"statistics\":{\"documentsCount\":3,\"validDocumentsCount\":3,\"erroneousDocumentsCount\":0,\"transactionsCount\":3},\"documents\":[{\"id\":\"0\",\"detectedLanguage\":{\"name\":\"English\",\"iso6391Name\":\"en\",\"confidenceScore\":1.0},\"statistics\":{\"charactersCount\":26,\"transactionsCount\":1},\"warnings\":[]},{\"id\":\"1\",\"detectedLanguage\":{\"name\":\"Spanish\",\"iso6391Name\":\"es\",\"confidenceScore\":1.0},\"statistics\":{\"charactersCount\":40,\"transactionsCount\":1},\"warnings\":[]},{\"id\":\"2\",\"detectedLanguage\":{\"name\":\"(Unknown)\",\"iso6391Name\":\"(Unknown)\",\"confidenceScore\":0.0},\"statistics\":{\"charactersCount\":6,\"transactionsCount\":1},\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Wed, 29 Apr 2020 17:12:19 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguagesBatchInputShowStatisticsNew.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguagesBatchInputShowStatisticsNew.json new file mode 100644 index 0000000000000..78dc5f5301c36 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguagesBatchInputShowStatisticsNew.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://javatextanalyticstestresources.cognitiveservices.azure.com/text/analytics/v3.0-preview.1/languages?showStats=true", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "7bbf00ca-d6c7-4e17-9bf4-6bdc587fbdb1", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-envoy-upstream-service-time" : "6", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=3", + "apim-request-id" : "0a3819af-a97d-4279-9c1c-30e216082788", + "x-aml-ta-request-id" : "78f53879-b38b-40ec-b441-e47ebc2c5905", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"statistics\":{\"documentsCount\":3,\"validDocumentsCount\":3,\"erroneousDocumentsCount\":0,\"transactionsCount\":3},\"documents\":[{\"id\":\"0\",\"detectedLanguages\":[{\"name\":\"English\",\"iso6391Name\":\"en\",\"score\":1.0}],\"statistics\":{\"charactersCount\":26,\"transactionsCount\":1}},{\"id\":\"1\",\"detectedLanguages\":[{\"name\":\"Spanish\",\"iso6391Name\":\"es\",\"score\":1.0}],\"statistics\":{\"charactersCount\":39,\"transactionsCount\":1}},{\"id\":\"2\",\"detectedLanguages\":[{\"name\":\"(Unknown)\",\"iso6391Name\":\"(Unknown)\",\"score\":0.0}],\"statistics\":{\"charactersCount\":6,\"transactionsCount\":1}}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Fri, 06 Dec 2019 23:45:12 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguagesBatchListCountryHint.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguagesBatchListCountryHint.json index a4ed03a474e13..515ad3413f89f 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguagesBatchListCountryHint.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguagesBatchListCountryHint.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//languages", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//languages", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "025082c7-ae96-41b0-a89c-4f03664e2992", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "e8c4d152-8f81-43ba-beab-333ffc907333", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "7", + "x-envoy-upstream-service-time" : "2", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=3", - "apim-request-id" : "bdeaf159-f9f7-48a1-9522-8cc67a80e7eb", + "apim-request-id" : "a7d6e3ca-f60f-4a20-99ca-a5ac0ef79451", "retry-after" : "0", "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"detectedLanguage\":{\"name\":\"English\",\"iso6391Name\":\"en\",\"confidenceScore\":1.0},\"warnings\":[]},{\"id\":\"1\",\"detectedLanguage\":{\"name\":\"Spanish\",\"iso6391Name\":\"es\",\"confidenceScore\":1.0},\"warnings\":[]},{\"id\":\"2\",\"detectedLanguage\":{\"name\":\"Polish\",\"iso6391Name\":\"pl\",\"confidenceScore\":0.4},\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-07-01\"}", - "Date" : "Tue, 01 Sep 2020 06:14:56 GMT", + "Body" : "{\"documents\":[{\"id\":\"0\",\"detectedLanguage\":{\"name\":\"English\",\"iso6391Name\":\"en\",\"confidenceScore\":1.0},\"warnings\":[]},{\"id\":\"1\",\"detectedLanguage\":{\"name\":\"Spanish\",\"iso6391Name\":\"es\",\"confidenceScore\":1.0},\"warnings\":[]},{\"id\":\"2\",\"detectedLanguage\":{\"name\":\"(Unknown)\",\"iso6391Name\":\"(Unknown)\",\"confidenceScore\":0.0},\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Wed, 29 Apr 2020 17:12:20 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguagesBatchListCountryHintWithOptions.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguagesBatchListCountryHintWithOptions.json index 423f0d4de2108..92ed0217cccf2 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguagesBatchListCountryHintWithOptions.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguagesBatchListCountryHintWithOptions.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//languages?showStats=true", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//languages?showStats=true", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "6a2f9363-b4f8-4134-86a9-bde15f6a0fe1", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "e54088d4-3873-44d9-b21f-7d26d068896d", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "10", + "x-envoy-upstream-service-time" : "3", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=3", - "apim-request-id" : "7472c8e7-d430-41ff-8f4f-a5f7e02c70ca", + "apim-request-id" : "bdf7f3e6-3805-4dfd-bdc3-404e12b68a30", "retry-after" : "0", "StatusCode" : "200", - "Body" : "{\"statistics\":{\"documentsCount\":3,\"validDocumentsCount\":3,\"erroneousDocumentsCount\":0,\"transactionsCount\":3},\"documents\":[{\"id\":\"0\",\"detectedLanguage\":{\"name\":\"English\",\"iso6391Name\":\"en\",\"confidenceScore\":1.0},\"statistics\":{\"charactersCount\":26,\"transactionsCount\":1},\"warnings\":[]},{\"id\":\"1\",\"detectedLanguage\":{\"name\":\"Spanish\",\"iso6391Name\":\"es\",\"confidenceScore\":1.0},\"statistics\":{\"charactersCount\":40,\"transactionsCount\":1},\"warnings\":[]},{\"id\":\"2\",\"detectedLanguage\":{\"name\":\"Polish\",\"iso6391Name\":\"pl\",\"confidenceScore\":0.4},\"statistics\":{\"charactersCount\":6,\"transactionsCount\":1},\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-07-01\"}", - "Date" : "Tue, 01 Sep 2020 06:14:53 GMT", + "Body" : "{\"statistics\":{\"documentsCount\":3,\"validDocumentsCount\":3,\"erroneousDocumentsCount\":0,\"transactionsCount\":3},\"documents\":[{\"id\":\"0\",\"detectedLanguage\":{\"name\":\"English\",\"iso6391Name\":\"en\",\"confidenceScore\":1.0},\"statistics\":{\"charactersCount\":26,\"transactionsCount\":1},\"warnings\":[]},{\"id\":\"1\",\"detectedLanguage\":{\"name\":\"Spanish\",\"iso6391Name\":\"es\",\"confidenceScore\":1.0},\"statistics\":{\"charactersCount\":40,\"transactionsCount\":1},\"warnings\":[]},{\"id\":\"2\",\"detectedLanguage\":{\"name\":\"(Unknown)\",\"iso6391Name\":\"(Unknown)\",\"confidenceScore\":0.0},\"statistics\":{\"charactersCount\":6,\"transactionsCount\":1},\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Wed, 29 Apr 2020 17:12:19 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguagesBatchStringInput.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguagesBatchStringInput.json index bc015665459aa..4f163bf2ab41b 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguagesBatchStringInput.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguagesBatchStringInput.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//languages", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//languages", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "64ea71c7-db6b-49a0-84b9-017d6f85ec1e", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "9fc32873-4b4c-47cb-8378-e1647f654d9a", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "7", + "x-envoy-upstream-service-time" : "3", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=3", - "apim-request-id" : "eb21267c-cb40-4185-be01-995806eb0728", + "apim-request-id" : "702da38b-f3d2-4d1f-8c01-c42cf5cdd23d", "retry-after" : "0", "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"detectedLanguage\":{\"name\":\"English\",\"iso6391Name\":\"en\",\"confidenceScore\":1.0},\"warnings\":[]},{\"id\":\"1\",\"detectedLanguage\":{\"name\":\"Spanish\",\"iso6391Name\":\"es\",\"confidenceScore\":1.0},\"warnings\":[]},{\"id\":\"2\",\"detectedLanguage\":{\"name\":\"Polish\",\"iso6391Name\":\"pl\",\"confidenceScore\":0.4},\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-07-01\"}", - "Date" : "Tue, 01 Sep 2020 06:14:50 GMT", + "Body" : "{\"documents\":[{\"id\":\"0\",\"detectedLanguage\":{\"name\":\"English\",\"iso6391Name\":\"en\",\"confidenceScore\":1.0},\"warnings\":[]},{\"id\":\"1\",\"detectedLanguage\":{\"name\":\"Spanish\",\"iso6391Name\":\"es\",\"confidenceScore\":1.0},\"warnings\":[]},{\"id\":\"2\",\"detectedLanguage\":{\"name\":\"(Unknown)\",\"iso6391Name\":\"(Unknown)\",\"confidenceScore\":0.0},\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Wed, 29 Apr 2020 17:12:18 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguagesBatchStringList.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguagesBatchStringList.json new file mode 100644 index 0000000000000..5af42401c1a1c --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguagesBatchStringList.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://javatextanalyticstestresources.cognitiveservices.azure.com/text/analytics/v3.0-preview.1/languages", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "f2c6afdf-c7d9-4b64-bb47-df7a395fb176", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-envoy-upstream-service-time" : "6", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=3", + "apim-request-id" : "9f374d46-7574-40a3-8f1f-909d785f9bbb", + "x-aml-ta-request-id" : "5927da90-8c7b-4102-916c-b49197615813", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"documents\":[{\"id\":\"0\",\"detectedLanguages\":[{\"name\":\"English\",\"iso6391Name\":\"en\",\"score\":1.0}]},{\"id\":\"1\",\"detectedLanguages\":[{\"name\":\"Spanish\",\"iso6391Name\":\"es\",\"score\":1.0}]},{\"id\":\"2\",\"detectedLanguages\":[{\"name\":\"(Unknown)\",\"iso6391Name\":\"(Unknown)\",\"score\":0.0}]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Fri, 06 Dec 2019 23:45:12 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectSingleTextLanguage.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectSingleTextLanguage.json index 18165a166a9f9..707c7cd281035 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectSingleTextLanguage.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectSingleTextLanguage.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//languages", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//languages", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "c7dfb57d-46ef-4411-a1c2-62fa3c71bda4", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "98b653f8-4f93-4fdc-b4ee-adabc657071c", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "6", + "x-envoy-upstream-service-time" : "2", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "82b0ca93-5e62-460f-80a6-97268bebe97a", + "apim-request-id" : "ce9d081a-00cb-4505-81a9-d845d92a4210", "retry-after" : "0", "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"detectedLanguage\":{\"name\":\"English\",\"iso6391Name\":\"en\",\"confidenceScore\":1.0},\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-07-01\"}", - "Date" : "Tue, 01 Sep 2020 06:14:55 GMT", + "Body" : "{\"documents\":[{\"id\":\"0\",\"detectedLanguage\":{\"name\":\"English\",\"iso6391Name\":\"en\",\"confidenceScore\":1.0},\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Wed, 29 Apr 2020 17:12:20 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesBatchTooManyDocuments.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesBatchTooManyDocuments.json deleted file mode 100644 index ab95acb5bca43..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesBatchTooManyDocuments.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//keyPhrases", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "a71ab59a-4320-4099-b527-f856725ed717", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "5", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "apim-request-id" : "f141c995-4714-429e-ba32-df6a45ef8b0d", - "retry-after" : "0", - "StatusCode" : "400", - "Body" : "{\"error\":{\"code\":\"InvalidRequest\",\"message\":\"Invalid document in request.\",\"innererror\":{\"code\":\"InvalidDocumentBatch\",\"message\":\"Batch request contains too many records. Max 10 records are permitted.\"}}}", - "Date" : "Tue, 01 Sep 2020 06:14:47 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesBatchWarning.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesBatchWarning.json index 750b29d774994..574b1e965176d 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesBatchWarning.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesBatchWarning.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//keyPhrases", + "Uri" : "https://REDACTED.ppe.cognitiveservices.azure.com/text/analytics/v3.0//keyPhrases", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "3c4d7a11-d3b7-46f5-b87d-43d2a4928b0d", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "09f7916f-881b-4eda-b39d-9751d3a3807a", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "8", + "x-envoy-upstream-service-time" : "22", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", - "apim-request-id" : "87406636-3b9a-4b54-bcde-858d706299f8", + "apim-request-id" : "2fe14015-84a7-463c-b291-1c0843a2b509", "retry-after" : "0", "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"keyPhrases\":[\"Thisisaveryveryverylongtextwhichgoesonforalongtimeandwhichalmost\"],\"warnings\":[{\"code\":\"LongWordsInDocument\",\"message\":\"The document contains very long words (longer than 64 characters). These words will be truncated and may result in unreliable model predictions.\"}]},{\"id\":\"1\",\"keyPhrases\":[\"Microsoft\"],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-07-01\"}", - "Date" : "Tue, 01 Sep 2020 06:14:57 GMT", + "Body" : "{\"documents\":[{\"id\":\"0\",\"keyPhrases\":[\"Thisisaveryveryverylongtextwhichgoesonforalongtimeandwhichalmost\"],\"warnings\":[{\"code\":\"LongWordsInDocument\",\"message\":\"The document contains very long words (longer than 64 characters). These words will be truncated and may result in unreliable model predictions.\"}]},{\"id\":\"1\",\"keyPhrases\":[\"Microsoft\"],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Thu, 07 May 2020 02:48:33 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesDuplicateIdInput.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesDuplicateIdInput.json index a200f395a602a..5f13c5933a9d1 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesDuplicateIdInput.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesDuplicateIdInput.json @@ -1,22 +1,22 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//keyPhrases", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//keyPhrases", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "331ea854-985a-4826-800f-42906f0dc39e", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "bd79c9e5-7980-4380-bc33-b523d2c53e2e", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "5", + "x-envoy-upstream-service-time" : "112", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", - "apim-request-id" : "309ddeb9-83ac-4b85-9e37-36147f8f85dc", + "apim-request-id" : "6c965e67-2741-4b70-97f2-6d4705d5f714", "retry-after" : "0", "StatusCode" : "400", - "Body" : "{\"error\":{\"code\":\"InvalidRequest\",\"message\":\"Invalid document in request.\",\"innererror\":{\"code\":\"InvalidDocument\",\"message\":\"Request contains duplicated Ids. Make sure each document has a unique Id.\"}}}", - "Date" : "Tue, 01 Sep 2020 06:14:49 GMT", + "Body" : "{\"error\":{\"code\":\"InvalidRequest\",\"message\":\"Invalid document in request.\",\"innerError\":{\"code\":\"InvalidDocument\",\"message\":\"Request contains duplicated Ids. Make sure each document has a unique Id.\"}}}", + "Date" : "Thu, 30 Apr 2020 04:52:37 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesEmptyIdInput.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesEmptyIdInput.json deleted file mode 100644 index e7130a9c3d499..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesEmptyIdInput.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//keyPhrases", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "46083ebe-7708-4fc9-bd61-d0439cf212d8", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "4", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "apim-request-id" : "c2d615d8-4114-4b00-b411-02fbc14ac4b9", - "retry-after" : "0", - "StatusCode" : "400", - "Body" : "{\"error\":{\"code\":\"InvalidRequest\",\"message\":\"Invalid document in request.\",\"innererror\":{\"code\":\"InvalidDocument\",\"message\":\"At least one document is missing an Id attribute.\"}}}", - "Date" : "Tue, 01 Sep 2020 06:14:47 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForBatchInput.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForBatchInput.json index 7ca7e2de7b9a6..b81a36772db36 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForBatchInput.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForBatchInput.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//keyPhrases", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//keyPhrases", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "527734a0-b5d0-44d5-a5f3-ff0f3654d10c", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "50ed4022-98a0-4504-a0ca-1e4ab870ab91", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "10", + "x-envoy-upstream-service-time" : "5", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", - "apim-request-id" : "b2d7bc99-a9c4-486e-b32a-ae07c848d7b0", + "apim-request-id" : "3390b669-3026-418c-a00e-298bc6d64d38", "retry-after" : "0", "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"keyPhrases\":[\"input text\",\"world\"],\"warnings\":[]},{\"id\":\"1\",\"keyPhrases\":[\"monde\"],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-07-01\"}", - "Date" : "Tue, 01 Sep 2020 06:14:47 GMT", + "Body" : "{\"documents\":[{\"id\":\"0\",\"keyPhrases\":[\"input text\",\"world\"],\"warnings\":[]},{\"id\":\"1\",\"keyPhrases\":[\"monde\"],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Wed, 29 Apr 2020 17:12:18 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForBatchInputShowStatistics.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForBatchInputShowStatistics.json index 9d3565e1bcdec..e122a4129652f 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForBatchInputShowStatistics.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForBatchInputShowStatistics.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//keyPhrases?showStats=true", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//keyPhrases?showStats=true", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "0d1a273e-4938-41b4-9a1d-7bdb59c21e7e", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "80c81b1a-6682-46cd-a2f3-5c1ec8673a8d", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "19", + "x-envoy-upstream-service-time" : "5", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", - "apim-request-id" : "173eaa26-f8ff-4bd1-95ef-049d515197bc", + "apim-request-id" : "d2d9b818-a6a7-47f5-9606-3ca8118b1d08", "retry-after" : "0", "StatusCode" : "200", - "Body" : "{\"statistics\":{\"documentsCount\":2,\"validDocumentsCount\":2,\"erroneousDocumentsCount\":0,\"transactionsCount\":2},\"documents\":[{\"id\":\"0\",\"keyPhrases\":[\"input text\",\"world\"],\"statistics\":{\"charactersCount\":49,\"transactionsCount\":1},\"warnings\":[]},{\"id\":\"1\",\"keyPhrases\":[\"monde\"],\"statistics\":{\"charactersCount\":21,\"transactionsCount\":1},\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-07-01\"}", - "Date" : "Tue, 01 Sep 2020 06:14:48 GMT", + "Body" : "{\"statistics\":{\"documentsCount\":2,\"validDocumentsCount\":2,\"erroneousDocumentsCount\":0,\"transactionsCount\":2},\"documents\":[{\"id\":\"0\",\"keyPhrases\":[\"input text\",\"world\"],\"statistics\":{\"charactersCount\":49,\"transactionsCount\":1},\"warnings\":[]},{\"id\":\"1\",\"keyPhrases\":[\"monde\"],\"statistics\":{\"charactersCount\":21,\"transactionsCount\":1},\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Wed, 29 Apr 2020 17:12:18 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForBatchStringInput.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForBatchStringInput.json index 4ad4e0242c762..1787566b8905f 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForBatchStringInput.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForBatchStringInput.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//keyPhrases", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//keyPhrases", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "803e6647-30a0-4fa2-9df5-b02696fe58b4", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "d915e11c-f5c4-4147-a491-8b12787a203f", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "13", + "x-envoy-upstream-service-time" : "6", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", - "apim-request-id" : "95368d38-14e7-45b7-9338-b46f91d76f29", + "apim-request-id" : "e73ae469-8ca5-4a26-bbb4-e548ff416167", "retry-after" : "0", "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"keyPhrases\":[\"input text\",\"world\"],\"warnings\":[]},{\"id\":\"1\",\"keyPhrases\":[\"monde\"],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-07-01\"}", - "Date" : "Tue, 01 Sep 2020 06:14:56 GMT", + "Body" : "{\"documents\":[{\"id\":\"0\",\"keyPhrases\":[\"input text\",\"world\"],\"warnings\":[]},{\"id\":\"1\",\"keyPhrases\":[\"monde\"],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Wed, 29 Apr 2020 17:12:20 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForEmptyText.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForEmptyText.json index e4846a515474a..e7055afa0c2c0 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForEmptyText.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForEmptyText.json @@ -1,22 +1,23 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//keyPhrases", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//keyPhrases", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "862dabe7-a09c-477d-bdac-794864b00e3b", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "fcf765fa-9e9f-4c1f-b15b-b7a917cda77c", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "2", + "x-envoy-upstream-service-time" : "1", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", - "apim-request-id" : "e3ccfcac-0723-4764-94bb-8df2d38a1a99", + "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=0", + "apim-request-id" : "2917c294-c86c-44b3-8eaf-1a087a5332d5", "retry-after" : "0", "StatusCode" : "200", - "Body" : "{\"documents\":[],\"errors\":[{\"id\":\"0\",\"error\":{\"code\":\"InvalidArgument\",\"message\":\"Invalid document in request.\",\"innererror\":{\"code\":\"InvalidDocument\",\"message\":\"Document text is empty.\"}}}],\"modelVersion\":\"2020-07-01\"}", - "Date" : "Tue, 01 Sep 2020 06:14:48 GMT", + "Body" : "{\"documents\":[],\"errors\":[{\"id\":\"0\",\"error\":{\"code\":\"InvalidArgument\",\"message\":\"Invalid document in request.\",\"innererror\":{\"code\":\"InvalidDocument\",\"message\":\"Document text is empty.\"}}}],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Wed, 29 Apr 2020 17:12:18 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForFaultyText.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForFaultyText.json index fba14971fe02f..112abcec8fef8 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForFaultyText.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForFaultyText.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//keyPhrases", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//keyPhrases", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "9e21a90a-19fc-4132-9653-ca50528c6a04", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "054f1961-34b0-4f46-ba07-129ef22f203a", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "8", + "x-envoy-upstream-service-time" : "3", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "273c031a-6f61-434f-afab-9af7444bb01d", + "apim-request-id" : "e8821ad2-0c24-40f6-abe4-21a9a0049264", "retry-after" : "0", "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"keyPhrases\":[],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-07-01\"}", - "Date" : "Tue, 01 Sep 2020 06:14:49 GMT", + "Body" : "{\"documents\":[{\"id\":\"0\",\"keyPhrases\":[],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Wed, 29 Apr 2020 17:12:18 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForListLanguageHint.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForListLanguageHint.json index ba1d17d5463ab..d67f8a762f93e 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForListLanguageHint.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForListLanguageHint.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//keyPhrases", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//keyPhrases", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "81d11171-495b-4adc-8d52-40b13cedf0dc", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "af10e3af-edbd-4433-b60b-f8743c2cb972", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "9", + "x-envoy-upstream-service-time" : "5", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", - "apim-request-id" : "4cfb436e-50dd-4394-b6d0-2cd9f2c432e9", + "apim-request-id" : "0f1c2ba1-0f81-4d8d-ac1b-f8f67f0db9e8", "retry-after" : "0", "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"keyPhrases\":[\"input text\",\"world\"],\"warnings\":[]},{\"id\":\"1\",\"keyPhrases\":[\"monde\"],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-07-01\"}", - "Date" : "Tue, 01 Sep 2020 06:14:56 GMT", + "Body" : "{\"documents\":[{\"id\":\"0\",\"keyPhrases\":[\"input text\",\"world\"],\"warnings\":[]},{\"id\":\"1\",\"keyPhrases\":[\"monde\"],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Wed, 29 Apr 2020 17:12:20 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForListStringWithOptions.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForListStringWithOptions.json index cfcf20ccb9d68..9c0bd50d92733 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForListStringWithOptions.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForListStringWithOptions.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//keyPhrases?showStats=true", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//keyPhrases?showStats=true", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "0d62328e-f4cb-4d14-b207-b7e118dcf91e", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "c6ed0a9f-a4ee-4e3d-8a74-e0c603014b4e", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "11", + "x-envoy-upstream-service-time" : "5", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", - "apim-request-id" : "2693e43c-048e-411f-bd24-80856e4dff4c", + "apim-request-id" : "e1a68dde-4ac7-4e1d-8da5-7527fa757817", "retry-after" : "0", "StatusCode" : "200", - "Body" : "{\"statistics\":{\"documentsCount\":2,\"validDocumentsCount\":2,\"erroneousDocumentsCount\":0,\"transactionsCount\":2},\"documents\":[{\"id\":\"0\",\"keyPhrases\":[\"input text\",\"world\"],\"statistics\":{\"charactersCount\":49,\"transactionsCount\":1},\"warnings\":[]},{\"id\":\"1\",\"keyPhrases\":[\"monde\"],\"statistics\":{\"charactersCount\":21,\"transactionsCount\":1},\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-07-01\"}", - "Date" : "Tue, 01 Sep 2020 06:14:53 GMT", + "Body" : "{\"statistics\":{\"documentsCount\":2,\"validDocumentsCount\":2,\"erroneousDocumentsCount\":0,\"transactionsCount\":2},\"documents\":[{\"id\":\"0\",\"keyPhrases\":[\"input text\",\"world\"],\"statistics\":{\"charactersCount\":49,\"transactionsCount\":1},\"warnings\":[]},{\"id\":\"1\",\"keyPhrases\":[\"monde\"],\"statistics\":{\"charactersCount\":21,\"transactionsCount\":1},\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Wed, 29 Apr 2020 17:12:19 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForTextInput.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForTextInput.json index 813a97835036c..bd2b2eb3e6758 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForTextInput.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForTextInput.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//keyPhrases", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//keyPhrases", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "314cc613-01dc-49b8-a132-0c7e938f0b87", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "b57d36cb-3bc5-40f2-aba9-cb9aba3e3d95", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "7", + "x-envoy-upstream-service-time" : "4", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "7adccd07-575b-4f10-a4da-b2277cf301b5", + "apim-request-id" : "42f434be-b16a-4b5f-9920-75e5d92d0eed", "retry-after" : "0", "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"keyPhrases\":[\"monde\"],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-07-01\"}", - "Date" : "Tue, 01 Sep 2020 06:14:49 GMT", + "Body" : "{\"documents\":[{\"id\":\"0\",\"keyPhrases\":[\"monde\"],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Wed, 29 Apr 2020 17:12:18 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesWarning.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesWarning.json index 064a202129a76..373d8ae1a0307 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesWarning.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesWarning.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//keyPhrases", + "Uri" : "https://REDACTED.ppe.cognitiveservices.azure.com/text/analytics/v3.0//keyPhrases", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "d929f1cd-82ca-4cbe-bacf-db946576faf3", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "6070fa8f-51ce-4ee1-8262-bb1413d91844", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "7", + "x-envoy-upstream-service-time" : "4", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "b281a64d-aa17-4a6d-9aec-8fa724587130", + "apim-request-id" : "8d61f6e0-6f52-4d7a-a157-c8380bf2b60d", "retry-after" : "0", "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"keyPhrases\":[\"Thisisaveryveryverylongtextwhichgoesonforalongtimeandwhichalmost\"],\"warnings\":[{\"code\":\"LongWordsInDocument\",\"message\":\"The document contains very long words (longer than 64 characters). These words will be truncated and may result in unreliable model predictions.\"}]}],\"errors\":[],\"modelVersion\":\"2020-07-01\"}", - "Date" : "Tue, 01 Sep 2020 06:14:53 GMT", + "Body" : "{\"documents\":[{\"id\":\"0\",\"keyPhrases\":[\"Thisisaveryveryverylongtextwhichgoesonforalongtimeandwhichalmost\"],\"warnings\":[{\"code\":\"LongWordsInDocument\",\"message\":\"The document contains very long words (longer than 64 characters). These words will be truncated and may result in unreliable model predictions.\"}]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Thu, 07 May 2020 02:48:54 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesBatchInputSingleError.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesBatchInputSingleError.json index 75de352780b81..8dea8ba2991d7 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesBatchInputSingleError.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesBatchInputSingleError.json @@ -1,10 +1,10 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/recognition/general?stringIndexType=Utf16CodeUnit", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//entities/recognition/general", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "fc62b511-6705-4a46-a485-bcbc2ec1a58d", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "c155ee1b-e8ec-4897-a653-351837349cca", "Content-Type" : "application/json" }, "Response" : { @@ -12,11 +12,11 @@ "x-envoy-upstream-service-time" : "2", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", - "apim-request-id" : "7fc0ef6d-1a87-40db-bed4-992d3fded78e", + "apim-request-id" : "fde49364-8059-4cb5-b65f-19e1180db44f", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"documents\":[],\"errors\":[{\"id\":\"2\",\"error\":{\"code\":\"InvalidArgument\",\"message\":\"Invalid document in request.\",\"innererror\":{\"code\":\"InvalidDocument\",\"message\":\"Document text is empty.\"}}}],\"modelVersion\":\"2020-04-01\"}", - "Date" : "Thu, 03 Sep 2020 19:03:56 GMT", + "Date" : "Wed, 29 Apr 2020 17:12:18 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesBatchTooManyDocuments.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesBatchTooManyDocuments.json deleted file mode 100644 index a1d254929f22b..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesBatchTooManyDocuments.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/recognition/general?stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "fba8d8d7-53f3-4a9e-ba62-8605e8e9ddc4", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "5", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "apim-request-id" : "e62e86f6-cf25-4295-8ded-434302e24613", - "retry-after" : "0", - "StatusCode" : "400", - "Body" : "{\"error\":{\"code\":\"InvalidRequest\",\"message\":\"Invalid document in request.\",\"innererror\":{\"code\":\"InvalidDocumentBatch\",\"message\":\"Batch request contains too many records. Max 5 records are permitted.\"}}}", - "Date" : "Thu, 03 Sep 2020 19:04:08 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesDiacriticsNfc.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesDiacriticsNfc.json deleted file mode 100644 index baac2faa311b2..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesDiacriticsNfc.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/recognition/general?stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "91ca340e-50f7-4f54-be0c-839101384433", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "74", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "55a7b121-46b7-4473-b8be-4d2ba65fcc0d", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"entities\":[{\"text\":\"Microsoft\",\"category\":\"Organization\",\"offset\":14,\"length\":9,\"confidenceScore\":0.62}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}", - "Date" : "Thu, 03 Sep 2020 17:50:13 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesDiacriticsNfd.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesDiacriticsNfd.json deleted file mode 100644 index 7627093cd1041..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesDiacriticsNfd.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/recognition/general?stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "5aaf2abf-c350-4c5e-803e-e987fce4875f", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "75", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "d51d3031-8430-4a9d-8a71-3f25c19a81b0", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"entities\":[{\"text\":\"Microsoft\",\"category\":\"Organization\",\"offset\":15,\"length\":9,\"confidenceScore\":0.7}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}", - "Date" : "Thu, 03 Sep 2020 17:50:15 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesDuplicateIdInput.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesDuplicateIdInput.json index 3b7ad148c2fbc..5d75bf441cc7f 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesDuplicateIdInput.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesDuplicateIdInput.json @@ -1,10 +1,10 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/recognition/general?stringIndexType=Utf16CodeUnit", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//entities/recognition/general", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "bef15ea0-9821-4f0a-844a-4d734898ac24", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "0697cc18-e2ad-40d2-9403-238072c99231", "Content-Type" : "application/json" }, "Response" : { @@ -12,11 +12,11 @@ "x-envoy-upstream-service-time" : "5", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", - "apim-request-id" : "c4284202-bb00-47bc-b125-c335cf55c60d", + "apim-request-id" : "625712f8-5ad4-4c0f-b446-12ce318345db", "retry-after" : "0", "StatusCode" : "400", - "Body" : "{\"error\":{\"code\":\"InvalidRequest\",\"message\":\"Invalid document in request.\",\"innererror\":{\"code\":\"InvalidDocument\",\"message\":\"Request contains duplicated Ids. Make sure each document has a unique Id.\"}}}", - "Date" : "Thu, 03 Sep 2020 19:04:11 GMT", + "Body" : "{\"error\":{\"code\":\"InvalidRequest\",\"message\":\"Invalid document in request.\",\"innerError\":{\"code\":\"InvalidDocument\",\"message\":\"Request contains duplicated Ids. Make sure each document has a unique Id.\"}}}", + "Date" : "Thu, 30 Apr 2020 04:52:39 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesEmoji.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesEmoji.json deleted file mode 100644 index fb65b83ffd423..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesEmoji.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/recognition/general?stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "ba219dcf-fe70-4714-9794-0a80d74b10cf", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "73", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "dd2d5711-b7d8-40f4-bee2-e36e1ee567e2", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"entities\":[{\"text\":\"Microsoft\",\"category\":\"Organization\",\"offset\":13,\"length\":9,\"confidenceScore\":0.72}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}", - "Date" : "Thu, 03 Sep 2020 17:49:54 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesEmojiFamily.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesEmojiFamily.json deleted file mode 100644 index 7aae04712ac41..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesEmojiFamily.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/recognition/general?stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "024dd68d-f3cc-477b-814c-b3248eddeeec", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "81", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "7e52f9a0-e62b-49b7-a4ed-bb5dc52c11d9", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"entities\":[{\"text\":\"Microsoft\",\"category\":\"Organization\",\"offset\":22,\"length\":9,\"confidenceScore\":0.6}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}", - "Date" : "Thu, 03 Sep 2020 17:50:10 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesEmojiFamilyWIthSkinToneModifier.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesEmojiFamilyWIthSkinToneModifier.json deleted file mode 100644 index 80184b5670bfd..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesEmojiFamilyWIthSkinToneModifier.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/recognition/general?stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "d4d01bb1-02b5-4fef-a708-3913df730384", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "71", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "3a3c38b9-c979-4c91-9fe2-1908deb9416f", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"entities\":[{\"text\":\"Microsoft\",\"category\":\"Organization\",\"offset\":30,\"length\":9,\"confidenceScore\":0.59}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}", - "Date" : "Thu, 03 Sep 2020 17:49:59 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesEmojiWithSkinToneModifier.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesEmojiWithSkinToneModifier.json deleted file mode 100644 index 1d85d3e64ac25..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesEmojiWithSkinToneModifier.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/recognition/general?stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "87e22552-fb74-4bb0-914e-d04afdb7cbf2", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "75", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "4a537768-b6b5-413f-b277-7d35930dc880", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"entities\":[{\"text\":\"Microsoft\",\"category\":\"Organization\",\"offset\":15,\"length\":9,\"confidenceScore\":0.7}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}", - "Date" : "Thu, 03 Sep 2020 17:50:11 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesEmptyIdInput.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesEmptyIdInput.json deleted file mode 100644 index 2af9f87c3ce24..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesEmptyIdInput.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/recognition/general?stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "fe75b814-99a3-449d-bef9-11dc4160ad30", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "4", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "apim-request-id" : "ea9ae899-f762-4eac-b8a2-77770a9794f3", - "retry-after" : "0", - "StatusCode" : "400", - "Body" : "{\"error\":{\"code\":\"InvalidRequest\",\"message\":\"Invalid document in request.\",\"innererror\":{\"code\":\"InvalidDocument\",\"message\":\"At least one document is missing an Id attribute.\"}}}", - "Date" : "Thu, 03 Sep 2020 19:03:58 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForBatchInput.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForBatchInput.json index 8296a9dd63583..2df061228dbc7 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForBatchInput.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForBatchInput.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/recognition/general?stringIndexType=Utf16CodeUnit", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//entities/recognition/general", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "1c774096-ae90-4196-b27a-4fe9b6053ccf", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "44c61065-7f1f-4b50-a029-f49551867ddd", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "99", + "x-envoy-upstream-service-time" : "91", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", - "apim-request-id" : "2f8d15c3-c860-4f29-b4b5-26dd33828a05", + "apim-request-id" : "a91c7873-b4ef-44bd-9253-e662937f1f59", "retry-after" : "0", "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"entities\":[{\"text\":\"trip\",\"category\":\"Event\",\"offset\":18,\"length\":4,\"confidenceScore\":0.61},{\"text\":\"Seattle\",\"category\":\"Location\",\"subcategory\":\"GPE\",\"offset\":26,\"length\":7,\"confidenceScore\":0.82},{\"text\":\"last week\",\"category\":\"DateTime\",\"subcategory\":\"DateRange\",\"offset\":34,\"length\":9,\"confidenceScore\":0.8}],\"warnings\":[]},{\"id\":\"1\",\"entities\":[{\"text\":\"Microsoft\",\"category\":\"Organization\",\"offset\":10,\"length\":9,\"confidenceScore\":0.77}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}", - "Date" : "Thu, 03 Sep 2020 19:03:56 GMT", + "Body" : "{\"documents\":[{\"id\":\"0\",\"entities\":[{\"text\":\"trip\",\"category\":\"Event\",\"offset\":18,\"length\":4,\"confidenceScore\":0.62},{\"text\":\"Seattle\",\"category\":\"Location\",\"subcategory\":\"GPE\",\"offset\":26,\"length\":7,\"confidenceScore\":0.6},{\"text\":\"last week\",\"category\":\"DateTime\",\"subcategory\":\"DateRange\",\"offset\":34,\"length\":9,\"confidenceScore\":0.8}],\"warnings\":[]},{\"id\":\"1\",\"entities\":[{\"text\":\"Microsoft\",\"category\":\"Organization\",\"offset\":10,\"length\":9,\"confidenceScore\":0.37}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}", + "Date" : "Wed, 29 Apr 2020 17:12:18 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForBatchInputShowStatistics.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForBatchInputShowStatistics.json index 2114848197eef..b6bd99a9fee78 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForBatchInputShowStatistics.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForBatchInputShowStatistics.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/recognition/general?showStats=true&stringIndexType=Utf16CodeUnit", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//entities/recognition/general?showStats=true", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "94f3b1f3-8c5c-4006-ae9f-33654c57ce96", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "33da35c7-b013-4cf9-86aa-c67157d11287", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "99", + "x-envoy-upstream-service-time" : "95", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", - "apim-request-id" : "9318b44e-0d50-449d-b278-6b002b42ce9c", + "apim-request-id" : "e8e8adf7-30c7-4bc6-a080-254f68a32b67", "retry-after" : "0", "StatusCode" : "200", - "Body" : "{\"statistics\":{\"documentsCount\":2,\"validDocumentsCount\":2,\"erroneousDocumentsCount\":0,\"transactionsCount\":2},\"documents\":[{\"id\":\"0\",\"statistics\":{\"charactersCount\":44,\"transactionsCount\":1},\"entities\":[{\"text\":\"trip\",\"category\":\"Event\",\"offset\":18,\"length\":4,\"confidenceScore\":0.61},{\"text\":\"Seattle\",\"category\":\"Location\",\"subcategory\":\"GPE\",\"offset\":26,\"length\":7,\"confidenceScore\":0.82},{\"text\":\"last week\",\"category\":\"DateTime\",\"subcategory\":\"DateRange\",\"offset\":34,\"length\":9,\"confidenceScore\":0.8}],\"warnings\":[]},{\"id\":\"1\",\"statistics\":{\"charactersCount\":20,\"transactionsCount\":1},\"entities\":[{\"text\":\"Microsoft\",\"category\":\"Organization\",\"offset\":10,\"length\":9,\"confidenceScore\":0.77}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}", - "Date" : "Thu, 03 Sep 2020 19:04:09 GMT", + "Body" : "{\"statistics\":{\"documentsCount\":2,\"validDocumentsCount\":2,\"erroneousDocumentsCount\":0,\"transactionsCount\":2},\"documents\":[{\"id\":\"0\",\"statistics\":{\"charactersCount\":44,\"transactionsCount\":1},\"entities\":[{\"text\":\"trip\",\"category\":\"Event\",\"offset\":18,\"length\":4,\"confidenceScore\":0.62},{\"text\":\"Seattle\",\"category\":\"Location\",\"subcategory\":\"GPE\",\"offset\":26,\"length\":7,\"confidenceScore\":0.6},{\"text\":\"last week\",\"category\":\"DateTime\",\"subcategory\":\"DateRange\",\"offset\":34,\"length\":9,\"confidenceScore\":0.8}],\"warnings\":[]},{\"id\":\"1\",\"statistics\":{\"charactersCount\":20,\"transactionsCount\":1},\"entities\":[{\"text\":\"Microsoft\",\"category\":\"Organization\",\"offset\":10,\"length\":9,\"confidenceScore\":0.37}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}", + "Date" : "Wed, 29 Apr 2020 17:12:20 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForBatchStringInput.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForBatchStringInput.json index 1601e5a9924a1..4f49e89a8bac7 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForBatchStringInput.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForBatchStringInput.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/recognition/general?stringIndexType=Utf16CodeUnit", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//entities/recognition/general", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "1d0ccae8-baa4-407b-827a-1936b563dbdb", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "e1176b08-6a1f-4306-8c72-06140a9d526f", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "101", + "x-envoy-upstream-service-time" : "97", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", - "apim-request-id" : "18294a3e-e3b4-4fb5-ab97-2be3141b6dd5", + "apim-request-id" : "0214cc9d-0063-4c09-aa8f-0940393b9a58", "retry-after" : "0", "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"entities\":[{\"text\":\"trip\",\"category\":\"Event\",\"offset\":18,\"length\":4,\"confidenceScore\":0.61},{\"text\":\"Seattle\",\"category\":\"Location\",\"subcategory\":\"GPE\",\"offset\":26,\"length\":7,\"confidenceScore\":0.82},{\"text\":\"last week\",\"category\":\"DateTime\",\"subcategory\":\"DateRange\",\"offset\":34,\"length\":9,\"confidenceScore\":0.8}],\"warnings\":[]},{\"id\":\"1\",\"entities\":[{\"text\":\"Microsoft\",\"category\":\"Organization\",\"offset\":10,\"length\":9,\"confidenceScore\":0.77}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}", - "Date" : "Thu, 03 Sep 2020 19:03:57 GMT", + "Body" : "{\"documents\":[{\"id\":\"0\",\"entities\":[{\"text\":\"trip\",\"category\":\"Event\",\"offset\":18,\"length\":4,\"confidenceScore\":0.62},{\"text\":\"Seattle\",\"category\":\"Location\",\"subcategory\":\"GPE\",\"offset\":26,\"length\":7,\"confidenceScore\":0.6},{\"text\":\"last week\",\"category\":\"DateTime\",\"subcategory\":\"DateRange\",\"offset\":34,\"length\":9,\"confidenceScore\":0.8}],\"warnings\":[]},{\"id\":\"1\",\"entities\":[{\"text\":\"Microsoft\",\"category\":\"Organization\",\"offset\":10,\"length\":9,\"confidenceScore\":0.37}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}", + "Date" : "Wed, 29 Apr 2020 17:12:19 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForEmptyText.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForEmptyText.json index 6c98d99c063a2..d62ca7b600f96 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForEmptyText.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForEmptyText.json @@ -1,10 +1,10 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/recognition/general?stringIndexType=Utf16CodeUnit", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//entities/recognition/general", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "067b153d-daf2-4391-ab4f-bc599ba04380", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "235ca2bb-7dd2-452b-9acd-a6196322953f", "Content-Type" : "application/json" }, "Response" : { @@ -12,11 +12,11 @@ "x-envoy-upstream-service-time" : "2", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", - "apim-request-id" : "2ba0796c-2e5a-4d48-977d-49ee4cf66514", + "apim-request-id" : "9891bfdc-977a-4561-9fa3-e2517e7d3c0e", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"documents\":[],\"errors\":[{\"id\":\"0\",\"error\":{\"code\":\"InvalidArgument\",\"message\":\"Invalid document in request.\",\"innererror\":{\"code\":\"InvalidDocument\",\"message\":\"Document text is empty.\"}}}],\"modelVersion\":\"2020-04-01\"}", - "Date" : "Thu, 03 Sep 2020 19:04:04 GMT", + "Date" : "Wed, 29 Apr 2020 17:12:20 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForFaultyText.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForFaultyText.json index 7e8b9bd8cea39..86ff28aca6126 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForFaultyText.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForFaultyText.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/recognition/general?stringIndexType=Utf16CodeUnit", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//entities/recognition/general", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "9165db69-6cfb-4621-9c5f-9787a67a8d74", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "b23078f9-d856-402d-9138-9ce2e07e0c4a", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "81", + "x-envoy-upstream-service-time" : "56", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "cebf70d2-9a34-4615-b849-ed137d79d74b", + "apim-request-id" : "e8cccb7c-1b1a-48c5-be73-8eb7435af38c", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"documents\":[{\"id\":\"0\",\"entities\":[],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}", - "Date" : "Thu, 03 Sep 2020 19:03:59 GMT", + "Date" : "Wed, 29 Apr 2020 17:12:19 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForListLanguageHint.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForListLanguageHint.json index 84c0b947841d8..51630aa29257e 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForListLanguageHint.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForListLanguageHint.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/recognition/general?stringIndexType=Utf16CodeUnit", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//entities/recognition/general", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "f4a48fa0-d757-4630-9cdb-776cb5cfd76e", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "039a577f-2ee6-4e6e-a5ca-334386f11459", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "103", + "x-envoy-upstream-service-time" : "102", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", - "apim-request-id" : "a04db155-9702-4a9a-8fac-3af231e1f12b", + "apim-request-id" : "5a80653a-fbc5-4e3a-9f55-7ee98a651260", "retry-after" : "0", "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"entities\":[{\"text\":\"trip\",\"category\":\"Event\",\"offset\":18,\"length\":4,\"confidenceScore\":0.61},{\"text\":\"Seattle\",\"category\":\"Location\",\"subcategory\":\"GPE\",\"offset\":26,\"length\":7,\"confidenceScore\":0.82},{\"text\":\"last week\",\"category\":\"DateTime\",\"subcategory\":\"DateRange\",\"offset\":34,\"length\":9,\"confidenceScore\":0.8}],\"warnings\":[]},{\"id\":\"1\",\"entities\":[{\"text\":\"Microsoft\",\"category\":\"Organization\",\"offset\":10,\"length\":9,\"confidenceScore\":0.77}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}", - "Date" : "Thu, 03 Sep 2020 19:03:56 GMT", + "Body" : "{\"documents\":[{\"id\":\"0\",\"entities\":[{\"text\":\"trip\",\"category\":\"Event\",\"offset\":18,\"length\":4,\"confidenceScore\":0.62},{\"text\":\"Seattle\",\"category\":\"Location\",\"subcategory\":\"GPE\",\"offset\":26,\"length\":7,\"confidenceScore\":0.6},{\"text\":\"last week\",\"category\":\"DateTime\",\"subcategory\":\"DateRange\",\"offset\":34,\"length\":9,\"confidenceScore\":0.8}],\"warnings\":[]},{\"id\":\"1\",\"entities\":[{\"text\":\"Microsoft\",\"category\":\"Organization\",\"offset\":10,\"length\":9,\"confidenceScore\":0.37}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}", + "Date" : "Wed, 29 Apr 2020 17:12:19 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForListWithOptions.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForListWithOptions.json index 881fda7f6e90d..626efdfb38703 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForListWithOptions.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForListWithOptions.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/recognition/general?showStats=true&stringIndexType=Utf16CodeUnit", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//entities/recognition/general?showStats=true", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "8b1b2c96-ca8a-4ed5-882b-cc29e584bce6", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "008fab9b-6761-4859-a195-0a59e32dd2e4", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "102", + "x-envoy-upstream-service-time" : "87", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", - "apim-request-id" : "b747308a-ce8a-4b55-a81d-2cb53b9ffdb9", + "apim-request-id" : "ea3fa9ac-ebcb-4d7d-8cd8-d6b6db1f6dde", "retry-after" : "0", "StatusCode" : "200", - "Body" : "{\"statistics\":{\"documentsCount\":2,\"validDocumentsCount\":2,\"erroneousDocumentsCount\":0,\"transactionsCount\":2},\"documents\":[{\"id\":\"0\",\"statistics\":{\"charactersCount\":44,\"transactionsCount\":1},\"entities\":[{\"text\":\"trip\",\"category\":\"Event\",\"offset\":18,\"length\":4,\"confidenceScore\":0.61},{\"text\":\"Seattle\",\"category\":\"Location\",\"subcategory\":\"GPE\",\"offset\":26,\"length\":7,\"confidenceScore\":0.82},{\"text\":\"last week\",\"category\":\"DateTime\",\"subcategory\":\"DateRange\",\"offset\":34,\"length\":9,\"confidenceScore\":0.8}],\"warnings\":[]},{\"id\":\"1\",\"statistics\":{\"charactersCount\":20,\"transactionsCount\":1},\"entities\":[{\"text\":\"Microsoft\",\"category\":\"Organization\",\"offset\":10,\"length\":9,\"confidenceScore\":0.77}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}", - "Date" : "Thu, 03 Sep 2020 19:03:55 GMT", + "Body" : "{\"statistics\":{\"documentsCount\":2,\"validDocumentsCount\":2,\"erroneousDocumentsCount\":0,\"transactionsCount\":2},\"documents\":[{\"id\":\"0\",\"statistics\":{\"charactersCount\":44,\"transactionsCount\":1},\"entities\":[{\"text\":\"trip\",\"category\":\"Event\",\"offset\":18,\"length\":4,\"confidenceScore\":0.62},{\"text\":\"Seattle\",\"category\":\"Location\",\"subcategory\":\"GPE\",\"offset\":26,\"length\":7,\"confidenceScore\":0.6},{\"text\":\"last week\",\"category\":\"DateTime\",\"subcategory\":\"DateRange\",\"offset\":34,\"length\":9,\"confidenceScore\":0.8}],\"warnings\":[]},{\"id\":\"1\",\"statistics\":{\"charactersCount\":20,\"transactionsCount\":1},\"entities\":[{\"text\":\"Microsoft\",\"category\":\"Organization\",\"offset\":10,\"length\":9,\"confidenceScore\":0.37}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}", + "Date" : "Wed, 29 Apr 2020 17:12:18 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForTextInput.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForTextInput.json index b39bb79df9c29..3e868809568df 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForTextInput.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForTextInput.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/recognition/general?stringIndexType=Utf16CodeUnit", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//entities/recognition/general", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "4753cf0f-77d5-4a26-9287-b4ea3504ccba", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "9cb6c777-9a17-45dc-8bc5-144f5bc4d59a", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "95", + "x-envoy-upstream-service-time" : "76", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "7fce4a2a-deaa-448c-9436-bf4e6944efe0", + "apim-request-id" : "3297d4e1-232d-46a0-ae46-205a2929c97e", "retry-after" : "0", "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"entities\":[{\"text\":\"trip\",\"category\":\"Event\",\"offset\":18,\"length\":4,\"confidenceScore\":0.61},{\"text\":\"Seattle\",\"category\":\"Location\",\"subcategory\":\"GPE\",\"offset\":26,\"length\":7,\"confidenceScore\":0.82},{\"text\":\"last week\",\"category\":\"DateTime\",\"subcategory\":\"DateRange\",\"offset\":34,\"length\":9,\"confidenceScore\":0.8}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}", - "Date" : "Thu, 03 Sep 2020 19:04:07 GMT", + "Body" : "{\"documents\":[{\"id\":\"0\",\"entities\":[{\"text\":\"trip\",\"category\":\"Event\",\"offset\":18,\"length\":4,\"confidenceScore\":0.62},{\"text\":\"Seattle\",\"category\":\"Location\",\"subcategory\":\"GPE\",\"offset\":26,\"length\":7,\"confidenceScore\":0.6},{\"text\":\"last week\",\"category\":\"DateTime\",\"subcategory\":\"DateRange\",\"offset\":34,\"length\":9,\"confidenceScore\":0.8}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}", + "Date" : "Wed, 29 Apr 2020 17:12:20 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesKoreanNfc.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesKoreanNfc.json deleted file mode 100644 index bff746ef06cd2..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesKoreanNfc.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/recognition/general?stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "d55a5919-9dc6-40d2-bc0a-e8652264b043", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "69", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "c4bb6ebd-db38-42e2-8d53-8c4c4b5e08a7", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"entities\":[{\"text\":\"Microsoft\",\"category\":\"Organization\",\"offset\":13,\"length\":9,\"confidenceScore\":0.7}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}", - "Date" : "Thu, 03 Sep 2020 17:50:08 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesKoreanNfd.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesKoreanNfd.json deleted file mode 100644 index d570999a497d1..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesKoreanNfd.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/recognition/general?stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "a0149344-6615-4916-a60b-511ab6e8bcfc", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "71", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "c5b47c5c-c946-4c84-aef3-50969f17d8e9", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"entities\":[{\"text\":\"Microsoft\",\"category\":\"Organization\",\"offset\":13,\"length\":9,\"confidenceScore\":0.7}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}", - "Date" : "Thu, 03 Sep 2020 17:50:08 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesTooManyDocuments.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesTooManyDocuments.json new file mode 100644 index 0000000000000..ff6bc75923457 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesTooManyDocuments.json @@ -0,0 +1,26 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.ppe.cognitiveservices.azure.com/text/analytics/v3.0//entities/recognition/general", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "2a6195db-9126-4c71-969d-0d75fa549c6d", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-envoy-upstream-service-time" : "128", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=6", + "apim-request-id" : "bb5b1fee-7fd8-4f5d-be80-8827934adb6e", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"documents\":[{\"id\":\"0\",\"entities\":[{\"text\":\"trip\",\"category\":\"Event\",\"offset\":18,\"length\":4,\"confidenceScore\":0.61},{\"text\":\"Seattle\",\"category\":\"Location\",\"subcategory\":\"GPE\",\"offset\":26,\"length\":7,\"confidenceScore\":0.82},{\"text\":\"last week\",\"category\":\"DateTime\",\"subcategory\":\"DateRange\",\"offset\":34,\"length\":9,\"confidenceScore\":0.8}],\"warnings\":[]},{\"id\":\"1\",\"entities\":[{\"text\":\"trip\",\"category\":\"Event\",\"offset\":18,\"length\":4,\"confidenceScore\":0.61},{\"text\":\"Seattle\",\"category\":\"Location\",\"subcategory\":\"GPE\",\"offset\":26,\"length\":7,\"confidenceScore\":0.82},{\"text\":\"last week\",\"category\":\"DateTime\",\"subcategory\":\"DateRange\",\"offset\":34,\"length\":9,\"confidenceScore\":0.8}],\"warnings\":[]},{\"id\":\"2\",\"entities\":[{\"text\":\"trip\",\"category\":\"Event\",\"offset\":18,\"length\":4,\"confidenceScore\":0.61},{\"text\":\"Seattle\",\"category\":\"Location\",\"subcategory\":\"GPE\",\"offset\":26,\"length\":7,\"confidenceScore\":0.82},{\"text\":\"last week\",\"category\":\"DateTime\",\"subcategory\":\"DateRange\",\"offset\":34,\"length\":9,\"confidenceScore\":0.8}],\"warnings\":[]},{\"id\":\"3\",\"entities\":[{\"text\":\"trip\",\"category\":\"Event\",\"offset\":18,\"length\":4,\"confidenceScore\":0.61},{\"text\":\"Seattle\",\"category\":\"Location\",\"subcategory\":\"GPE\",\"offset\":26,\"length\":7,\"confidenceScore\":0.82},{\"text\":\"last week\",\"category\":\"DateTime\",\"subcategory\":\"DateRange\",\"offset\":34,\"length\":9,\"confidenceScore\":0.8}],\"warnings\":[]},{\"id\":\"4\",\"entities\":[{\"text\":\"trip\",\"category\":\"Event\",\"offset\":18,\"length\":4,\"confidenceScore\":0.61},{\"text\":\"Seattle\",\"category\":\"Location\",\"subcategory\":\"GPE\",\"offset\":26,\"length\":7,\"confidenceScore\":0.82},{\"text\":\"last week\",\"category\":\"DateTime\",\"subcategory\":\"DateRange\",\"offset\":34,\"length\":9,\"confidenceScore\":0.8}],\"warnings\":[]},{\"id\":\"5\",\"entities\":[{\"text\":\"trip\",\"category\":\"Event\",\"offset\":18,\"length\":4,\"confidenceScore\":0.61},{\"text\":\"Seattle\",\"category\":\"Location\",\"subcategory\":\"GPE\",\"offset\":26,\"length\":7,\"confidenceScore\":0.82},{\"text\":\"last week\",\"category\":\"DateTime\",\"subcategory\":\"DateRange\",\"offset\":34,\"length\":9,\"confidenceScore\":0.8}],\"warnings\":[]}],\"errors\":[{\"id\":\"\",\"error\":{\"code\":\"InvalidRequest\",\"message\":\"The request has exceeded the allowed document limits.\",\"innererror\":{\"code\":\"InvalidDocumentBatch\",\"message\":\"The number of documents in the request have exceeded the data limitations. See https://aka.ms/text-analytics-data-limits for additional information\"}}}],\"modelVersion\":\"2020-04-01\"}", + "Date" : "Fri, 08 May 2020 05:52:36 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesZalgoText.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesZalgoText.json deleted file mode 100644 index 8cf499c3b4301..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesZalgoText.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/recognition/general?stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "8e2b4efd-4321-4597-b778-fc6fe9a302e8", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "110", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "f26b9f08-8382-4caa-9dda-4782b1194f3a", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"entities\":[{\"text\":\"Microsoft\",\"category\":\"Organization\",\"offset\":126,\"length\":9,\"confidenceScore\":0.6}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}", - "Date" : "Thu, 03 Sep 2020 17:50:03 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesBatchTooManyDocuments.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesBatchTooManyDocuments.json deleted file mode 100644 index 17f89e1c1fc02..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesBatchTooManyDocuments.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/linking?stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "fbad32bf-1259-4eb7-9a4f-f8521337eaff", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "6", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "apim-request-id" : "8a1d1704-07d4-458c-9333-8f1c32c99bf5", - "retry-after" : "0", - "StatusCode" : "400", - "Body" : "{\"error\":{\"code\":\"InvalidRequest\",\"message\":\"Invalid document in request.\",\"innererror\":{\"code\":\"InvalidDocumentBatch\",\"message\":\"Batch request contains too many records. Max 5 records are permitted.\"}}}", - "Date" : "Thu, 03 Sep 2020 19:03:53 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesDiacriticsNfc.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesDiacriticsNfc.json deleted file mode 100644 index 14cec16d7c80b..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesDiacriticsNfc.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/linking?stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "4e1fd9d0-d71c-46f5-b3a6-c1419a7c12ca", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "17", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "d00c2027-35d6-4c6b-b525-f3eae4c9f5d7", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"entities\":[{\"bingId\":\"a093e9b9-90f5-a3d5-c4b8-5855e1b01f85\",\"name\":\"Microsoft\",\"matches\":[{\"text\":\"Microsoft\",\"offset\":14,\"length\":9,\"confidenceScore\":0.24}],\"language\":\"en\",\"id\":\"Microsoft\",\"url\":\"https://en.wikipedia.org/wiki/Microsoft\",\"dataSource\":\"Wikipedia\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-02-01\"}", - "Date" : "Thu, 03 Sep 2020 17:50:17 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesDiacriticsNfd.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesDiacriticsNfd.json deleted file mode 100644 index 924c2687fec83..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesDiacriticsNfd.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/linking?stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "4d387dfc-ea7b-42aa-a3fb-21a763b7f482", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "18", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "b2f05755-5523-44fe-92e2-1e939411b555", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"entities\":[{\"bingId\":\"a093e9b9-90f5-a3d5-c4b8-5855e1b01f85\",\"name\":\"Microsoft\",\"matches\":[{\"text\":\"Microsoft\",\"offset\":15,\"length\":9,\"confidenceScore\":0.24}],\"language\":\"en\",\"id\":\"Microsoft\",\"url\":\"https://en.wikipedia.org/wiki/Microsoft\",\"dataSource\":\"Wikipedia\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-02-01\"}", - "Date" : "Thu, 03 Sep 2020 17:50:17 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesDuplicateIdInput.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesDuplicateIdInput.json index 3eb879c7e82fb..ad7e3561cd815 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesDuplicateIdInput.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesDuplicateIdInput.json @@ -1,10 +1,10 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/linking?stringIndexType=Utf16CodeUnit", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//entities/linking", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "a440f22c-b653-4ee0-9232-784cc62536bc", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "604f60ed-8d4d-43e8-bef7-954acfe4886c", "Content-Type" : "application/json" }, "Response" : { @@ -12,11 +12,11 @@ "x-envoy-upstream-service-time" : "5", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", - "apim-request-id" : "1c8f7654-a8e4-4a7b-ac4c-2a1be7baad2e", + "apim-request-id" : "17c4f097-2f3f-4fa4-98a0-a036e24933d6", "retry-after" : "0", "StatusCode" : "400", - "Body" : "{\"error\":{\"code\":\"InvalidRequest\",\"message\":\"Invalid document in request.\",\"innererror\":{\"code\":\"InvalidDocument\",\"message\":\"Request contains duplicated Ids. Make sure each document has a unique Id.\"}}}", - "Date" : "Thu, 03 Sep 2020 19:03:56 GMT", + "Body" : "{\"error\":{\"code\":\"InvalidRequest\",\"message\":\"Invalid document in request.\",\"innerError\":{\"code\":\"InvalidDocument\",\"message\":\"Request contains duplicated Ids. Make sure each document has a unique Id.\"}}}", + "Date" : "Thu, 30 Apr 2020 04:52:37 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesEmoji.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesEmoji.json deleted file mode 100644 index f5564a9dc3857..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesEmoji.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/linking?stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "ed776b78-5365-48c8-8ea1-4440799afaeb", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "18", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "019ba98f-c39e-48fa-b335-4170a35bbdb7", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"entities\":[{\"bingId\":\"a093e9b9-90f5-a3d5-c4b8-5855e1b01f85\",\"name\":\"Microsoft\",\"matches\":[{\"text\":\"Microsoft\",\"offset\":13,\"length\":9,\"confidenceScore\":0.25}],\"language\":\"en\",\"id\":\"Microsoft\",\"url\":\"https://en.wikipedia.org/wiki/Microsoft\",\"dataSource\":\"Wikipedia\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-02-01\"}", - "Date" : "Thu, 03 Sep 2020 17:49:58 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesEmojiFamily.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesEmojiFamily.json deleted file mode 100644 index ca846d748bafb..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesEmojiFamily.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/linking?stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "60f40ce4-3c24-481d-a222-e13c6174f717", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "17", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "5d3cbc20-4bea-4cdd-8e96-0c665aeb1f32", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"entities\":[{\"bingId\":\"a093e9b9-90f5-a3d5-c4b8-5855e1b01f85\",\"name\":\"Microsoft\",\"matches\":[{\"text\":\"Microsoft\",\"offset\":22,\"length\":9,\"confidenceScore\":0.25}],\"language\":\"en\",\"id\":\"Microsoft\",\"url\":\"https://en.wikipedia.org/wiki/Microsoft\",\"dataSource\":\"Wikipedia\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-02-01\"}", - "Date" : "Thu, 03 Sep 2020 17:50:06 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesEmojiFamilyWIthSkinToneModifier.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesEmojiFamilyWIthSkinToneModifier.json deleted file mode 100644 index 3ae20849f9dba..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesEmojiFamilyWIthSkinToneModifier.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/linking?stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "e338fece-4adc-4d0d-bde9-22cc55f36dbd", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "18", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "e5feeb63-f658-446a-a669-8666bfeed9ba", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"entities\":[{\"bingId\":\"a093e9b9-90f5-a3d5-c4b8-5855e1b01f85\",\"name\":\"Microsoft\",\"matches\":[{\"text\":\"Microsoft\",\"offset\":30,\"length\":9,\"confidenceScore\":0.25}],\"language\":\"en\",\"id\":\"Microsoft\",\"url\":\"https://en.wikipedia.org/wiki/Microsoft\",\"dataSource\":\"Wikipedia\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-02-01\"}", - "Date" : "Thu, 03 Sep 2020 17:49:59 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesEmojiWithSkinToneModifier.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesEmojiWithSkinToneModifier.json deleted file mode 100644 index fc672993366ef..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesEmojiWithSkinToneModifier.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/linking?stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "16c1350c-35f8-4c47-a627-020e0f07cf72", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "17", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "2b9980c9-b9a2-4a7d-af9e-0c9914e7ec4e", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"entities\":[{\"bingId\":\"a093e9b9-90f5-a3d5-c4b8-5855e1b01f85\",\"name\":\"Microsoft\",\"matches\":[{\"text\":\"Microsoft\",\"offset\":15,\"length\":9,\"confidenceScore\":0.25}],\"language\":\"en\",\"id\":\"Microsoft\",\"url\":\"https://en.wikipedia.org/wiki/Microsoft\",\"dataSource\":\"Wikipedia\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-02-01\"}", - "Date" : "Thu, 03 Sep 2020 17:49:54 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesEmptyIdInput.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesEmptyIdInput.json deleted file mode 100644 index 36b7cc72b162e..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesEmptyIdInput.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/linking?stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "1f4cb3a1-faab-44d0-b70b-b93021efc527", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "5", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "apim-request-id" : "1722fdcf-fc5e-452b-96aa-5784f11a015d", - "retry-after" : "0", - "StatusCode" : "400", - "Body" : "{\"error\":{\"code\":\"InvalidRequest\",\"message\":\"Invalid document in request.\",\"innererror\":{\"code\":\"InvalidDocument\",\"message\":\"At least one document is missing an Id attribute.\"}}}", - "Date" : "Thu, 03 Sep 2020 19:04:09 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForBatchInput.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForBatchInput.json index bf85d72dd9260..b29849149041a 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForBatchInput.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForBatchInput.json @@ -1,10 +1,10 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/linking?stringIndexType=Utf16CodeUnit", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//entities/linking", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "e1c8f748-2cf0-4bd7-9f03-b8c4615e17c1", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "cb5a7ee7-b977-4b83-866f-39f03af7a7d2", "Content-Type" : "application/json" }, "Response" : { @@ -13,11 +13,11 @@ "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", - "apim-request-id" : "f210df70-3aa8-4582-86f2-1ce572c7776a", + "apim-request-id" : "21baa840-355e-4ac0-ba17-4434a669aa70", "retry-after" : "0", "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"entities\":[{\"bingId\":\"5fbba6b8-85e1-4d41-9444-d9055436e473\",\"name\":\"Seattle\",\"matches\":[{\"text\":\"Seattle\",\"offset\":26,\"length\":7,\"confidenceScore\":0.19}],\"language\":\"en\",\"id\":\"Seattle\",\"url\":\"https://en.wikipedia.org/wiki/Seattle\",\"dataSource\":\"Wikipedia\"}],\"warnings\":[]},{\"id\":\"1\",\"entities\":[{\"bingId\":\"a093e9b9-90f5-a3d5-c4b8-5855e1b01f85\",\"name\":\"Microsoft\",\"matches\":[{\"text\":\"Microsoft\",\"offset\":10,\"length\":9,\"confidenceScore\":0.25}],\"language\":\"en\",\"id\":\"Microsoft\",\"url\":\"https://en.wikipedia.org/wiki/Microsoft\",\"dataSource\":\"Wikipedia\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-02-01\"}", - "Date" : "Thu, 03 Sep 2020 19:03:58 GMT", + "Body" : "{\"documents\":[{\"id\":\"0\",\"entities\":[{\"name\":\"Seattle\",\"matches\":[{\"text\":\"Seattle\",\"offset\":26,\"length\":7,\"confidenceScore\":0.0}],\"language\":\"en\",\"id\":\"Seattle\",\"url\":\"https://en.wikipedia.org/wiki/Seattle\",\"dataSource\":\"Wikipedia\"}],\"warnings\":[]},{\"id\":\"1\",\"entities\":[{\"name\":\"Microsoft\",\"matches\":[{\"text\":\"Microsoft\",\"offset\":10,\"length\":9,\"confidenceScore\":0.0}],\"language\":\"en\",\"id\":\"Microsoft\",\"url\":\"https://en.wikipedia.org/wiki/Microsoft\",\"dataSource\":\"Wikipedia\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-02-01\"}", + "Date" : "Wed, 29 Apr 2020 17:12:19 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForBatchInputShowStatistics.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForBatchInputShowStatistics.json index 26e880cc18505..fd7689f634631 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForBatchInputShowStatistics.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForBatchInputShowStatistics.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/linking?showStats=true&stringIndexType=Utf16CodeUnit", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//entities/linking?showStats=true", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "37dab68e-5479-47b4-9d0a-b6d37e6f5ffe", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "8b28c5ff-1989-459c-925d-8e1de9030f7d", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "19", + "x-envoy-upstream-service-time" : "18", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", - "apim-request-id" : "1e3cd7e5-e062-4163-8601-e11a5efd5b04", + "apim-request-id" : "4d1fa8fe-1ec6-4fcf-86b7-9f551acf9945", "retry-after" : "0", "StatusCode" : "200", - "Body" : "{\"statistics\":{\"documentsCount\":2,\"validDocumentsCount\":2,\"erroneousDocumentsCount\":0,\"transactionsCount\":2},\"documents\":[{\"id\":\"0\",\"statistics\":{\"charactersCount\":44,\"transactionsCount\":1},\"entities\":[{\"bingId\":\"5fbba6b8-85e1-4d41-9444-d9055436e473\",\"name\":\"Seattle\",\"matches\":[{\"text\":\"Seattle\",\"offset\":26,\"length\":7,\"confidenceScore\":0.19}],\"language\":\"en\",\"id\":\"Seattle\",\"url\":\"https://en.wikipedia.org/wiki/Seattle\",\"dataSource\":\"Wikipedia\"}],\"warnings\":[]},{\"id\":\"1\",\"statistics\":{\"charactersCount\":20,\"transactionsCount\":1},\"entities\":[{\"bingId\":\"a093e9b9-90f5-a3d5-c4b8-5855e1b01f85\",\"name\":\"Microsoft\",\"matches\":[{\"text\":\"Microsoft\",\"offset\":10,\"length\":9,\"confidenceScore\":0.25}],\"language\":\"en\",\"id\":\"Microsoft\",\"url\":\"https://en.wikipedia.org/wiki/Microsoft\",\"dataSource\":\"Wikipedia\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-02-01\"}", - "Date" : "Thu, 03 Sep 2020 19:04:08 GMT", + "Body" : "{\"statistics\":{\"documentsCount\":2,\"validDocumentsCount\":2,\"erroneousDocumentsCount\":0,\"transactionsCount\":2},\"documents\":[{\"id\":\"0\",\"statistics\":{\"charactersCount\":44,\"transactionsCount\":1},\"entities\":[{\"name\":\"Seattle\",\"matches\":[{\"text\":\"Seattle\",\"offset\":26,\"length\":7,\"confidenceScore\":0.0}],\"language\":\"en\",\"id\":\"Seattle\",\"url\":\"https://en.wikipedia.org/wiki/Seattle\",\"dataSource\":\"Wikipedia\"}],\"warnings\":[]},{\"id\":\"1\",\"statistics\":{\"charactersCount\":20,\"transactionsCount\":1},\"entities\":[{\"name\":\"Microsoft\",\"matches\":[{\"text\":\"Microsoft\",\"offset\":10,\"length\":9,\"confidenceScore\":0.0}],\"language\":\"en\",\"id\":\"Microsoft\",\"url\":\"https://en.wikipedia.org/wiki/Microsoft\",\"dataSource\":\"Wikipedia\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-02-01\"}", + "Date" : "Wed, 29 Apr 2020 17:12:20 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForBatchStringInput.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForBatchStringInput.json index c2b49616c3aed..da426aaea9fe6 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForBatchStringInput.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForBatchStringInput.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/linking?stringIndexType=Utf16CodeUnit", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//entities/linking", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "221b9e2d-de44-4686-b404-50cc7cb768fa", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "ba5ba3c8-7119-4cff-8888-bc522556cfc3", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "19", + "x-envoy-upstream-service-time" : "18", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", - "apim-request-id" : "3e7331c8-2fc3-4948-81a3-38fa0e796499", + "apim-request-id" : "db699c2b-7ca7-4348-8570-7ede1f277d4a", "retry-after" : "0", "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"entities\":[{\"bingId\":\"5fbba6b8-85e1-4d41-9444-d9055436e473\",\"name\":\"Seattle\",\"matches\":[{\"text\":\"Seattle\",\"offset\":26,\"length\":7,\"confidenceScore\":0.19}],\"language\":\"en\",\"id\":\"Seattle\",\"url\":\"https://en.wikipedia.org/wiki/Seattle\",\"dataSource\":\"Wikipedia\"}],\"warnings\":[]},{\"id\":\"1\",\"entities\":[{\"bingId\":\"a093e9b9-90f5-a3d5-c4b8-5855e1b01f85\",\"name\":\"Microsoft\",\"matches\":[{\"text\":\"Microsoft\",\"offset\":10,\"length\":9,\"confidenceScore\":0.25}],\"language\":\"en\",\"id\":\"Microsoft\",\"url\":\"https://en.wikipedia.org/wiki/Microsoft\",\"dataSource\":\"Wikipedia\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-02-01\"}", - "Date" : "Thu, 03 Sep 2020 19:03:48 GMT", + "Body" : "{\"documents\":[{\"id\":\"0\",\"entities\":[{\"name\":\"Seattle\",\"matches\":[{\"text\":\"Seattle\",\"offset\":26,\"length\":7,\"confidenceScore\":0.0}],\"language\":\"en\",\"id\":\"Seattle\",\"url\":\"https://en.wikipedia.org/wiki/Seattle\",\"dataSource\":\"Wikipedia\"}],\"warnings\":[]},{\"id\":\"1\",\"entities\":[{\"name\":\"Microsoft\",\"matches\":[{\"text\":\"Microsoft\",\"offset\":10,\"length\":9,\"confidenceScore\":0.0}],\"language\":\"en\",\"id\":\"Microsoft\",\"url\":\"https://en.wikipedia.org/wiki/Microsoft\",\"dataSource\":\"Wikipedia\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-02-01\"}", + "Date" : "Wed, 29 Apr 2020 17:12:18 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForEmptyText.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForEmptyText.json index e887313109e8b..c8945efee485a 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForEmptyText.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForEmptyText.json @@ -1,22 +1,22 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/linking?stringIndexType=Utf16CodeUnit", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//entities/linking", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "ce295d63-1914-4fcf-ba4b-735f0c2a8e18", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "5afd8182-c8f2-454c-8278-95132a14f5af", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "3", + "x-envoy-upstream-service-time" : "2", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", - "apim-request-id" : "39bc7bfe-d988-4a68-a754-59e203752699", + "apim-request-id" : "de80e78b-df15-4a64-8f1a-4ebbe7450dd8", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"documents\":[],\"errors\":[{\"id\":\"0\",\"error\":{\"code\":\"InvalidArgument\",\"message\":\"Invalid document in request.\",\"innererror\":{\"code\":\"InvalidDocument\",\"message\":\"Document text is empty.\"}}}],\"modelVersion\":\"2020-02-01\"}", - "Date" : "Thu, 03 Sep 2020 19:03:49 GMT", + "Date" : "Wed, 29 Apr 2020 17:12:18 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForFaultyText.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForFaultyText.json index f1d29b442757d..f1e76d293f582 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForFaultyText.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForFaultyText.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/linking?stringIndexType=Utf16CodeUnit", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//entities/linking", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "8179787d-9312-4cb1-8747-2b41d0e48e9e", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "2f50a5ed-679e-485d-a1c6-59921c90d5a5", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "20", + "x-envoy-upstream-service-time" : "16", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "cf9a6d3e-a747-4ab2-8f5b-0898f875c5ff", + "apim-request-id" : "56625abf-52f0-4967-b086-0a7a90cbb690", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"documents\":[{\"id\":\"0\",\"entities\":[],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-02-01\"}", - "Date" : "Thu, 03 Sep 2020 19:04:04 GMT", + "Date" : "Wed, 29 Apr 2020 17:12:20 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForListLanguageHint.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForListLanguageHint.json index 05c34744f5ecf..1967eac24394f 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForListLanguageHint.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForListLanguageHint.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/linking?stringIndexType=Utf16CodeUnit", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//entities/linking", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "11d209dc-1fc0-40cf-93a8-1f9699c78d1a", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "3c1af4aa-544e-450e-9b6d-5301807e72ee", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "28", + "x-envoy-upstream-service-time" : "22", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", - "apim-request-id" : "932288b8-1eac-4c44-bac5-ee5fa2124d36", + "apim-request-id" : "40e4642c-01a0-4ab7-9a77-fafd4ca83dc2", "retry-after" : "0", "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"entities\":[{\"bingId\":\"5fbba6b8-85e1-4d41-9444-d9055436e473\",\"name\":\"Seattle\",\"matches\":[{\"text\":\"Seattle\",\"offset\":26,\"length\":7,\"confidenceScore\":0.19}],\"language\":\"en\",\"id\":\"Seattle\",\"url\":\"https://en.wikipedia.org/wiki/Seattle\",\"dataSource\":\"Wikipedia\"}],\"warnings\":[]},{\"id\":\"1\",\"entities\":[{\"bingId\":\"a093e9b9-90f5-a3d5-c4b8-5855e1b01f85\",\"name\":\"Microsoft\",\"matches\":[{\"text\":\"Microsoft\",\"offset\":10,\"length\":9,\"confidenceScore\":0.25}],\"language\":\"en\",\"id\":\"Microsoft\",\"url\":\"https://en.wikipedia.org/wiki/Microsoft\",\"dataSource\":\"Wikipedia\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-02-01\"}", - "Date" : "Thu, 03 Sep 2020 19:03:44 GMT", + "Body" : "{\"documents\":[{\"id\":\"0\",\"entities\":[{\"name\":\"Seattle\",\"matches\":[{\"text\":\"Seattle\",\"offset\":26,\"length\":7,\"confidenceScore\":0.0}],\"language\":\"en\",\"id\":\"Seattle\",\"url\":\"https://en.wikipedia.org/wiki/Seattle\",\"dataSource\":\"Wikipedia\"}],\"warnings\":[]},{\"id\":\"1\",\"entities\":[{\"name\":\"Microsoft\",\"matches\":[{\"text\":\"Microsoft\",\"offset\":10,\"length\":9,\"confidenceScore\":0.0}],\"language\":\"en\",\"id\":\"Microsoft\",\"url\":\"https://en.wikipedia.org/wiki/Microsoft\",\"dataSource\":\"Wikipedia\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-02-01\"}", + "Date" : "Wed, 29 Apr 2020 17:12:18 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForListStringWithOptions.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForListStringWithOptions.json index 67c3feb6fd544..bf0f9fea801c5 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForListStringWithOptions.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForListStringWithOptions.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/linking?showStats=true&stringIndexType=Utf16CodeUnit", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//entities/linking?showStats=true", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "7bdf1e0b-aef0-4ed6-8d07-7e8709a51afe", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "e731ff31-c9b5-4844-a5eb-c6e519d2e50a", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "29", + "x-envoy-upstream-service-time" : "20", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", - "apim-request-id" : "8cba5377-ce03-462c-a18c-9d64278cd6f8", + "apim-request-id" : "eb22c862-77fa-4ca4-89e0-3118525a5952", "retry-after" : "0", "StatusCode" : "200", - "Body" : "{\"statistics\":{\"documentsCount\":2,\"validDocumentsCount\":2,\"erroneousDocumentsCount\":0,\"transactionsCount\":2},\"documents\":[{\"id\":\"0\",\"statistics\":{\"charactersCount\":44,\"transactionsCount\":1},\"entities\":[{\"bingId\":\"5fbba6b8-85e1-4d41-9444-d9055436e473\",\"name\":\"Seattle\",\"matches\":[{\"text\":\"Seattle\",\"offset\":26,\"length\":7,\"confidenceScore\":0.19}],\"language\":\"en\",\"id\":\"Seattle\",\"url\":\"https://en.wikipedia.org/wiki/Seattle\",\"dataSource\":\"Wikipedia\"}],\"warnings\":[]},{\"id\":\"1\",\"statistics\":{\"charactersCount\":20,\"transactionsCount\":1},\"entities\":[{\"bingId\":\"a093e9b9-90f5-a3d5-c4b8-5855e1b01f85\",\"name\":\"Microsoft\",\"matches\":[{\"text\":\"Microsoft\",\"offset\":10,\"length\":9,\"confidenceScore\":0.25}],\"language\":\"en\",\"id\":\"Microsoft\",\"url\":\"https://en.wikipedia.org/wiki/Microsoft\",\"dataSource\":\"Wikipedia\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-02-01\"}", - "Date" : "Thu, 03 Sep 2020 19:03:50 GMT", + "Body" : "{\"statistics\":{\"documentsCount\":2,\"validDocumentsCount\":2,\"erroneousDocumentsCount\":0,\"transactionsCount\":2},\"documents\":[{\"id\":\"0\",\"statistics\":{\"charactersCount\":44,\"transactionsCount\":1},\"entities\":[{\"name\":\"Seattle\",\"matches\":[{\"text\":\"Seattle\",\"offset\":26,\"length\":7,\"confidenceScore\":0.0}],\"language\":\"en\",\"id\":\"Seattle\",\"url\":\"https://en.wikipedia.org/wiki/Seattle\",\"dataSource\":\"Wikipedia\"}],\"warnings\":[]},{\"id\":\"1\",\"statistics\":{\"charactersCount\":20,\"transactionsCount\":1},\"entities\":[{\"name\":\"Microsoft\",\"matches\":[{\"text\":\"Microsoft\",\"offset\":10,\"length\":9,\"confidenceScore\":0.0}],\"language\":\"en\",\"id\":\"Microsoft\",\"url\":\"https://en.wikipedia.org/wiki/Microsoft\",\"dataSource\":\"Wikipedia\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-02-01\"}", + "Date" : "Wed, 29 Apr 2020 17:12:18 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForTextInput.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForTextInput.json index 9b0cfd97af9ff..02a66126f7a60 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForTextInput.json +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForTextInput.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/linking?stringIndexType=Utf16CodeUnit", + "Uri" : "https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0//entities/linking", "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "1843ea29-e72a-4e1a-a45d-33b292b53331", + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "1e6f521e-b399-45f8-80cd-05eb0f720c22", "Content-Type" : "application/json" }, "Response" : { "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "25", + "x-envoy-upstream-service-time" : "16", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", "x-content-type-options" : "nosniff", "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "93a9cc71-5a51-49c2-a772-929ddc138623", + "apim-request-id" : "f795a6fd-89cc-41ef-9031-1145491039f9", "retry-after" : "0", "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"entities\":[{\"bingId\":\"5fbba6b8-85e1-4d41-9444-d9055436e473\",\"name\":\"Seattle\",\"matches\":[{\"text\":\"Seattle\",\"offset\":26,\"length\":7,\"confidenceScore\":0.19}],\"language\":\"en\",\"id\":\"Seattle\",\"url\":\"https://en.wikipedia.org/wiki/Seattle\",\"dataSource\":\"Wikipedia\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-02-01\"}", - "Date" : "Thu, 03 Sep 2020 19:03:51 GMT", + "Body" : "{\"documents\":[{\"id\":\"0\",\"entities\":[{\"name\":\"Seattle\",\"matches\":[{\"text\":\"Seattle\",\"offset\":26,\"length\":7,\"confidenceScore\":0.0}],\"language\":\"en\",\"id\":\"Seattle\",\"url\":\"https://en.wikipedia.org/wiki/Seattle\",\"dataSource\":\"Wikipedia\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-02-01\"}", + "Date" : "Wed, 29 Apr 2020 17:12:18 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesKoreanNfc.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesKoreanNfc.json deleted file mode 100644 index 44977cc8e35aa..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesKoreanNfc.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/linking?stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "b8db2fba-e3da-4763-a0c5-0561f992f779", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "18", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "eb3737fe-a88e-41e0-ba13-65e46bdbc496", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"entities\":[{\"bingId\":\"a093e9b9-90f5-a3d5-c4b8-5855e1b01f85\",\"name\":\"Microsoft\",\"matches\":[{\"text\":\"Microsoft\",\"offset\":13,\"length\":9,\"confidenceScore\":0.25}],\"language\":\"en\",\"id\":\"Microsoft\",\"url\":\"https://en.wikipedia.org/wiki/Microsoft\",\"dataSource\":\"Wikipedia\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-02-01\"}", - "Date" : "Thu, 03 Sep 2020 17:49:56 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesKoreanNfd.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesKoreanNfd.json deleted file mode 100644 index 089cb505c0c08..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesKoreanNfd.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/linking?stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "a75ff53a-acad-47b3-81c2-dcdfc25ecd2e", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "17", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "2d041cdc-6c69-4bd6-b514-d15249c1d8d0", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"entities\":[{\"bingId\":\"a093e9b9-90f5-a3d5-c4b8-5855e1b01f85\",\"name\":\"Microsoft\",\"matches\":[{\"text\":\"Microsoft\",\"offset\":13,\"length\":9,\"confidenceScore\":0.25}],\"language\":\"en\",\"id\":\"Microsoft\",\"url\":\"https://en.wikipedia.org/wiki/Microsoft\",\"dataSource\":\"Wikipedia\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-02-01\"}", - "Date" : "Thu, 03 Sep 2020 17:49:56 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesTooManyDocuments.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesTooManyDocuments.json new file mode 100644 index 0000000000000..be076b357cc59 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesTooManyDocuments.json @@ -0,0 +1,26 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.ppe.cognitiveservices.azure.com/text/analytics/v3.0//entities/linking", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.5 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "ab2a170a-32eb-49d4-9d94-ff4a39902642", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-envoy-upstream-service-time" : "23", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=6", + "apim-request-id" : "819dd030-8b6e-4924-a9de-948c319b02f4", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"documents\":[{\"id\":\"0\",\"entities\":[{\"name\":\"Seattle\",\"matches\":[{\"text\":\"Seattle\",\"offset\":26,\"length\":7,\"confidenceScore\":0.19}],\"language\":\"en\",\"id\":\"Seattle\",\"url\":\"https://en.wikipedia.org/wiki/Seattle\",\"dataSource\":\"Wikipedia\"}],\"warnings\":[]},{\"id\":\"1\",\"entities\":[{\"name\":\"Seattle\",\"matches\":[{\"text\":\"Seattle\",\"offset\":26,\"length\":7,\"confidenceScore\":0.19}],\"language\":\"en\",\"id\":\"Seattle\",\"url\":\"https://en.wikipedia.org/wiki/Seattle\",\"dataSource\":\"Wikipedia\"}],\"warnings\":[]},{\"id\":\"2\",\"entities\":[{\"name\":\"Seattle\",\"matches\":[{\"text\":\"Seattle\",\"offset\":26,\"length\":7,\"confidenceScore\":0.19}],\"language\":\"en\",\"id\":\"Seattle\",\"url\":\"https://en.wikipedia.org/wiki/Seattle\",\"dataSource\":\"Wikipedia\"}],\"warnings\":[]},{\"id\":\"3\",\"entities\":[{\"name\":\"Seattle\",\"matches\":[{\"text\":\"Seattle\",\"offset\":26,\"length\":7,\"confidenceScore\":0.19}],\"language\":\"en\",\"id\":\"Seattle\",\"url\":\"https://en.wikipedia.org/wiki/Seattle\",\"dataSource\":\"Wikipedia\"}],\"warnings\":[]},{\"id\":\"4\",\"entities\":[{\"name\":\"Seattle\",\"matches\":[{\"text\":\"Seattle\",\"offset\":26,\"length\":7,\"confidenceScore\":0.19}],\"language\":\"en\",\"id\":\"Seattle\",\"url\":\"https://en.wikipedia.org/wiki/Seattle\",\"dataSource\":\"Wikipedia\"}],\"warnings\":[]},{\"id\":\"5\",\"entities\":[{\"name\":\"Seattle\",\"matches\":[{\"text\":\"Seattle\",\"offset\":26,\"length\":7,\"confidenceScore\":0.19}],\"language\":\"en\",\"id\":\"Seattle\",\"url\":\"https://en.wikipedia.org/wiki/Seattle\",\"dataSource\":\"Wikipedia\"}],\"warnings\":[]}],\"errors\":[{\"id\":\"\",\"error\":{\"code\":\"InvalidRequest\",\"message\":\"The request has exceeded the allowed document limits.\",\"innererror\":{\"code\":\"InvalidDocumentBatch\",\"message\":\"The number of documents in the request have exceeded the data limitations. See https://aka.ms/text-analytics-data-limits for additional information\"}}}],\"modelVersion\":\"2020-02-01\"}", + "Date" : "Fri, 08 May 2020 05:52:38 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesZalgoText.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesZalgoText.json deleted file mode 100644 index 4737b65c5bada..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesZalgoText.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/linking?stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "556d27cd-784d-4592-9b9a-379abc1bbf6d", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "17", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "dc82672d-a7d5-4bd9-a061-e39025ebfa57", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"documents\":[{\"id\":\"0\",\"entities\":[{\"bingId\":\"a093e9b9-90f5-a3d5-c4b8-5855e1b01f85\",\"name\":\"Microsoft\",\"matches\":[{\"text\":\"Microsoft\",\"offset\":126,\"length\":9,\"confidenceScore\":0.25}],\"language\":\"en\",\"id\":\"Microsoft\",\"url\":\"https://en.wikipedia.org/wiki/Microsoft\",\"dataSource\":\"Wikipedia\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-02-01\"}", - "Date" : "Thu, 03 Sep 2020 17:50:15 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesBatchInputSingleError.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesBatchInputSingleError.json deleted file mode 100644 index 03d0c3f58ce5c..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesBatchInputSingleError.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/recognition/pii?stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "b9b7d09e-a0c8-434b-bf5a-2a4c520fcabe", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "2", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "apim-request-id" : "9e3ca1e8-977f-410e-bab7-930bc13a0b9e", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"documents\":[],\"errors\":[{\"id\":\"2\",\"error\":{\"code\":\"InvalidArgument\",\"message\":\"Invalid document in request.\",\"innererror\":{\"code\":\"InvalidDocument\",\"message\":\"Document text is empty.\"}}}],\"modelVersion\":\"2020-07-01\"}", - "Date" : "Thu, 03 Sep 2020 19:03:51 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesBatchTooManyDocuments.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesBatchTooManyDocuments.json deleted file mode 100644 index 4c62d3bdbbcf5..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesBatchTooManyDocuments.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/recognition/pii?stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "d9a37065-663c-4410-a5b4-e7b09b0e8487", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "4", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "apim-request-id" : "0feaf027-4184-4837-a2ca-25a1f057de83", - "retry-after" : "0", - "StatusCode" : "400", - "Body" : "{\"error\":{\"code\":\"InvalidRequest\",\"message\":\"Invalid document in request.\",\"innererror\":{\"code\":\"InvalidDocumentBatch\",\"message\":\"Batch request contains too many records. Max 5 records are permitted.\"}}}", - "Date" : "Thu, 03 Sep 2020 19:04:02 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesDiacriticsNfc.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesDiacriticsNfc.json deleted file mode 100644 index 6480e3e2a8cf2..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesDiacriticsNfc.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/recognition/pii?stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "f364b5ff-a2d4-43b2-8324-4344bfd23512", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "71", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "08b2422e-34ff-4a56-b89e-cf25bdc7449b", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"documents\":[{\"redactedText\":\"año SSN: ***********\",\"id\":\"0\",\"entities\":[{\"text\":\"859-98-0987\",\"category\":\"U.S. Social Security Number (SSN)\",\"offset\":9,\"length\":11,\"confidenceScore\":0.65}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-07-01\"}", - "Date" : "Thu, 03 Sep 2020 17:49:56 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesDiacriticsNfd.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesDiacriticsNfd.json deleted file mode 100644 index c6525ca3042e3..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesDiacriticsNfd.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/recognition/pii?stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "afb9b994-64a4-42f1-97fa-ccdee7df94ce", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "84", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "bf92ce69-66bf-4685-82c0-5a1707f836f8", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"documents\":[{\"redactedText\":\"año SSN: ***********\",\"id\":\"0\",\"entities\":[{\"text\":\"859-98-0987\",\"category\":\"U.S. Social Security Number (SSN)\",\"offset\":10,\"length\":11,\"confidenceScore\":0.65}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-07-01\"}", - "Date" : "Thu, 03 Sep 2020 17:49:56 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesDuplicateIdInput.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesDuplicateIdInput.json deleted file mode 100644 index b73b63c3c142c..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesDuplicateIdInput.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/recognition/pii?stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "6165bd6b-195d-4bb1-b6ad-2e4bc8309197", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "5", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "apim-request-id" : "9f8ffe1c-f9b2-47f4-bc14-ecab38e9c556", - "retry-after" : "0", - "StatusCode" : "400", - "Body" : "{\"error\":{\"code\":\"InvalidRequest\",\"message\":\"Invalid document in request.\",\"innererror\":{\"code\":\"InvalidDocument\",\"message\":\"Request contains duplicated Ids. Make sure each document has a unique Id.\"}}}", - "Date" : "Thu, 03 Sep 2020 19:03:54 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesEmoji.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesEmoji.json deleted file mode 100644 index f3169fd7515e1..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesEmoji.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/recognition/pii?stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "ead30b42-6828-4db7-8129-75a46aa4fdb0", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "74", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "902c4ae5-0530-4b7d-ad03-467de2c8cb3d", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"documents\":[{\"redactedText\":\"\uD83D\uDC69 SSN: ***********\",\"id\":\"0\",\"entities\":[{\"text\":\"859-98-0987\",\"category\":\"U.S. Social Security Number (SSN)\",\"offset\":8,\"length\":11,\"confidenceScore\":0.65}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-07-01\"}", - "Date" : "Thu, 03 Sep 2020 17:50:17 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesEmojiFamily.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesEmojiFamily.json deleted file mode 100644 index 022addbbb8b07..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesEmojiFamily.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/recognition/pii?stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "9ccae6b4-fa24-4137-a0b4-7630c36fceb9", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "75", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "b60ae1b5-8519-49da-9a4c-ca2eb0ef6cc9", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"documents\":[{\"redactedText\":\"\uD83D\uDC69‍\uD83D\uDC69‍\uD83D\uDC67‍\uD83D\uDC67 SSN: ***********\",\"id\":\"0\",\"entities\":[{\"text\":\"859-98-0987\",\"category\":\"U.S. Social Security Number (SSN)\",\"offset\":17,\"length\":11,\"confidenceScore\":0.65}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-07-01\"}", - "Date" : "Thu, 03 Sep 2020 17:50:07 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesEmojiFamilyWIthSkinToneModifier.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesEmojiFamilyWIthSkinToneModifier.json deleted file mode 100644 index d3ac8514fe2e4..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesEmojiFamilyWIthSkinToneModifier.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/recognition/pii?stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "0410d1f2-ca75-4d61-9369-6e0c37facbd0", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "87", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "ff14a533-91f4-4844-9179-06982bfc701e", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"documents\":[{\"redactedText\":\"\uD83D\uDC69\uD83C\uDFFB‍\uD83D\uDC69\uD83C\uDFFD‍\uD83D\uDC67\uD83C\uDFFE‍\uD83D\uDC66\uD83C\uDFFF SSN: ***********\",\"id\":\"0\",\"entities\":[{\"text\":\"859-98-0987\",\"category\":\"U.S. Social Security Number (SSN)\",\"offset\":25,\"length\":11,\"confidenceScore\":0.65}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-07-01\"}", - "Date" : "Thu, 03 Sep 2020 17:50:13 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesEmojiWithSkinToneModifier.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesEmojiWithSkinToneModifier.json deleted file mode 100644 index e293f20ed5729..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesEmojiWithSkinToneModifier.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/recognition/pii?stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "7066bb6c-0633-4fb0-828c-2ac39db966ee", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "75", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "8f8da601-ba30-4b65-9999-a14718a09116", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"documents\":[{\"redactedText\":\"\uD83D\uDC69\uD83C\uDFFB SSN: ***********\",\"id\":\"0\",\"entities\":[{\"text\":\"859-98-0987\",\"category\":\"U.S. Social Security Number (SSN)\",\"offset\":10,\"length\":11,\"confidenceScore\":0.65}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-07-01\"}", - "Date" : "Thu, 03 Sep 2020 17:50:05 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesEmptyIdInput.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesEmptyIdInput.json deleted file mode 100644 index 841dbade9de58..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesEmptyIdInput.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/recognition/pii?stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "80f7c4f5-bf4b-476a-b334-c75a5c0d88f3", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "4", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "apim-request-id" : "6769b139-75b2-410d-ad06-d55e0355110c", - "retry-after" : "0", - "StatusCode" : "400", - "Body" : "{\"error\":{\"code\":\"InvalidRequest\",\"message\":\"Invalid document in request.\",\"innererror\":{\"code\":\"InvalidDocument\",\"message\":\"At least one document is missing an Id attribute.\"}}}", - "Date" : "Thu, 03 Sep 2020 19:03:57 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForBatchInput.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForBatchInput.json deleted file mode 100644 index b857deabf9b78..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForBatchInput.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/recognition/pii?stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "2cc26d76-5c36-4871-9b00-fd586f991928", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "193", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", - "apim-request-id" : "1331c29b-b6db-4197-84b4-87a9827e0b5e", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"documents\":[{\"redactedText\":\"********* employee with ssn *********** is using our awesome API's.\",\"id\":\"0\",\"entities\":[{\"text\":\"Microsoft\",\"category\":\"Organization\",\"offset\":0,\"length\":9,\"confidenceScore\":0.38},{\"text\":\"859-98-0987\",\"category\":\"U.S. Social Security Number (SSN)\",\"offset\":28,\"length\":11,\"confidenceScore\":0.65}],\"warnings\":[]},{\"redactedText\":\"Your ABA number - ********* - is the first 9 digits in the lower left hand corner of your personal check.\",\"id\":\"1\",\"entities\":[{\"text\":\"111000025\",\"category\":\"Phone Number\",\"offset\":18,\"length\":9,\"confidenceScore\":0.8},{\"text\":\"111000025\",\"category\":\"ABA Routing Number\",\"offset\":18,\"length\":9,\"confidenceScore\":0.75},{\"text\":\"111000025\",\"category\":\"New Zealand Social Welfare Number\",\"offset\":18,\"length\":9,\"confidenceScore\":0.65},{\"text\":\"111000025\",\"category\":\"Portugal Tax Identification Number\",\"offset\":18,\"length\":9,\"confidenceScore\":0.65}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-07-01\"}", - "Date" : "Thu, 03 Sep 2020 19:04:02 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForBatchInputForDomainFilter.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForBatchInputForDomainFilter.json deleted file mode 100644 index daf76590799c6..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForBatchInputForDomainFilter.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/recognition/pii?showStats=false&domain=PHI&stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "d12860b5-4b4d-4277-9064-1512b84f289c", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "122", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", - "apim-request-id" : "8eddd6a4-0d46-438e-b359-16ef4b9085ec", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"documents\":[{\"redactedText\":\"Microsoft employee with ssn *********** is using our awesome API's.\",\"id\":\"0\",\"entities\":[{\"text\":\"859-98-0987\",\"category\":\"U.S. Social Security Number (SSN)\",\"offset\":28,\"length\":11,\"confidenceScore\":0.65}],\"warnings\":[]},{\"redactedText\":\"Your ABA number - ********* - is the first 9 digits in the lower left hand corner of your personal check.\",\"id\":\"1\",\"entities\":[{\"text\":\"111000025\",\"category\":\"Phone Number\",\"offset\":18,\"length\":9,\"confidenceScore\":0.8},{\"text\":\"111000025\",\"category\":\"ABA Routing Number\",\"offset\":18,\"length\":9,\"confidenceScore\":0.75},{\"text\":\"111000025\",\"category\":\"New Zealand Social Welfare Number\",\"offset\":18,\"length\":9,\"confidenceScore\":0.65}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-07-01\"}", - "Date" : "Thu, 03 Sep 2020 22:35:33 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForBatchInputShowStatistics.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForBatchInputShowStatistics.json deleted file mode 100644 index cd8e68a97305d..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForBatchInputShowStatistics.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/recognition/pii?showStats=true&stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "cf15b07d-130d-41bb-9d10-ec7e9c588986", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "167", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", - "apim-request-id" : "b11ce7ce-5a3b-4c88-b749-af92b1818d1b", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"statistics\":{\"documentsCount\":2,\"validDocumentsCount\":2,\"erroneousDocumentsCount\":0,\"transactionsCount\":2},\"documents\":[{\"redactedText\":\"********* employee with ssn *********** is using our awesome API's.\",\"id\":\"0\",\"statistics\":{\"charactersCount\":67,\"transactionsCount\":1},\"entities\":[{\"text\":\"Microsoft\",\"category\":\"Organization\",\"offset\":0,\"length\":9,\"confidenceScore\":0.38},{\"text\":\"859-98-0987\",\"category\":\"U.S. Social Security Number (SSN)\",\"offset\":28,\"length\":11,\"confidenceScore\":0.65}],\"warnings\":[]},{\"redactedText\":\"Your ABA number - ********* - is the first 9 digits in the lower left hand corner of your personal check.\",\"id\":\"1\",\"statistics\":{\"charactersCount\":105,\"transactionsCount\":1},\"entities\":[{\"text\":\"111000025\",\"category\":\"Phone Number\",\"offset\":18,\"length\":9,\"confidenceScore\":0.8},{\"text\":\"111000025\",\"category\":\"ABA Routing Number\",\"offset\":18,\"length\":9,\"confidenceScore\":0.75},{\"text\":\"111000025\",\"category\":\"New Zealand Social Welfare Number\",\"offset\":18,\"length\":9,\"confidenceScore\":0.65},{\"text\":\"111000025\",\"category\":\"Portugal Tax Identification Number\",\"offset\":18,\"length\":9,\"confidenceScore\":0.65}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-07-01\"}", - "Date" : "Thu, 03 Sep 2020 19:03:50 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForBatchInputStringForDomainFilter.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForBatchInputStringForDomainFilter.json deleted file mode 100644 index d6a86af10902e..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForBatchInputStringForDomainFilter.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/recognition/pii?showStats=false&domain=PHI&stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "7051662f-b272-4857-951f-327fd231943c", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "123", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", - "apim-request-id" : "43ac1d18-4460-4fef-8dbc-9f8b0371e11d", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"documents\":[{\"redactedText\":\"Microsoft employee with ssn *********** is using our awesome API's.\",\"id\":\"0\",\"entities\":[{\"text\":\"859-98-0987\",\"category\":\"U.S. Social Security Number (SSN)\",\"offset\":28,\"length\":11,\"confidenceScore\":0.65}],\"warnings\":[]},{\"redactedText\":\"Your ABA number - ********* - is the first 9 digits in the lower left hand corner of your personal check.\",\"id\":\"1\",\"entities\":[{\"text\":\"111000025\",\"category\":\"Phone Number\",\"offset\":18,\"length\":9,\"confidenceScore\":0.8},{\"text\":\"111000025\",\"category\":\"ABA Routing Number\",\"offset\":18,\"length\":9,\"confidenceScore\":0.75},{\"text\":\"111000025\",\"category\":\"New Zealand Social Welfare Number\",\"offset\":18,\"length\":9,\"confidenceScore\":0.65}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-07-01\"}", - "Date" : "Thu, 03 Sep 2020 22:35:52 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForDomainFilter.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForDomainFilter.json deleted file mode 100644 index 49046bfa7c2e3..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForDomainFilter.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/recognition/pii?showStats=false&domain=PHI&stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "8be63659-d554-4018-87e4-60c9d3d6fcf6", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "100", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "ccca32ce-1053-4ad0-b7ef-adec5308bd68", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"documents\":[{\"redactedText\":\"Microsoft employee with ssn *********** is using our awesome API's.\",\"id\":\"0\",\"entities\":[{\"text\":\"859-98-0987\",\"category\":\"U.S. Social Security Number (SSN)\",\"offset\":28,\"length\":11,\"confidenceScore\":0.65}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-07-01\"}", - "Date" : "Thu, 03 Sep 2020 22:35:58 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForEmptyText.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForEmptyText.json deleted file mode 100644 index 9b9962a7fa601..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForEmptyText.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/recognition/pii?stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "62001a27-af90-46d0-a783-e8e779f60575", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "1", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "apim-request-id" : "ef42e2b5-92d5-4b8f-bee0-72b52845ed8c", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"documents\":[],\"errors\":[{\"id\":\"0\",\"error\":{\"code\":\"InvalidArgument\",\"message\":\"Invalid document in request.\",\"innererror\":{\"code\":\"InvalidDocument\",\"message\":\"Document text is empty.\"}}}],\"modelVersion\":\"2020-07-01\"}", - "Date" : "Thu, 03 Sep 2020 19:04:02 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForFaultyText.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForFaultyText.json deleted file mode 100644 index 52cfdad68935b..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForFaultyText.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/recognition/pii?stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "84d3378d-bfde-4190-98a9-9091710afb26", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "73", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "96473f27-f806-4a0c-9bb6-5f742ed20f19", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"documents\":[{\"redactedText\":\"!@#%%\",\"id\":\"0\",\"entities\":[],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-07-01\"}", - "Date" : "Thu, 03 Sep 2020 19:04:06 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForListLanguageHint.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForListLanguageHint.json deleted file mode 100644 index aec32ad6abfaa..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForListLanguageHint.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/recognition/pii?stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "9bdae4dc-317a-4f11-bdf2-7513da2920f2", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "146", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", - "apim-request-id" : "13c71289-8c39-4cd1-b74a-d18f1ebc7e60", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"documents\":[{\"redactedText\":\"********* employee with ssn *********** is using our awesome API's.\",\"id\":\"0\",\"entities\":[{\"text\":\"Microsoft\",\"category\":\"Organization\",\"offset\":0,\"length\":9,\"confidenceScore\":0.38},{\"text\":\"859-98-0987\",\"category\":\"U.S. Social Security Number (SSN)\",\"offset\":28,\"length\":11,\"confidenceScore\":0.65}],\"warnings\":[]},{\"redactedText\":\"Your ABA number - ********* - is the first 9 digits in the lower left hand corner of your personal check.\",\"id\":\"1\",\"entities\":[{\"text\":\"111000025\",\"category\":\"Phone Number\",\"offset\":18,\"length\":9,\"confidenceScore\":0.8},{\"text\":\"111000025\",\"category\":\"ABA Routing Number\",\"offset\":18,\"length\":9,\"confidenceScore\":0.75},{\"text\":\"111000025\",\"category\":\"New Zealand Social Welfare Number\",\"offset\":18,\"length\":9,\"confidenceScore\":0.65},{\"text\":\"111000025\",\"category\":\"Portugal Tax Identification Number\",\"offset\":18,\"length\":9,\"confidenceScore\":0.65}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-07-01\"}", - "Date" : "Thu, 03 Sep 2020 19:03:55 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForListStringWithOptions.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForListStringWithOptions.json deleted file mode 100644 index 78ed7fc20bef0..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForListStringWithOptions.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/recognition/pii?showStats=true&stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "5cb62422-f5c2-44ad-b6cd-c3c9977a344a", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "153", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", - "apim-request-id" : "012667de-9645-46d3-8647-6dc7b92e73c9", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"statistics\":{\"documentsCount\":2,\"validDocumentsCount\":2,\"erroneousDocumentsCount\":0,\"transactionsCount\":2},\"documents\":[{\"redactedText\":\"********* employee with ssn *********** is using our awesome API's.\",\"id\":\"0\",\"statistics\":{\"charactersCount\":67,\"transactionsCount\":1},\"entities\":[{\"text\":\"Microsoft\",\"category\":\"Organization\",\"offset\":0,\"length\":9,\"confidenceScore\":0.38},{\"text\":\"859-98-0987\",\"category\":\"U.S. Social Security Number (SSN)\",\"offset\":28,\"length\":11,\"confidenceScore\":0.65}],\"warnings\":[]},{\"redactedText\":\"Your ABA number - ********* - is the first 9 digits in the lower left hand corner of your personal check.\",\"id\":\"1\",\"statistics\":{\"charactersCount\":105,\"transactionsCount\":1},\"entities\":[{\"text\":\"111000025\",\"category\":\"Phone Number\",\"offset\":18,\"length\":9,\"confidenceScore\":0.8},{\"text\":\"111000025\",\"category\":\"ABA Routing Number\",\"offset\":18,\"length\":9,\"confidenceScore\":0.75},{\"text\":\"111000025\",\"category\":\"New Zealand Social Welfare Number\",\"offset\":18,\"length\":9,\"confidenceScore\":0.65},{\"text\":\"111000025\",\"category\":\"Portugal Tax Identification Number\",\"offset\":18,\"length\":9,\"confidenceScore\":0.65}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-07-01\"}", - "Date" : "Thu, 03 Sep 2020 19:04:05 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForTextInput.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForTextInput.json deleted file mode 100644 index 93eb90acb36d3..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForTextInput.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/recognition/pii?stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "fc8901b8-3654-4d50-b899-11b86f5fc212", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "113", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "2ab66fd7-cc30-4b1b-b327-be07e6ac221a", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"documents\":[{\"redactedText\":\"********* employee with ssn *********** is using our awesome API's.\",\"id\":\"0\",\"entities\":[{\"text\":\"Microsoft\",\"category\":\"Organization\",\"offset\":0,\"length\":9,\"confidenceScore\":0.4},{\"text\":\"859-98-0987\",\"category\":\"U.S. Social Security Number (SSN)\",\"offset\":28,\"length\":11,\"confidenceScore\":0.65}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-07-01\"}", - "Date" : "Thu, 03 Sep 2020 19:04:05 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesKoreanNfc.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesKoreanNfc.json deleted file mode 100644 index 4d3b6641e26b0..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesKoreanNfc.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/recognition/pii?stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "30d84360-4db4-4e62-98e6-6622cd1a58c9", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "72", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "29fd0303-ad54-4d78-8995-022b0cdea9fd", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"documents\":[{\"redactedText\":\"아가 SSN: ***********\",\"id\":\"0\",\"entities\":[{\"text\":\"859-98-0987\",\"category\":\"U.S. Social Security Number (SSN)\",\"offset\":8,\"length\":11,\"confidenceScore\":0.65}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-07-01\"}", - "Date" : "Thu, 03 Sep 2020 17:50:08 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesKoreanNfd.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesKoreanNfd.json deleted file mode 100644 index a91d552fb09c3..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesKoreanNfd.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/recognition/pii?stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "c8d4b2fc-79a0-4eca-8782-52397a4475a5", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "75", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "4c32111b-2f9e-4515-8b35-911ecb84461e", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"documents\":[{\"redactedText\":\"아가 SSN: ***********\",\"id\":\"0\",\"entities\":[{\"text\":\"859-98-0987\",\"category\":\"U.S. Social Security Number (SSN)\",\"offset\":8,\"length\":11,\"confidenceScore\":0.65}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-07-01\"}", - "Date" : "Thu, 03 Sep 2020 17:50:10 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesZalgoText.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesZalgoText.json deleted file mode 100644 index c6afd58186211..0000000000000 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesZalgoText.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azure-api.net/text/analytics/v3.1-preview.2//entities/recognition/pii?stringIndexType=Utf16CodeUnit", - "Headers" : { - "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)", - "x-ms-client-request-id" : "84a44541-df9b-4081-abd5-53b0585bbede", - "Content-Type" : "application/json" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-envoy-upstream-service-time" : "111", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", - "x-content-type-options" : "nosniff", - "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", - "apim-request-id" : "00a560cd-a062-4250-9adf-a2d8d38c7e02", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"documents\":[{\"redactedText\":\"ơ̵̧̧̢̳̘̘͕͔͕̭̟̙͎͈̞͔̈̇̒̃͋̇̅͛̋͛̎́͑̄̐̂̎͗͝m̵͍͉̗̄̏͌̂̑̽̕͝͠g̵̢̡̢̡̨̡̧̛͉̞̯̠̤̣͕̟̫̫̼̰͓̦͖̣̣͎̋͒̈́̓̒̈̍̌̓̅͑̒̓̅̅͒̿̏́͗̀̇͛̏̀̈́̀̊̾̀̔͜͠͝ͅ SSN: ***********\",\"id\":\"0\",\"entities\":[{\"text\":\"859-98-0987\",\"category\":\"U.S. Social Security Number (SSN)\",\"offset\":121,\"length\":11,\"confidenceScore\":0.65}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-07-01\"}", - "Date" : "Thu, 03 Sep 2020 17:50:03 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/swagger/README.md b/sdk/textanalytics/azure-ai-textanalytics/swagger/README.md index 32de6ebe32ba4..5ff4685eefcfd 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/swagger/README.md +++ b/sdk/textanalytics/azure-ai-textanalytics/swagger/README.md @@ -20,7 +20,7 @@ autorest --java --use=C:/work/autorest.java ### Code generation settings ``` yaml -input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/cognitiveservices/data-plane/TextAnalytics/preview/v3.1-preview.2/TextAnalytics.json +input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/cognitiveservices/data-plane/TextAnalytics/stable/v3.0/TextAnalytics.json java: true output-folder: ..\ generate-client-as-impl: true diff --git a/sdk/textanalytics/ci.yml b/sdk/textanalytics/ci.yml index 987ec365df414..9da932d946265 100644 --- a/sdk/textanalytics/ci.yml +++ b/sdk/textanalytics/ci.yml @@ -1,4 +1,5 @@ -# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. +# DO NOT EDIT THIS FILE +# This file is generated automatically and any changes will be lost. trigger: branches: include: @@ -27,4 +28,4 @@ extends: Artifacts: - name: azure-ai-textanalytics groupId: com.azure - safeName: azureaitextanalytics + safeName: azureaitextanalytics \ No newline at end of file