Skip to content

Commit

Permalink
[TA] Changes based on V3.0 swagger, etc (#10593)
Browse files Browse the repository at this point in the history
* Use V3.0 swagger code base
  • Loading branch information
mssfang authored May 9, 2020
1 parent 3d3e6f0 commit 62005e7
Show file tree
Hide file tree
Showing 171 changed files with 3,952 additions and 2,102 deletions.
1 change: 1 addition & 0 deletions sdk/parents/azure-client-sdk-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1087,6 +1087,7 @@
--add-opens com.azure.core/com.azure.core.implementation.serializer=ALL-UNNAMED
--add-opens com.azure.ai.formrecognizer/com.azure.ai.formrecognizer=ALL-UNNAMED
--add-opens com.azure.ai.textanalytics/com.azure.ai.textanalytics=ALL-UNNAMED
--add-opens com.azure.ai.textanalytics/com.azure.ai.textanalytics.implementation.models=com.azure.core
--add-opens com.azure.data.appconfiguration/com.azure.data.appconfiguration=ALL-UNNAMED
--add-opens com.azure.security.keyvault.certificates/com.azure.security.keyvault.certificates=ALL-UNNAMED
--add-opens com.azure.security.keyvault.secrets/com.azure.security.keyvault.secrets=ALL-UNNAMED
Expand Down
30 changes: 29 additions & 1 deletion sdk/textanalytics/azure-ai-textanalytics/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,36 @@
# Release History

## 1.0.0-beta.5 (Unreleased)
- Rename `apiKey()` to `credential()` on TextAnalyticsClientBuilder.
**New features**
- Added Text property and `getText()` to `SentenceSentiment`.
- `Warnings` property added to each document-level response object returned from the endpoints. It is a list of `TextAnalyticsWarnings`.
- Added `CategorizedEntityCollection`, `KeyPhrasesCollection`, `LinkedEntityCollection` for having `getWarnings()` to retrieve warnings.
- Added a new enum value `ADDRESS` to `EntityCategory`.
- Text analytics SDK update the service to version `v3.0` from `v3.0-preview.1`.

**Breaking changes**
- Renamed `apiKey()` to `credential()` on TextAnalyticsClientBuilder.
- Removed `getGraphemeLength()` and `getGraphemeOffset()` from `CategorizedEntity`, `SentenceSentiment`, and `LinkedEntityMatch`.
- `getGraphemeCount()` in `TextDocumentStatistics` has been renamed to `getCharacterCount()`.
- `getScore()` in `DetectedLanguage` has been renamed to `getConfidenceScore()`.
- `getSubCategory()` in `CategorizedEntity` has been renamed to `getSubcategory()`.
- `getLinkedEntityMatches()` in `LinkedEntity` has been renamed to `getMatches()`.
- `getCode()` in `TextAnalyticsException` and `TextAnalyticsError` has been renamed to `getErrorCode()`.
- `getCode()` in `TextAnalyticsWarning` has been renamed to `getWarningCode()`.
- Async client returns errors, mono error or flux error but no longer throws exception. Sync client throws exceptions only.
- Deprecated `TextDocumentInput(String id, String text, String language)` constructor, but added `setLanguage()` setter since `language` is optional.
- Renamed `RecognizeCategorizedEntitiesResult` to `RecognizeEntitiesResult`.
- Renamed `DocumentResult` to `TextAnalyticsResult`.
- Removed `getServiceVersion()` from both synchronous and asynchronous clients.
- Replaced all single input asynchronous APIs, e.x.,
- `TextAnalyticsPagedFlux<CategorizedEntity> recognizeEntities(String document)` to `Mono<CategorizedEntityCollection> recognizeEntities(String document)`.
- `TextAnalyticsPagedFlux<LinkedEntity> recognizeLinkedEntities(String document)` to `Mono<LinkedEntityCollection> recognizeLinkedEntities(String document)`.
- `TextAnalyticsPagedFlux<String> extractKeyPhrases(String document)` to `Mono<KeyPhrasesCollection> extractKeyPhrases(String document)`.
- Replaced all single input synchronous APIs, e.x.,
- `TextAnalyticsPagedIterable<CategorizedEntity> recognizeEntities(String document)` to `CategorizedEntityCollection recognizeEntities(String document)`.
- `TextAnalyticsPagedIterable<LinkedEntity> recognizeLinkedEntities(String document)` to `LinkedEntityCollection recognizeLinkedEntities(String document)`.
- `TextAnalyticsPagedIterable<String> extractKeyPhrases(String document)` to `KeyPhrasesCollection extractKeyPhrases(String document)`.

## 1.0.0-beta.4 (2020-04-07)
- Throws an illegal argument exception when the given list of documents is an empty list.

Expand Down
38 changes: 19 additions & 19 deletions sdk/textanalytics/azure-ai-textanalytics/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ and includes six main functions:
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-ai-textanalytics</artifactId>
<version>1.0.0-beta.4</version>
<version>1.0.0-beta.5</version>
</dependency>
```
[//]: # ({x-version-update-end})
Expand Down Expand Up @@ -137,18 +137,18 @@ and supported text encoding.

### Return value
An operation result, such as `AnalyzeSentimentResult`, is the result of a Text Analytics operation, containing a
prediction or predictions about a single document. An operation's result type also may optionally include information
about the input document and how it was processed. An operation result contains a `isError` property that allows to
identify if an operation executed was successful or unsuccessful for the given document. When the operation results
an error, you can simply call `getError()` to get `TextAnalyticsError` which contains the reason why it is unsuccessful.
If you are interested in how many characters are in your document, or the number of operation transactions that have gone
through, simply call `getStatistics()` to get the `TextDocumentStatistics` which contains both information.
prediction or predictions about a single document and a list of warnings inside of it. An operation's result type also
may optionally include information about the input document and how it was processed. An operation result contains a
`isError` property that allows to identify if an operation executed was successful or unsuccessful for the given
document. When the operation results an error, you can simply call `getError()` to get `TextAnalyticsError` which
contains the reason why it is unsuccessful. If you are interested in how many characters are in your document,
or the number of operation transactions that have gone through, simply call `getStatistics()` to get the
`TextDocumentStatistics` which contains both information.

### Return value collection
An operation result collection, such as `DocumentResultCollection<AnalyzeSentimentResult>`, which is the collection of
the result of a Text Analytics analyzing sentiment operation. `DocumentResultCollection` includes the model version of
the operation and statistics of the batch documents. Since `DocumentResultCollection<T>` extends `IterableStream<T>`,
the list of item can be retrieved by streaming or iterating the list.
An operation result collection, such as `TextAnalyticsPagedResponse<AnalyzeSentimentResult>`, which is the collection of
the result of a Text Analytics analyzing sentiment operation. For `TextAnalyticsPagedResponse` includes the model
version of the operation and statistics of the batch documents.

### Operation on multiple documents
For each supported operation, the Text Analytics client provides method overloads to take a single document, a batch
Expand Down Expand Up @@ -229,17 +229,17 @@ documentSentiment.getSentences().forEach(sentenceSentiment ->
```java
String document = "Bonjour tout le monde";
DetectedLanguage detectedLanguage = textAnalyticsClient.detectLanguage(document);
System.out.printf("Detected language name: %s, ISO 6391 name: %s, score: %f.%n",
detectedLanguage.getName(), detectedLanguage.getIso6391Name(), detectedLanguage.getScore());
System.out.printf("Detected language name: %s, ISO 6391 name: %s, confidence score: %f.%n",
detectedLanguage.getName(), detectedLanguage.getIso6391Name(), detectedLanguage.getConfidenceScore());
```

### Recognize entity
<!-- embedme ./src/samples/java/com/azure/ai/textanalytics/ReadmeSamples.java#L123-L126 -->
```java
String document = "Satya Nadella is the CEO of Microsoft";
textAnalyticsClient.recognizeEntities(document).forEach(entity ->
System.out.printf("Recognized entity: %s, category: %s, subCategory: %s, score: %f.%n",
entity.getText(), entity.getCategory(), entity.getSubCategory(), entity.getConfidenceScore()));
System.out.printf("Recognized entity: %s, category: %s, subcategory: %s, confidence score: %f.%n",
entity.getText(), entity.getCategory(), entity.getSubcategory(), entity.getConfidenceScore()));
```

### Recognize linked entity
Expand All @@ -251,8 +251,8 @@ textAnalyticsClient.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.%n",
linkedEntity.getName(), linkedEntity.getDataSourceEntityId(), linkedEntity.getUrl(), linkedEntity.getDataSource());
linkedEntity.getLinkedEntityMatches().forEach(linkedEntityMatch ->
System.out.printf("Text: %s, score: %f.%n", linkedEntityMatch.getText(), linkedEntityMatch.getConfidenceScore()));
linkedEntity.getMatches().forEach(match ->
System.out.printf("Text: %s, confidence score: %f.%n", match.getText(), match.getConfidenceScore()));
});
```
### Extract key phrases
Expand Down Expand Up @@ -314,13 +314,12 @@ When you submit a pull request, a CLA-bot will automatically determine whether y
This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For more information see the [Code of Conduct FAQ][coc_faq] or contact [[email protected]][coc_contact] with any additional questions or comments.

<!-- LINKS -->
[azure_key_credential]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/core/azure-core/src/main/java/com/azure/core/credential/AzureKeyCredential.java
[aad_credential]: https://docs.microsoft.com/azure/cognitive-services/authentication#authenticate-with-azure-active-directory
[key]: https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account?tabs=multiservice%2Cwindows#get-the-keys-for-your-resource
[api_reference_doc]: https://aka.ms/azsdk-java-textanalytics-ref-docs
[authentication]: https://docs.microsoft.com/azure/cognitive-services/authentication
[azure_cli]: https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account-cli?tabs=windows
[azure_identity]: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/identity/azure-identity#credentials
[azure_key_credential]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/core/azure-core/src/main/java/com/azure/core/credential/AzureKeyCredential.java
[azure_portal]: https://ms.portal.azure.com
[azure_subscription]: https://azure.microsoft.com/free
[cla]: https://cla.microsoft.com
Expand All @@ -333,6 +332,7 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m
[default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/identity/azure-identity#defaultazurecredential
[grant_access]: https://docs.microsoft.com/azure/cognitive-services/authentication#assign-a-role-to-a-service-principal
[install_azure_identity]: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/identity/azure-identity#install-the-package
[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
[language_regional_support]: https://docs.microsoft.com/azure/cognitive-services/text-analytics/language-support
Expand Down
Loading

0 comments on commit 62005e7

Please sign in to comment.