From 96c32309939c80c8570e5fcfd635b8cb2e386e8c Mon Sep 17 00:00:00 2001 From: Sameeksha Vaity Date: Thu, 28 May 2020 16:00:44 -0700 Subject: [PATCH 1/3] renaming changes --- .../azure-ai-formrecognizer/CHANGELOG.md | 9 ++- .../azure-ai-formrecognizer/README.md | 72 +++++++++---------- .../models/CustomFormModel.java | 48 ++++++------- .../models/CustomFormModelInfo.java | 36 +++++----- ...mSubModel.java => CustomFormSubmodel.java} | 8 +-- ...elOptions.java => TrainingFileFilter.java} | 14 ++-- .../training/CustomModelTransforms.java | 8 +-- .../training/FormTrainingAsyncClient.java | 18 ++--- .../training/FormTrainingClient.java | 22 +++--- ...rainingAsyncClientJavaDocCodeSnippets.java | 42 +++++------ ...FormTrainingClientJavaDocCodeSnippets.java | 56 +++++++-------- .../ai/formrecognizer/ManageCustomModels.java | 16 ++--- .../ManageCustomModelsAsync.java | 16 ++--- .../ai/formrecognizer/ReadmeSamples.java | 24 +++---- .../formrecognizer/TrainModelWithLabels.java | 10 +-- .../TrainModelWithLabelsAsync.java | 10 +-- .../TrainModelWithoutLabels.java | 8 +-- .../TrainModelWithoutLabelsAsync.java | 8 +-- .../FormTrainingAsyncClientTest.java | 8 +-- .../FormTrainingClientTest.java | 16 ++--- .../FormTrainingClientTestBase.java | 12 ++-- 21 files changed, 231 insertions(+), 230 deletions(-) rename sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/{CustomFormSubModel.java => CustomFormSubmodel.java} (89%) rename sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/{TrainModelOptions.java => TrainingFileFilter.java} (83%) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/CHANGELOG.md b/sdk/formrecognizer/azure-ai-formrecognizer/CHANGELOG.md index 84a485a66671..2090ebf05b5e 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/CHANGELOG.md +++ b/sdk/formrecognizer/azure-ai-formrecognizer/CHANGELOG.md @@ -1,8 +1,11 @@ # Release History ## 1.0.0-beta.3 (Unreleased) -- Add `pageNumber` property to `FormPage` and `FormTable` model -- Remove `pageNumber` property from `FormField` model +- Rename `getCustomModelInfos` to `listCustomModels` +- Rename property `lastUpdatedOn` to `completedOn` and `createdOn` to `requestedOn` in `CustomFormModel` and +`CustomFormModelInfo` model +- Rename model `CustomFormSubModel` to `CustomFormSubmodel` +- Rename `subModels` property on CustomFormModel to `submodels` - Update FormRecognizer API calls to return a `List` instead of `IterableStream`. - Fix bug in FormRecognizer API's to support multipage document recognition. - Add `getFormRecognizerClient()` and `getFormRecognizerAsyncClient()` in FormTrainingClient and FormTrainingAsyncClient @@ -10,7 +13,7 @@ - Adopt the `training` namespace for Form Recognizer Training Clients - Rename parameter `fileSourceUrl` to `trainingFilesUrl` on `beginTraining` method in FormTrainingClients - Rename parameter `useLabelFile` to `useTrainingLabels` on `beginTraining` method in FormTrainingClients -- Replace parameters `filePrefix` and `includeSubFolders` with `TrainModelOptions` model +- Replace parameters `filePrefix` and `includeSubFolders` with `TrainingFileFilter` model - Rename AccountProperties `count` and `limit` to `customModelCount` and `customModelLimit` ## 1.0.0-beta.2 (2020-05-06) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/README.md b/sdk/formrecognizer/azure-ai-formrecognizer/README.md index 36d50d8cb16f..83e8f0e5a372 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/README.md +++ b/sdk/formrecognizer/azure-ai-formrecognizer/README.md @@ -29,13 +29,13 @@ from form documents. It includes the following main functionalities: [//]: # ({x-version-update-end}) ### Create a Form Recognizer resource -Form Recognizer supports both [multi-service and single-service access][service_access]. Create a Cognitive Service's +Form Recognizer supports both [multi-service and single-service access][service_access]. Create a Cognitive Service's resource if you plan to access multiple cognitive services under a single endpoint/key. For Form Recognizer access only, create a Form Recognizer resource. -You can create either resource using the +You can create either resource using the -**Option 1:** [Azure Portal][create_new_resource] +**Option 1:** [Azure Portal][create_new_resource] **Option 2:** [Azure CLI][azure_cli] @@ -58,8 +58,8 @@ az cognitiveservices account create \ --yes ``` ### Authenticate the client -In order to interact with the Form Recognizer service, you will need to create an instance of the `FormRecognizerClient` -class. You will need an **endpoint** and an **key** to instantiate a client object, +In order to interact with the Form Recognizer service, you will need to create an instance of the `FormRecognizerClient` +class. You will need an **endpoint** and an **key** to instantiate a client object, they can be found in the [Azure Portal][azure_portal] under the "Quickstart" in your created Form Recognizer resource. See the full details regarding [authentication][authentication] of Cognitive Services. @@ -67,12 +67,12 @@ Form Recognizer resource. See the full details regarding [authentication][authen The `credential` parameter may be provided as a [`AzureKeyCredential`][azure_key_credential] from [azure-core][azure_core]. ##### Create FormRecognizerClient with AzureKeyCredential -To use AzureKeyCredential authentication, provide the [key][key] as a string to the [AzureKeyCredential][azure_key_credential]. This can be found in the [Azure Portal][azure_portal] +To use AzureKeyCredential authentication, provide the [key][key] as a string to the [AzureKeyCredential][azure_key_credential]. This can be found in the [Azure Portal][azure_portal] under the "Quickstart" section or by running the following Azure CLI command: ```bash az cognitiveservices account keys list --resource-group --name -``` +``` Use the API key as the credential parameter to authenticate the client: ```java @@ -97,22 +97,22 @@ credential.update("{new_key}"); ## Key concepts ### FormRecognizerClient The [FormRecognizerClient][form_recognizer_sync_client] and [FormRecognizerAsyncClient][form_recognizer_async_client] -provide both synchronous and asynchronous operations - - Recognizing form fields and content using custom models trained to recognize your custom forms. +provide both synchronous and asynchronous operations + - Recognizing form fields and content using custom models trained to recognize your custom forms. These values are returned in a collection of `RecognizedForm` objects. - - Recognizing form content, including tables, lines and words, without the need to train a model. + - Recognizing form content, including tables, lines and words, without the need to train a model. Form content is returned in a collection of `FormPage` objects. - - Recognizing common fields from US receipts, using a pre-trained receipt model on the Form Recognizer service. + - Recognizing common fields from US receipts, using a pre-trained receipt model on the Form Recognizer service. These fields and meta-data are returned in a collection of `USReceipt` objects. - + ### FormTrainingClient -The [FormTrainingClient][form_training_sync_client] and -[FormTrainingAsyncClient][form_training_async_client] provide both synchronous and asynchronous operations +The [FormTrainingClient][form_training_sync_client] and +[FormTrainingAsyncClient][form_training_async_client] provide both synchronous and asynchronous operations - Training custom models to recognize all fields and values found in your custom forms. A `CustomFormModel` is returned indicating the form types the model will recognize, and the fields it will extract for each form type. See the [service's documents][fr_train_without_labels] for a more detailed explanation. -- Training custom models to recognize specific fields and values you specify by labeling your custom forms. -A `CustomFormModel` is returned indicating the fields the model will extract, as well as the estimated accuracy for +- Training custom models to recognize specific fields and values you specify by labeling your custom forms. +A `CustomFormModel` is returned indicating the fields the model will extract, as well as the estimated accuracy for each field. See the [service's documents][fr_train_with_labels] for a more detailed explanation. - Managing models created in your account. @@ -124,7 +124,7 @@ followed by polling the service at intervals to determine whether the operation succeeded, to get the result. Methods that train models or recognize values from forms are modeled as long-running operations. The client exposes -a `begin` method that returns a `SyncPoller` or `PollerFlux` instance. +a `begin` method that returns a `SyncPoller` or `PollerFlux` instance. Callers should wait for the operation to completed by calling `getFinalResult()` on the returned operation from the `begin` method. Sample code snippets are provided to illustrate using long-running operations [below](#Examples). @@ -216,7 +216,7 @@ for (int i = 0; i < receiptPageResults.size(); i++) { System.out.printf("Total: %s%n", usReceipt.getTotal().getName()); System.out.printf("Total Value: %s%n", usReceipt.getTotal().getFieldValue()); } -``` +``` ### Train a model Train a machine-learned model on your own form type. The resulting model will be able to recognize values from the types of forms it was trained on. @@ -233,15 +233,15 @@ CustomFormModel customFormModel = trainingPoller.getFinalResult(); // Model Info System.out.printf("Model Id: %s%n", customFormModel.getModelId()); System.out.printf("Model Status: %s%n", customFormModel.getModelStatus()); -System.out.printf("Model created on: %s%n", customFormModel.getCreatedOn()); -System.out.printf("Model last updated: %s%n%n", customFormModel.getLastUpdatedOn()); +System.out.printf("Model requested on: %s%n", customFormModel.getRequestedOn()); +System.out.printf("Model training completed on: %s%n%n", customFormModel.getCompletedOn()); System.out.println("Recognized Fields:"); // looping through the sub-models, which contains the fields they were trained on // Since the given training documents are unlabeled, we still group them but they do not have a label. -customFormModel.getSubModels().forEach(customFormSubModel -> { +customFormModel.getSubmodels().forEach(customFormSubmodel -> { // Since the training data is unlabeled, we are unable to return the accuracy of this model - customFormSubModel.getFieldMap().forEach((field, customFormModelField) -> + customFormSubmodel.getFieldMap().forEach((field, customFormModelField) -> System.out.printf("Field: %s Field Label: %s%n", field, customFormModelField.getLabel())); }); @@ -258,7 +258,7 @@ System.out.printf("The account has %s custom models, and we can have at most %s accountProperties.getCustomModelCount(), accountProperties.getCustomModelLimit()); // Next, we get a paged list of all of our custom models -PagedIterable customModels = formTrainingClient.getModelInfos(); +PagedIterable customModels = formTrainingClient.listCustomModels(); System.out.println("We have following models in the account:"); customModels.forEach(customFormModelInfo -> { System.out.printf("Model Id: %s%n", customFormModelInfo.getModelId()); @@ -266,13 +266,13 @@ customModels.forEach(customFormModelInfo -> { modelId.set(customFormModelInfo.getModelId()); CustomFormModel customModel = formTrainingClient.getCustomModel(customFormModelInfo.getModelId()); System.out.printf("Model Status: %s%n", customModel.getModelStatus()); - System.out.printf("Created on: %s%n", customModel.getCreatedOn()); - System.out.printf("Updated on: %s%n", customModel.getLastUpdatedOn()); - customModel.getSubModels().forEach(customFormSubModel -> { - System.out.printf("Custom Model Form type: %s%n", customFormSubModel.getFormType()); - System.out.printf("Custom Model Accuracy: %d%n", customFormSubModel.getAccuracy()); - if (customFormSubModel.getFieldMap() != null) { - customFormSubModel.getFieldMap().forEach((fieldText, customFormModelField) -> { + System.out.printf("Created on: %s%n", customModel.getRequestedOn()); + System.out.printf("Updated on: %s%n", customModel.getCompletedOn()); + customModel.getSubmodels().forEach(customFormSubmodel -> { + System.out.printf("Custom Model Form type: %s%n", customFormSubmodel.getFormType()); + System.out.printf("Custom Model Accuracy: %d%n", customFormSubmodel.getAccuracy()); + if (customFormSubmodel.getFieldMap() != null) { + customFormSubmodel.getFieldMap().forEach((fieldText, customFormModelField) -> { System.out.printf("Field Text: %s%n", fieldText); System.out.printf("Field Accuracy: %d%n", customFormModelField.getAccuracy()); }); @@ -286,9 +286,9 @@ For more detailed examples, refer to [samples][sample_readme]. ## Troubleshooting ### General -Form Recognizer clients raises `ErrorResponseException` [exceptions][error_response_exception]. For example, if you try +Form Recognizer clients raises `ErrorResponseException` [exceptions][error_response_exception]. For example, if you try to provide an invalid file source URL an `ErrorResponseException` would be raised with an error indicating the failure cause. -In the following code snippet, the error is handled +In the following code snippet, the error is handled gracefully by catching the exception and display the additional information about the error. @@ -301,12 +301,12 @@ try { ``` ### Enable client logging -Azure SDKs for Java offer a consistent logging story to help aid in troubleshooting application errors and expedite -their resolution. The logs produced will capture the flow of an application before reaching the terminal state to help +Azure SDKs for Java offer a consistent logging story to help aid in troubleshooting application errors and expedite +their resolution. The logs produced will capture the flow of an application before reaching the terminal state to help locate the root issue. View the [logging][logging] wiki for guidance about enabling logging. ### Default HTTP Client -All client libraries by default use the Netty HTTP client. Adding the above dependency will automatically configure +All client libraries by default use the Netty HTTP client. Adding the above dependency will automatically configure the client library to use the Netty HTTP client. Configuring or changing the HTTP client is detailed in the [HTTP clients wiki][http_clients_wiki]. @@ -347,7 +347,7 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m [azure_identity]: https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/identity/azure-identity#credentials [azure_portal]: https://ms.portal.azure.com [azure_subscription]: https://azure.microsoft.com/free -[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_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 [cla]: https://cla.microsoft.com [coc]: https://opensource.microsoft.com/codeofconduct/ [coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/CustomFormModel.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/CustomFormModel.java index e815e253cfa9..a150968772c3 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/CustomFormModel.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/CustomFormModel.java @@ -31,19 +31,19 @@ public final class CustomFormModel { private final CustomFormModelStatus modelStatus; /* - * Date and time (UTC) when the model was created. + * Date and time (UTC) when the training model was requested. */ - private final OffsetDateTime createdOn; + private final OffsetDateTime requestedOn; /* - * Date and time (UTC) when the status was last updated. + * Date and time (UTC) when the model training was completed. */ - private final OffsetDateTime lastUpdatedOn; + private final OffsetDateTime completedOn; /* * List of sub models. */ - private final IterableStream subModels; + private final IterableStream submodels; /* * List of the documents used to train the model. @@ -55,21 +55,21 @@ public final class CustomFormModel { * * @param modelId Model identifier. * @param modelStatus Status of the model. - * @param createdOn Date and time (UTC) when the model was created. - * @param lastUpdatedOn Date and time (UTC) when the status was last updated. - * @param subModels List of sub models. + * @param requestedOn Date and time (UTC) when the training model was requested. + * @param completedOn Date and time (UTC) when the model training was completed. + * @param submodels List of sub models. * @param modelError List of errors returned during the training operation. * @param trainingDocuments List of the documents used to train the model. */ public CustomFormModel(final String modelId, final CustomFormModelStatus modelStatus, - final OffsetDateTime createdOn, final OffsetDateTime lastUpdatedOn, - final IterableStream subModels, final List modelError, + final OffsetDateTime requestedOn, final OffsetDateTime completedOn, + final IterableStream submodels, final List modelError, final List trainingDocuments) { this.modelId = modelId; this.modelStatus = modelStatus; - this.createdOn = createdOn; - this.lastUpdatedOn = lastUpdatedOn; - this.subModels = subModels; + this.requestedOn = requestedOn; + this.completedOn = completedOn; + this.submodels = submodels; this.modelError = modelError; this.trainingDocuments = trainingDocuments; } @@ -93,23 +93,21 @@ public CustomFormModelStatus getModelStatus() { } /** - * Get the Date and time (UTC) when the model was - * created. + * Get the Date and time (UTC) when the training model was requested. * - * @return the createdDateTime value. + * @return the requestedOn value. */ - public OffsetDateTime getCreatedOn() { - return this.createdOn; + public OffsetDateTime getRequestedOn() { + return this.requestedOn; } /** - * Get the Date and time (UTC) when the - * status was last updated. + * Get the Date and time (UTC) when the model training was completed. * - * @return the lastUpdatedDateTime value. + * @return the completedOn value. */ - public OffsetDateTime getLastUpdatedOn() { - return this.lastUpdatedOn; + public OffsetDateTime getCompletedOn() { + return this.completedOn; } /** @@ -126,8 +124,8 @@ public List getModelError() { * * @return the sub models value. */ - public IterableStream getSubModels() { - return this.subModels; + public IterableStream getSubmodels() { + return this.submodels; } /** diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/CustomFormModelInfo.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/CustomFormModelInfo.java index 837f9a8d31d3..38a49ffb3dfd 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/CustomFormModelInfo.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/CustomFormModelInfo.java @@ -24,29 +24,29 @@ public final class CustomFormModelInfo { private final CustomFormModelStatus status; /* - * Date and time (UTC) when the model was created. + * Date and time (UTC) when the training model was requested. */ - private final OffsetDateTime createdOn; + private final OffsetDateTime requestedOn; /* - * Date and time (UTC) when the status was last updated. + * Date and time (UTC) when the model training was completed. */ - private final OffsetDateTime lastUpdatedOn; + private final OffsetDateTime completedOn; /** * Constructs a {@link CustomFormModelInfo} box object. * * @param modelId The model identifier. * @param status The status of the model. - * @param createdOn The date and time (UTC) when the model was created. - * @param lastUpdatedOn The date and time (UTC) when the status was last updated. + * @param requestedOn Date and time (UTC) when the training model was requested. + * @param completedOn Date and time (UTC) when the model training was completed. */ - public CustomFormModelInfo(final String modelId, final CustomFormModelStatus status, final OffsetDateTime createdOn, - final OffsetDateTime lastUpdatedOn) { + public CustomFormModelInfo(final String modelId, final CustomFormModelStatus status, + final OffsetDateTime requestedOn, final OffsetDateTime completedOn) { this.modelId = modelId; this.status = status; - this.createdOn = createdOn; - this.lastUpdatedOn = lastUpdatedOn; + this.requestedOn = requestedOn; + this.completedOn = completedOn; } /** @@ -68,21 +68,21 @@ public CustomFormModelStatus getStatus() { } /** - * Get the date and time (UTC) when the model was created. + * Get the date and time (UTC) when the training was requested. * - * @return the createdDateTime value. + * @return the requestedOn value. */ - public OffsetDateTime getCreatedOn() { - return this.createdOn; + public OffsetDateTime getRequestedOn() { + return this.requestedOn; } /** - * Get the date and time (UTC) when the status was last updated. + * Get the date and time (UTC) when the model training was completed. * - * @return the lastUpdatedDateTime value. + * @return the completedOn value. */ - public OffsetDateTime getLastUpdatedOn() { - return this.lastUpdatedOn; + public OffsetDateTime getCompletedOn() { + return this.completedOn; } } diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/CustomFormSubModel.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/CustomFormSubmodel.java similarity index 89% rename from sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/CustomFormSubModel.java rename to sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/CustomFormSubmodel.java index 6b59febe2371..edfd6f0aa753 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/CustomFormSubModel.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/CustomFormSubmodel.java @@ -8,10 +8,10 @@ import java.util.Map; /** - * The CustomFormSubModel model. + * The CustomFormSubmodel model. */ @Immutable -public final class CustomFormSubModel { +public final class CustomFormSubmodel { /* * Estimated extraction accuracy for this model. @@ -29,13 +29,13 @@ public final class CustomFormSubModel { private final String formType; /** - * Constructs a CustomFormSubModel object. + * Constructs a CustomFormSubmodel object. * * @param accuracy The estimated extraction accuracy for this model. * @param fieldMap The Map of fields used to train the model. * @param formType The recognized form type. */ - public CustomFormSubModel(final Float accuracy, final Map fieldMap, + public CustomFormSubmodel(final Float accuracy, final Map fieldMap, final String formType) { this.accuracy = accuracy; this.fieldMap = fieldMap; diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/TrainModelOptions.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/TrainingFileFilter.java similarity index 83% rename from sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/TrainModelOptions.java rename to sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/TrainingFileFilter.java index 2cf2d9ec8f43..8d72c63d5e32 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/TrainModelOptions.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/TrainingFileFilter.java @@ -6,11 +6,11 @@ import com.azure.core.annotation.Fluent; /** - * The TrainModelOptions model. + * The TrainingFileFilter model. */ @Fluent -public final class TrainModelOptions { - +public final class TrainingFileFilter { + /* * A case-sensitive prefix string to filter documents in the source path * for training. @@ -37,9 +37,9 @@ public String getPrefix() { * Set the case-sensitive prefix string to filter documents in the source path for training. * * @param prefix the prefix value to set. - * @return the TrainModelOptions object itself. + * @return the TrainingFileFilter object itself. */ - public TrainModelOptions setPrefix(String prefix) { + public TrainingFileFilter setPrefix(String prefix) { this.prefix = prefix; return this; } @@ -59,9 +59,9 @@ public Boolean isIncludeSubFolders() { * searching for content to be preprocessed. * * @param includeSubFolders the includeSubFolders value to set. - * @return the TrainModelOptions object itself. + * @return the TrainingFileFilter object itself. */ - public TrainModelOptions setIncludeSubFolders(boolean includeSubFolders) { + public TrainingFileFilter setIncludeSubFolders(boolean includeSubFolders) { this.includeSubFolders = includeSubFolders; return this; } diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/training/CustomModelTransforms.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/training/CustomModelTransforms.java index 98e4d9012974..c77cb3d36291 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/training/CustomModelTransforms.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/training/CustomModelTransforms.java @@ -10,7 +10,7 @@ import com.azure.ai.formrecognizer.models.CustomFormModelField; import com.azure.ai.formrecognizer.models.CustomFormModelInfo; import com.azure.ai.formrecognizer.models.CustomFormModelStatus; -import com.azure.ai.formrecognizer.models.CustomFormSubModel; +import com.azure.ai.formrecognizer.models.CustomFormSubmodel; import com.azure.ai.formrecognizer.models.ErrorInformation; import com.azure.ai.formrecognizer.models.FormRecognizerError; import com.azure.ai.formrecognizer.models.TrainingDocumentInfo; @@ -69,7 +69,7 @@ static CustomFormModel toCustomFormModel(Model modelResponse) { modelErrors = transformTrainingErrors(modelResponse.getTrainResult().getErrors()); } - List subModelList = new ArrayList<>(); + List subModelList = new ArrayList<>(); String formType = "form-"; // unlabeled model if (modelResponse.getKeys() != null) { @@ -79,7 +79,7 @@ static CustomFormModel toCustomFormModel(Model modelResponse) { String fieldName = "field-" + index; fieldMap.put(fieldName, new CustomFormModelField(eachField, fieldName, null)); }); - subModelList.add(new CustomFormSubModel( + subModelList.add(new CustomFormSubmodel( null, fieldMap, formType + clusterKey)); @@ -91,7 +91,7 @@ static CustomFormModel toCustomFormModel(Model modelResponse) { .forEach(formFieldsReport -> fieldMap.put(formFieldsReport.getFieldName(), new CustomFormModelField(null, formFieldsReport.getFieldName(), formFieldsReport.getAccuracy()))); - subModelList.add(new CustomFormSubModel( + subModelList.add(new CustomFormSubmodel( modelResponse.getTrainResult().getAverageModelAccuracy(), fieldMap, formType + modelInfo.getModelId())); diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/training/FormTrainingAsyncClient.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/training/FormTrainingAsyncClient.java index af18cce317d1..131558e26e15 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/training/FormTrainingAsyncClient.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/training/FormTrainingAsyncClient.java @@ -14,7 +14,7 @@ import com.azure.ai.formrecognizer.models.CustomFormModel; import com.azure.ai.formrecognizer.models.CustomFormModelInfo; import com.azure.ai.formrecognizer.models.OperationResult; -import com.azure.ai.formrecognizer.models.TrainModelOptions; +import com.azure.ai.formrecognizer.models.TrainingFileFilter; import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceClient; import com.azure.core.annotation.ServiceMethod; @@ -149,12 +149,12 @@ public PollerFlux beginTraining(String trainin * error message indicating absence of cancellation support.

* *

Code sample

- * {@codesnippet com.azure.ai.formrecognizer.training.FormTrainingAsyncClient.beginTraining#string-boolean-trainModelOptions-Duration} + * {@codesnippet com.azure.ai.formrecognizer.training.FormTrainingAsyncClient.beginTraining#string-boolean-trainingFileFilter-Duration} * * @param trainingFilesUrl an externally accessible Azure storage blob container Uri (preferably a * Shared Access Signature Uri). * @param useTrainingLabels Boolean to specify the use of labeled files for training the model. - * @param trainModelOptions Filter to apply to the documents in the source path for training. + * @param trainingFileFilter Filter to apply to the documents in the source path for training. * @param pollInterval Duration between each poll for the operation status. If none is specified, a default of * 5 seconds is used. * @@ -163,13 +163,13 @@ public PollerFlux beginTraining(String trainin */ @ServiceMethod(returns = ReturnType.SINGLE) public PollerFlux beginTraining(String trainingFilesUrl, - boolean useTrainingLabels, TrainModelOptions trainModelOptions, Duration pollInterval) { + boolean useTrainingLabels, TrainingFileFilter trainingFileFilter, Duration pollInterval) { final Duration interval = pollInterval != null ? pollInterval : DEFAULT_DURATION; return new PollerFlux( interval, getTrainingActivationOperation(trainingFilesUrl, - trainModelOptions != null ? trainModelOptions.isIncludeSubFolders() : false, - trainModelOptions != null ? trainModelOptions.getPrefix() : null, + trainingFileFilter != null ? trainingFileFilter.isIncludeSubFolders() : false, + trainingFileFilter != null ? trainingFileFilter.getPrefix() : null, useTrainingLabels), createTrainingPollOperation(), (activationResponse, context) -> Mono.error(new RuntimeException("Cancellation is not supported")), @@ -298,12 +298,12 @@ Mono> deleteModelWithResponse(String modelId, Context context) { * List information for all models. * *

Code sample

- * {@codesnippet com.azure.ai.formrecognizer.training.FormTrainingAsyncClient.getModelInfos} + * {@codesnippet com.azure.ai.formrecognizer.training.FormTrainingAsyncClient.listCustomModels} * * @return {@link PagedFlux} of {@link CustomFormModelInfo}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux getModelInfos() { + public PagedFlux listCustomModels() { try { return new PagedFlux<>(() -> withContext(context -> listFirstPageModelInfo(context)), continuationToken -> withContext(context -> listNextPageModelInfo(continuationToken, context))); @@ -319,7 +319,7 @@ public PagedFlux getModelInfos() { * * @return {@link PagedFlux} of {@link CustomFormModelInfo}. */ - PagedFlux getModelInfos(Context context) { + PagedFlux listCustomModels(Context context) { return new PagedFlux<>(() -> listFirstPageModelInfo(context), continuationToken -> listNextPageModelInfo(continuationToken, context)); } diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/training/FormTrainingClient.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/training/FormTrainingClient.java index 1be16610c951..b1c02559c223 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/training/FormTrainingClient.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/training/FormTrainingClient.java @@ -9,7 +9,7 @@ import com.azure.ai.formrecognizer.models.CustomFormModel; import com.azure.ai.formrecognizer.models.CustomFormModelInfo; import com.azure.ai.formrecognizer.models.OperationResult; -import com.azure.ai.formrecognizer.models.TrainModelOptions; +import com.azure.ai.formrecognizer.models.TrainingFileFilter; import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceClient; import com.azure.core.annotation.ServiceMethod; @@ -92,12 +92,12 @@ public SyncPoller beginTraining(String trainin * error message indicating absence of cancellation support.

* *

Code sample

- * {@codesnippet com.azure.ai.formrecognizer.training.FormTrainingClient.beginTraining#string-boolean-trainModelOptions-Duration} + * {@codesnippet com.azure.ai.formrecognizer.training.FormTrainingClient.beginTraining#string-boolean-trainingFileFilter-Duration} * * @param trainingFilesUrl an externally accessible Azure storage blob container Uri (preferably a * Shared Access Signature Uri). * @param useTrainingLabels Boolean to specify the use of labeled files for training the model. - * @param trainModelOptions Filter to apply to the documents in the source path for training. + * @param trainingFileFilter Filter to apply to the documents in the source path for training. * @param pollInterval Duration between each poll for the operation status. If none is specified, a default of * 5 seconds is used. * @@ -106,8 +106,8 @@ public SyncPoller beginTraining(String trainin */ @ServiceMethod(returns = ReturnType.SINGLE) public SyncPoller beginTraining(String trainingFilesUrl, - boolean useTrainingLabels, TrainModelOptions trainModelOptions, Duration pollInterval) { - return client.beginTraining(trainingFilesUrl, useTrainingLabels, trainModelOptions, pollInterval) + boolean useTrainingLabels, TrainingFileFilter trainingFileFilter, Duration pollInterval) { + return client.beginTraining(trainingFilesUrl, useTrainingLabels, trainingFileFilter, pollInterval) .getSyncPoller(); } @@ -203,27 +203,27 @@ public Response deleteModelWithResponse(String modelId, Context context) { * List information for all models. * *

Code sample

- * {@codesnippet com.azure.ai.formrecognizer.training.FormTrainingClient.getModelInfos} + * {@codesnippet com.azure.ai.formrecognizer.training.FormTrainingClient.listCustomModels} * * @return {@link PagedIterable} of {@link CustomFormModelInfo} custom form model information. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable getModelInfos() { - return new PagedIterable<>(client.getModelInfos(Context.NONE)); + public PagedIterable listCustomModels() { + return new PagedIterable<>(client.listCustomModels(Context.NONE)); } /** * List information for all models with taking {@link Context}. * *

Code sample

- * {@codesnippet com.azure.ai.formrecognizer.training.FormTrainingClient.getModelInfos#Context} + * {@codesnippet com.azure.ai.formrecognizer.training.FormTrainingClient.listCustomModels#Context} * * @param context Additional context that is passed through the Http pipeline during the service call. * * @return {@link PagedIterable} of {@link CustomFormModelInfo} custom form model information. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable getModelInfos(Context context) { - return new PagedIterable<>(client.getModelInfos(context)); + public PagedIterable listCustomModels(Context context) { + return new PagedIterable<>(client.listCustomModels(context)); } } diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/FormTrainingAsyncClientJavaDocCodeSnippets.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/FormTrainingAsyncClientJavaDocCodeSnippets.java index 415da614ccff..475be364040c 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/FormTrainingAsyncClientJavaDocCodeSnippets.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/FormTrainingAsyncClientJavaDocCodeSnippets.java @@ -5,7 +5,7 @@ import com.azure.ai.formrecognizer.models.AccountProperties; import com.azure.ai.formrecognizer.models.CustomFormModel; -import com.azure.ai.formrecognizer.models.TrainModelOptions; +import com.azure.ai.formrecognizer.models.TrainingFileFilter; import com.azure.ai.formrecognizer.training.FormTrainingAsyncClient; import com.azure.ai.formrecognizer.training.FormTrainingClientBuilder; import com.azure.core.credential.AzureKeyCredential; @@ -59,8 +59,8 @@ public void beginTraining() { recognizePollingOperation.getFinalResult().subscribe(customFormModel -> { System.out.printf("Model Id: %s%n", customFormModel.getModelId()); System.out.printf("Model Status: %s%n", customFormModel.getModelStatus()); - customFormModel.getSubModels().forEach(customFormSubModel -> - customFormSubModel.getFieldMap().forEach((key, customFormModelField) -> + customFormModel.getSubmodels().forEach(customFormSubmodel -> + customFormSubmodel.getFieldMap().forEach((key, customFormModelField) -> System.out.printf("Form type: %s Field Text: %s Field Accuracy: %s%n", key, customFormModelField.getName(), customFormModelField.getAccuracy()))); }); @@ -69,27 +69,27 @@ public void beginTraining() { } /** - * Code snippet for {@link FormTrainingAsyncClient#beginTraining(String, boolean, TrainModelOptions, Duration)} + * Code snippet for {@link FormTrainingAsyncClient#beginTraining(String, boolean, TrainingFileFilter, Duration)} * with options */ public void beginTrainingWithOptions() { - // BEGIN: com.azure.ai.formrecognizer.training.FormTrainingAsyncClient.beginTraining#string-boolean-trainModelOptions-Duration + // BEGIN: com.azure.ai.formrecognizer.training.FormTrainingAsyncClient.beginTraining#string-boolean-trainingFileFilter-Duration String trainingFilesUrl = "{training-set-SAS-URL}"; - TrainModelOptions trainModelOptions = new TrainModelOptions().setIncludeSubFolders(false).setPrefix("Invoice"); + TrainingFileFilter trainingFileFilter = new TrainingFileFilter().setIncludeSubFolders(false).setPrefix("Invoice"); - formTrainingAsyncClient.beginTraining(trainingFilesUrl, true, trainModelOptions, + formTrainingAsyncClient.beginTraining(trainingFilesUrl, true, trainingFileFilter, Duration.ofSeconds(5)).subscribe(recognizePollingOperation -> { // if training polling operation completed, retrieve the final result. recognizePollingOperation.getFinalResult().subscribe(customFormModel -> { System.out.printf("Model Id: %s%n", customFormModel.getModelId()); System.out.printf("Model Status: %s%n", customFormModel.getModelStatus()); - customFormModel.getSubModels().forEach(customFormSubModel -> - customFormSubModel.getFieldMap().forEach((key, customFormModelField) -> + customFormModel.getSubmodels().forEach(customFormSubmodel -> + customFormSubmodel.getFieldMap().forEach((key, customFormModelField) -> System.out.printf("Form Type: %s Field Text: %s Field Accuracy: %s%n", key, customFormModelField.getName(), customFormModelField.getAccuracy()))); }); }); - // END: com.azure.ai.formrecognizer.training.FormTrainingAsyncClient.beginTraining#string-boolean-trainModelOptions-Duration + // END: com.azure.ai.formrecognizer.training.FormTrainingAsyncClient.beginTraining#string-boolean-trainingFileFilter-Duration } /** @@ -101,8 +101,8 @@ public void getCustomModel() { formTrainingAsyncClient.getCustomModel(modelId).subscribe(customFormModel -> { System.out.printf("Model Id: %s%n", customFormModel.getModelId()); System.out.printf("Model Status: %s%n", customFormModel.getModelStatus()); - customFormModel.getSubModels().forEach(customFormSubModel -> - customFormSubModel.getFieldMap().forEach((key, customFormModelField) -> + customFormModel.getSubmodels().forEach(customFormSubmodel -> + customFormSubmodel.getFieldMap().forEach((key, customFormModelField) -> System.out.printf("Form Type: %s Field Text: %s Field Accuracy: %s%n", key, customFormModelField.getName(), customFormModelField.getAccuracy()))); @@ -121,8 +121,8 @@ public void getCustomModelWithResponse() { CustomFormModel customFormModel = response.getValue(); System.out.printf("Model Id: %s%n", customFormModel.getModelId()); System.out.printf("Model Status: %s%n", customFormModel.getModelStatus()); - customFormModel.getSubModels().forEach(customFormSubModel -> - customFormSubModel.getFieldMap().forEach((key, customFormModelField) -> + customFormModel.getSubmodels().forEach(customFormSubmodel -> + customFormSubmodel.getFieldMap().forEach((key, customFormModelField) -> System.out.printf("Form Type: %s Field Text: %s Field Accuracy: %s%n", key, customFormModelField.getName(), customFormModelField.getAccuracy()))); }); @@ -182,16 +182,16 @@ public void deleteModelWithResponse() { } /** - * Code snippet for {@link FormTrainingAsyncClient#getModelInfos()} + * Code snippet for {@link FormTrainingAsyncClient#listCustomModels()} */ - public void getModelInfos() { - // BEGIN: com.azure.ai.formrecognizer.training.FormTrainingAsyncClient.getModelInfos - formTrainingAsyncClient.getModelInfos().subscribe(customModel -> + public void listCustomModels() { + // BEGIN: com.azure.ai.formrecognizer.training.FormTrainingAsyncClient.listCustomModels + formTrainingAsyncClient.listCustomModels().subscribe(customModel -> System.out.printf("Model Id: %s, Model status: %s, Created on: %s, Last updated on: %s.%n", customModel.getModelId(), customModel.getStatus(), - customModel.getCreatedOn(), - customModel.getLastUpdatedOn())); - // END: com.azure.ai.formrecognizer.training.FormTrainingAsyncClient.getModelInfos + customModel.getRequestedOn(), + customModel.getCompletedOn())); + // END: com.azure.ai.formrecognizer.training.FormTrainingAsyncClient.listCustomModels } } diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/FormTrainingClientJavaDocCodeSnippets.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/FormTrainingClientJavaDocCodeSnippets.java index 74b468b0d48a..c57f57217675 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/FormTrainingClientJavaDocCodeSnippets.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/FormTrainingClientJavaDocCodeSnippets.java @@ -5,7 +5,7 @@ import com.azure.ai.formrecognizer.models.AccountProperties; import com.azure.ai.formrecognizer.models.CustomFormModel; -import com.azure.ai.formrecognizer.models.TrainModelOptions; +import com.azure.ai.formrecognizer.models.TrainingFileFilter; import com.azure.ai.formrecognizer.training.FormTrainingClient; import com.azure.ai.formrecognizer.training.FormTrainingClientBuilder; import com.azure.core.http.rest.Response; @@ -39,33 +39,33 @@ public void beginTraining() { formTrainingClient.beginTraining(trainingFilesUrl, useTrainingLabels).getFinalResult(); System.out.printf("Model Id: %s%n", customFormModel.getModelId()); System.out.printf("Model Status: %s%n", customFormModel.getModelStatus()); - customFormModel.getSubModels().forEach(customFormSubModel -> - customFormSubModel.getFieldMap().forEach((key, customFormModelField) -> + customFormModel.getSubmodels().forEach(customFormSubmodel -> + customFormSubmodel.getFieldMap().forEach((key, customFormModelField) -> System.out.printf("Form Type: %s Field Text: %s Field Accuracy: %s%n", key, customFormModelField.getName(), customFormModelField.getAccuracy()))); // END: com.azure.ai.formrecognizer.training.FormTrainingClient.beginTraining#string-boolean } /** - * Code snippet for {@link FormTrainingClient#beginTraining(String, boolean, TrainModelOptions, Duration)} + * Code snippet for {@link FormTrainingClient#beginTraining(String, boolean, TrainingFileFilter, Duration)} * with options */ public void beginTrainingWithOptions() { - // BEGIN: com.azure.ai.formrecognizer.training.FormTrainingClient.beginTraining#string-boolean-trainModelOptions-Duration + // BEGIN: com.azure.ai.formrecognizer.training.FormTrainingClient.beginTraining#string-boolean-trainingFileFilter-Duration String trainingFilesUrl = "{training-set-SAS-URL}"; - TrainModelOptions trainModelOptions = new TrainModelOptions().setIncludeSubFolders(false).setPrefix("Invoice"); + TrainingFileFilter trainingFileFilter = new TrainingFileFilter().setIncludeSubFolders(false).setPrefix("Invoice"); boolean useTrainingLabels = true; CustomFormModel customFormModel = formTrainingClient.beginTraining(trainingFilesUrl, useTrainingLabels, - trainModelOptions, Duration.ofSeconds(5)).getFinalResult(); + trainingFileFilter, Duration.ofSeconds(5)).getFinalResult(); System.out.printf("Model Id: %s%n", customFormModel.getModelId()); System.out.printf("Model Status: %s%n", customFormModel.getModelStatus()); - customFormModel.getSubModels().forEach(customFormSubModel -> - customFormSubModel.getFieldMap().forEach((key, customFormModelField) -> + customFormModel.getSubmodels().forEach(customFormSubmodel -> + customFormSubmodel.getFieldMap().forEach((key, customFormModelField) -> System.out.printf("Form Type: %s Field Text: %s Field Accuracy: %s%n", key, customFormModelField.getName(), customFormModelField.getAccuracy()))); - // END: com.azure.ai.formrecognizer.training.FormTrainingClient.beginTraining#string-boolean-trainModelOptions-Duration + // END: com.azure.ai.formrecognizer.training.FormTrainingClient.beginTraining#string-boolean-trainingFileFilter-Duration } /** @@ -77,8 +77,8 @@ public void getCustomModel() { CustomFormModel customFormModel = formTrainingClient.getCustomModel(modelId); System.out.printf("Model Id: %s%n", customFormModel.getModelId()); System.out.printf("Model Status: %s%n", customFormModel.getModelStatus()); - customFormModel.getSubModels().forEach(customFormSubModel -> - customFormSubModel.getFieldMap().forEach((key, customFormModelField) -> + customFormModel.getSubmodels().forEach(customFormSubmodel -> + customFormSubmodel.getFieldMap().forEach((key, customFormModelField) -> System.out.printf("Form Type: %s Field Text: %s Field Accuracy: %s%n", key, customFormModelField.getName(), customFormModelField.getAccuracy()))); // END: com.azure.ai.formrecognizer.training.FormTrainingClient.getCustomModel#string @@ -95,8 +95,8 @@ public void getCustomModelWithResponse() { CustomFormModel customFormModel = response.getValue(); System.out.printf("Model Id: %s%n", customFormModel.getModelId()); System.out.printf("Model Status: %s%n", customFormModel.getModelStatus()); - customFormModel.getSubModels().forEach(customFormSubModel -> - customFormSubModel.getFieldMap().forEach((key, customFormModelField) -> + customFormModel.getSubmodels().forEach(customFormSubmodel -> + customFormSubmodel.getFieldMap().forEach((key, customFormModelField) -> System.out.printf("Field: %s Field Text: %s Field Accuracy: %s%n", key, customFormModelField.getName(), customFormModelField.getAccuracy()))); // END: com.azure.ai.formrecognizer.training.FormTrainingClient.getCustomModelWithResponse#string-Context @@ -152,32 +152,32 @@ public void deleteModelWithResponse() { } /** - * Code snippet for {@link FormTrainingClient#getModelInfos()} + * Code snippet for {@link FormTrainingClient#listCustomModels()} */ - public void getModelInfos() { - // BEGIN: com.azure.ai.formrecognizer.training.FormTrainingClient.getModelInfos - formTrainingClient.getModelInfos().forEach(customModel -> + public void listCustomModels() { + // BEGIN: com.azure.ai.formrecognizer.training.FormTrainingClient.listCustomModels + formTrainingClient.listCustomModels().forEach(customModel -> System.out.printf("Model Id: %s, Model status: %s, Created on: %s, Last updated on: %s.%n", customModel.getModelId(), customModel.getStatus(), - customModel.getCreatedOn(), - customModel.getLastUpdatedOn()) + customModel.getRequestedOn(), + customModel.getCompletedOn()) ); - // END: com.azure.ai.formrecognizer.training.FormTrainingClient.getModelInfos + // END: com.azure.ai.formrecognizer.training.FormTrainingClient.listCustomModels } /** - * Code snippet for {@link FormTrainingClient#getModelInfos(Context)} + * Code snippet for {@link FormTrainingClient#listCustomModels(Context)} */ - public void getModelInfosWithContext() { - // BEGIN: com.azure.ai.formrecognizer.training.FormTrainingClient.getModelInfos#Context - formTrainingClient.getModelInfos(Context.NONE).forEach(customModel -> + public void listCustomModelsWithContext() { + // BEGIN: com.azure.ai.formrecognizer.training.FormTrainingClient.listCustomModels#Context + formTrainingClient.listCustomModels(Context.NONE).forEach(customModel -> System.out.printf("Model Id: %s, Model status: %s, Created on: %s, Last updated on: %s.%n", customModel.getModelId(), customModel.getStatus(), - customModel.getCreatedOn(), - customModel.getLastUpdatedOn()) + customModel.getRequestedOn(), + customModel.getCompletedOn()) ); - // END: com.azure.ai.formrecognizer.training.FormTrainingClient.getModelInfos#Context + // END: com.azure.ai.formrecognizer.training.FormTrainingClient.listCustomModels#Context } } diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/ManageCustomModels.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/ManageCustomModels.java index e205a611124d..917f08dd2223 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/ManageCustomModels.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/ManageCustomModels.java @@ -40,7 +40,7 @@ public static void main(final String[] args) { accountProperties.getCustomModelCount(), accountProperties.getCustomModelLimit()); // Next, we get a paged list of all of our custom models - PagedIterable customModels = client.getModelInfos(); + PagedIterable customModels = client.listCustomModels(); System.out.println("We have following models in the account:"); customModels.forEach(customFormModelInfo -> { System.out.printf("Model Id: %s%n", customFormModelInfo.getModelId()); @@ -49,13 +49,13 @@ public static void main(final String[] args) { CustomFormModel customModel = client.getCustomModel(customFormModelInfo.getModelId()); System.out.printf("Model Id: %s%n", customModel.getModelId()); System.out.printf("Model Status: %s%n", customModel.getModelStatus()); - System.out.printf("Created on: %s%n", customModel.getCreatedOn()); - System.out.printf("Updated on: %s%n", customModel.getLastUpdatedOn()); - customModel.getSubModels().forEach(customFormSubModel -> { - System.out.printf("Custom Model Form type: %s%n", customFormSubModel.getFormType()); - System.out.printf("Custom Model Accuracy: %.2f%n", customFormSubModel.getAccuracy()); - if (customFormSubModel.getFieldMap() != null) { - customFormSubModel.getFieldMap().forEach((fieldText, customFormModelField) -> { + System.out.printf("Created on: %s%n", customModel.getRequestedOn()); + System.out.printf("Updated on: %s%n", customModel.getCompletedOn()); + customModel.getSubmodels().forEach(customFormSubmodel -> { + System.out.printf("Custom Model Form type: %s%n", customFormSubmodel.getFormType()); + System.out.printf("Custom Model Accuracy: %.2f%n", customFormSubmodel.getAccuracy()); + if (customFormSubmodel.getFieldMap() != null) { + customFormSubmodel.getFieldMap().forEach((fieldText, customFormModelField) -> { System.out.printf("Field Text: %s%n", fieldText); System.out.printf("Field Accuracy: %.2f%n", customFormModelField.getAccuracy()); }); diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/ManageCustomModelsAsync.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/ManageCustomModelsAsync.java index 997df695a015..a96968284ef9 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/ManageCustomModelsAsync.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/ManageCustomModelsAsync.java @@ -36,7 +36,7 @@ public static void main(final String[] args) { accountProperties.getCustomModelCount(), accountProperties.getCustomModelLimit())); // Next, we get a paged list of all of our custom models System.out.println("We have following models in the account:"); - client.getModelInfos().subscribe(customFormModelInfo -> { + client.listCustomModels().subscribe(customFormModelInfo -> { String createdModelId = customFormModelInfo.getModelId(); System.out.printf("Model Id: %s%n", createdModelId); // get custom model info @@ -44,13 +44,13 @@ public static void main(final String[] args) { client.getCustomModel(customFormModelInfo.getModelId()).subscribe(customModel -> { System.out.printf("Model Id: %s%n", customModel.getModelId()); System.out.printf("Model Status: %s%n", customModel.getModelStatus()); - System.out.printf("Created on: %s%n", customModel.getCreatedOn()); - System.out.printf("Updated on: %s%n", customModel.getLastUpdatedOn()); - customModel.getSubModels().forEach(customFormSubModel -> { - System.out.printf("Custom Model Form type: %s%n", customFormSubModel.getFormType()); - System.out.printf("Custom Model Accuracy: %.2f%n", customFormSubModel.getAccuracy()); - if (customFormSubModel.getFieldMap() != null) { - customFormSubModel.getFieldMap().forEach((fieldText, customFormModelField) -> { + System.out.printf("Created on: %s%n", customModel.getRequestedOn()); + System.out.printf("Updated on: %s%n", customModel.getCompletedOn()); + customModel.getSubmodels().forEach(customFormSubmodel -> { + System.out.printf("Custom Model Form type: %s%n", customFormSubmodel.getFormType()); + System.out.printf("Custom Model Accuracy: %.2f%n", customFormSubmodel.getAccuracy()); + if (customFormSubmodel.getFieldMap() != null) { + customFormSubmodel.getFieldMap().forEach((fieldText, customFormModelField) -> { System.out.printf("Field Text: %s%n", fieldText); System.out.printf("Field Accuracy: %.2f%n", customFormModelField.getAccuracy()); }); diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/ReadmeSamples.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/ReadmeSamples.java index 21d11af0152a..22ba5d3f54b5 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/ReadmeSamples.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/ReadmeSamples.java @@ -133,15 +133,15 @@ public void trainModel() { // Model Info System.out.printf("Model Id: %s%n", customFormModel.getModelId()); System.out.printf("Model Status: %s%n", customFormModel.getModelStatus()); - System.out.printf("Model created on: %s%n", customFormModel.getCreatedOn()); - System.out.printf("Model last updated: %s%n%n", customFormModel.getLastUpdatedOn()); + System.out.printf("Model requested on: %s%n", customFormModel.getRequestedOn()); + System.out.printf("Model training completed on: %s%n%n", customFormModel.getCompletedOn()); System.out.println("Recognized Fields:"); // looping through the sub-models, which contains the fields they were trained on // Since the given training documents are unlabeled, we still group them but they do not have a label. - customFormModel.getSubModels().forEach(customFormSubModel -> { + customFormModel.getSubmodels().forEach(customFormSubmodel -> { // Since the training data is unlabeled, we are unable to return the accuracy of this model - customFormSubModel.getFieldMap().forEach((field, customFormModelField) -> + customFormSubmodel.getFieldMap().forEach((field, customFormModelField) -> System.out.printf("Field: %s Field Label: %s%n", field, customFormModelField.getLabel())); }); @@ -155,7 +155,7 @@ public void manageModels() { accountProperties.getCustomModelCount(), accountProperties.getCustomModelLimit()); // Next, we get a paged list of all of our custom models - PagedIterable customModels = formTrainingClient.getModelInfos(); + PagedIterable customModels = formTrainingClient.listCustomModels(); System.out.println("We have following models in the account:"); customModels.forEach(customFormModelInfo -> { System.out.printf("Model Id: %s%n", customFormModelInfo.getModelId()); @@ -163,13 +163,13 @@ public void manageModels() { modelId.set(customFormModelInfo.getModelId()); CustomFormModel customModel = formTrainingClient.getCustomModel(customFormModelInfo.getModelId()); System.out.printf("Model Status: %s%n", customModel.getModelStatus()); - System.out.printf("Created on: %s%n", customModel.getCreatedOn()); - System.out.printf("Updated on: %s%n", customModel.getLastUpdatedOn()); - customModel.getSubModels().forEach(customFormSubModel -> { - System.out.printf("Custom Model Form type: %s%n", customFormSubModel.getFormType()); - System.out.printf("Custom Model Accuracy: %d%n", customFormSubModel.getAccuracy()); - if (customFormSubModel.getFieldMap() != null) { - customFormSubModel.getFieldMap().forEach((fieldText, customFormModelField) -> { + System.out.printf("Created on: %s%n", customModel.getRequestedOn()); + System.out.printf("Updated on: %s%n", customModel.getCompletedOn()); + customModel.getSubmodels().forEach(customFormSubmodel -> { + System.out.printf("Custom Model Form type: %s%n", customFormSubmodel.getFormType()); + System.out.printf("Custom Model Accuracy: %d%n", customFormSubmodel.getAccuracy()); + if (customFormSubmodel.getFieldMap() != null) { + customFormSubmodel.getFieldMap().forEach((fieldText, customFormModelField) -> { System.out.printf("Field Text: %s%n", fieldText); System.out.printf("Field Accuracy: %d%n", customFormModelField.getAccuracy()); }); diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/TrainModelWithLabels.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/TrainModelWithLabels.java index 3808556ee51c..cfdfb7d7b316 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/TrainModelWithLabels.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/TrainModelWithLabels.java @@ -37,16 +37,16 @@ public static void main(String[] args) { // Model Info System.out.printf("Model Id: %s%n", customFormModel.getModelId()); System.out.printf("Model Status: %s%n", customFormModel.getModelStatus()); - System.out.printf("Model created on: %s%n", customFormModel.getCreatedOn()); - System.out.printf("Model last updated: %s%n%n", customFormModel.getLastUpdatedOn()); + System.out.printf("Model requested on: %s%n", customFormModel.getRequestedOn()); + System.out.printf("Model training completed on: %s%n%n", customFormModel.getCompletedOn()); // looping through the sub-models, which contains the fields they were trained on // The labels are based on the ones you gave the training document. System.out.println("Recognized Fields:"); // Since the data is labeled, we are able to return the accuracy of the model - customFormModel.getSubModels().forEach(customFormSubModel -> { - System.out.printf("Sub-model accuracy: %.2f%n", customFormSubModel.getAccuracy()); - customFormSubModel.getFieldMap().forEach((label, customFormModelField) -> + customFormModel.getSubmodels().forEach(customFormSubmodel -> { + System.out.printf("Sub-model accuracy: %.2f%n", customFormSubmodel.getAccuracy()); + customFormSubmodel.getFieldMap().forEach((label, customFormModelField) -> System.out.printf("Field: %s Field Name: %s Field Accuracy: %.2f%n", label, customFormModelField.getName(), customFormModelField.getAccuracy())); }); diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/TrainModelWithLabelsAsync.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/TrainModelWithLabelsAsync.java index 7afee42a1491..d3f8be4ed670 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/TrainModelWithLabelsAsync.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/TrainModelWithLabelsAsync.java @@ -53,16 +53,16 @@ public static void main(String[] args) { // Model Info System.out.printf("Model Id: %s%n", customFormModel.getModelId()); System.out.printf("Model Status: %s%n", customFormModel.getModelStatus()); - System.out.printf("Model created on: %s%n", customFormModel.getCreatedOn()); - System.out.printf("Model last updated: %s%n%n", customFormModel.getLastUpdatedOn()); + System.out.printf("Model requested on: %s%n", customFormModel.getRequestedOn()); + System.out.printf("Model training completed on: %s%n%n", customFormModel.getCompletedOn()); // looping through the sub-models, which contains the fields they were trained on // The labels are based on the ones you gave the training document. System.out.println("Recognized Fields:"); // Since the data is labeled, we are able to return the accuracy of the model - customFormModel.getSubModels().forEach(customFormSubModel -> { - System.out.printf("Sub-model accuracy: %.2f%n", customFormSubModel.getAccuracy()); - customFormSubModel.getFieldMap().forEach((label, customFormModelField) -> + customFormModel.getSubmodels().forEach(customFormSubmodel -> { + System.out.printf("Sub-model accuracy: %.2f%n", customFormSubmodel.getAccuracy()); + customFormSubmodel.getFieldMap().forEach((label, customFormModelField) -> System.out.printf("Field: %s Field Name: %s Field Accuracy: %.2f%n", label, customFormModelField.getName(), customFormModelField.getAccuracy())); }); diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/TrainModelWithoutLabels.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/TrainModelWithoutLabels.java index a40ee7503f74..2990518d481c 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/TrainModelWithoutLabels.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/TrainModelWithoutLabels.java @@ -37,15 +37,15 @@ public static void main(String[] args) { // Model Info System.out.printf("Model Id: %s%n", customFormModel.getModelId()); System.out.printf("Model Status: %s%n", customFormModel.getModelStatus()); - System.out.printf("Model created on: %s%n", customFormModel.getCreatedOn()); - System.out.printf("Model last updated: %s%n%n", customFormModel.getLastUpdatedOn()); + System.out.printf("Model requested on: %s%n", customFormModel.getRequestedOn()); + System.out.printf("Model training completed on: %s%n%n", customFormModel.getCompletedOn()); System.out.println("Recognized Fields:"); // looping through the sub-models, which contains the fields they were trained on // Since the given training documents are unlabeled, we still group them but they do not have a label. - customFormModel.getSubModels().forEach(customFormSubModel -> { + customFormModel.getSubmodels().forEach(customFormSubmodel -> { // Since the training data is unlabeled, we are unable to return the accuracy of this model - customFormSubModel.getFieldMap().forEach((field, customFormModelField) -> + customFormSubmodel.getFieldMap().forEach((field, customFormModelField) -> System.out.printf("Field: %s Field Label: %s%n", field, customFormModelField.getLabel())); }); diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/TrainModelWithoutLabelsAsync.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/TrainModelWithoutLabelsAsync.java index aca264af28af..e36a246a122a 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/TrainModelWithoutLabelsAsync.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/TrainModelWithoutLabelsAsync.java @@ -53,15 +53,15 @@ public static void main(String[] args) { // Model Info System.out.printf("Model Id: %s%n", customFormModel.getModelId()); System.out.printf("Model Status: %s%n", customFormModel.getModelStatus()); - System.out.printf("Model created on: %s%n", customFormModel.getCreatedOn()); - System.out.printf("Model last updated: %s%n%n", customFormModel.getLastUpdatedOn()); + System.out.printf("Model requested on: %s%n", customFormModel.getRequestedOn()); + System.out.printf("Model training completed on: %s%n%n", customFormModel.getCompletedOn()); System.out.println("Recognized Fields:"); // looping through the sub-models, which contains the fields they were trained on // Since the given training documents are unlabeled, we still group them but they do not have a label. - customFormModel.getSubModels().forEach(customFormSubModel -> { + customFormModel.getSubmodels().forEach(customFormSubmodel -> { // Since the training data is unlabeled, we are unable to return the accuracy of this model - customFormSubModel.getFieldMap().forEach((field, customFormModelField) -> + customFormSubmodel.getFieldMap().forEach((field, customFormModelField) -> System.out.printf("Field: %s Field Label: %s%n", field, customFormModelField.getLabel())); }); diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/FormTrainingAsyncClientTest.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/FormTrainingAsyncClientTest.java index cc91fbca2747..eb9de29c86cc 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/FormTrainingAsyncClientTest.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/FormTrainingAsyncClientTest.java @@ -203,12 +203,12 @@ public void deleteModelValidModelIdWithResponse(HttpClient httpClient, FormRecog */ @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.formrecognizer.TestUtils#getTestParameters") - public void getModelInfos(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { + public void listCustomModels(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { client = getFormTrainingAsyncClient(httpClient, serviceVersion); - StepVerifier.create(client.getModelInfos()) + StepVerifier.create(client.listCustomModels()) .thenConsumeWhile(customFormModelInfo -> - customFormModelInfo.getModelId() != null && customFormModelInfo.getCreatedOn() != null - && customFormModelInfo.getLastUpdatedOn() != null && customFormModelInfo.getStatus() != null) + customFormModelInfo.getModelId() != null && customFormModelInfo.getRequestedOn() != null + && customFormModelInfo.getCompletedOn() != null && customFormModelInfo.getStatus() != null) .verifyComplete(); } diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/FormTrainingClientTest.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/FormTrainingClientTest.java index 13a4862457c1..415355fe7668 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/FormTrainingClientTest.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/FormTrainingClientTest.java @@ -178,11 +178,11 @@ public void deleteModelValidModelIdWithResponse(HttpClient httpClient, FormRecog */ @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.formrecognizer.TestUtils#getTestParameters") - public void getModelInfos(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { + public void listCustomModels(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { client = getFormTrainingClient(httpClient, serviceVersion); - for (CustomFormModelInfo modelInfo : client.getModelInfos()) { - assertTrue(modelInfo.getModelId() != null && modelInfo.getCreatedOn() != null - && modelInfo.getLastUpdatedOn() != null && modelInfo.getStatus() != null); + for (CustomFormModelInfo modelInfo : client.listCustomModels()) { + assertTrue(modelInfo.getModelId() != null && modelInfo.getRequestedOn() != null + && modelInfo.getCompletedOn() != null && modelInfo.getStatus() != null); } } @@ -191,11 +191,11 @@ public void getModelInfos(HttpClient httpClient, FormRecognizerServiceVersion se */ @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.formrecognizer.TestUtils#getTestParameters") - public void getModelInfosWithContext(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { + public void listCustomModelsWithContext(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { client = getFormTrainingClient(httpClient, serviceVersion); - for (CustomFormModelInfo modelInfo : client.getModelInfos(Context.NONE)) { - assertTrue(modelInfo.getModelId() != null && modelInfo.getCreatedOn() != null - && modelInfo.getLastUpdatedOn() != null && modelInfo.getStatus() != null); + for (CustomFormModelInfo modelInfo : client.listCustomModels(Context.NONE)) { + assertTrue(modelInfo.getModelId() != null && modelInfo.getRequestedOn() != null + && modelInfo.getCompletedOn() != null && modelInfo.getStatus() != null); } } diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/FormTrainingClientTestBase.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/FormTrainingClientTestBase.java index b4784222e945..46406c2e9197 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/FormTrainingClientTestBase.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/FormTrainingClientTestBase.java @@ -8,7 +8,7 @@ import com.azure.ai.formrecognizer.models.AccountProperties; import com.azure.ai.formrecognizer.models.CustomFormModel; import com.azure.ai.formrecognizer.models.CustomFormModelField; -import com.azure.ai.formrecognizer.models.CustomFormSubModel; +import com.azure.ai.formrecognizer.models.CustomFormSubmodel; import com.azure.ai.formrecognizer.models.ErrorInformation; import com.azure.ai.formrecognizer.models.FormRecognizerError; import com.azure.ai.formrecognizer.models.TrainingDocumentInfo; @@ -93,12 +93,12 @@ void validateCustomModelData(CustomFormModel actualCustomModel, boolean isLabele assertEquals(modelRawResponse.getModelInfo().getStatus().toString(), actualCustomModel.getModelStatus().toString()); validateErrorData(modelRawResponse.getTrainResult().getErrors(), actualCustomModel.getModelError()); - assertNotNull(actualCustomModel.getCreatedOn()); - assertNotNull(actualCustomModel.getLastUpdatedOn()); + assertNotNull(actualCustomModel.getRequestedOn()); + assertNotNull(actualCustomModel.getCompletedOn()); validateTrainingDocumentsData(modelRawResponse.getTrainResult().getTrainingDocuments(), actualCustomModel.getTrainingDocuments()); - final List subModelList = - actualCustomModel.getSubModels().stream().collect(Collectors.toList()); + final List subModelList = + actualCustomModel.getSubmodels().stream().collect(Collectors.toList()); if (isLabeled) { final List fields = modelRawResponse.getTrainResult().getFields(); for (final FormFieldsReport expectedField : fields) { @@ -164,7 +164,7 @@ private Model getRawModelResponse() { abstract void deleteModelValidModelIdWithResponse(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion); @Test - abstract void getModelInfos(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion); + abstract void listCustomModels(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion); @Test abstract void beginTrainingNullInput(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion); From 889ba631150fe9364370ff91d3a6d43504f6bbaf Mon Sep 17 00:00:00 2001 From: Sameeksha Vaity Date: Thu, 28 May 2020 16:39:53 -0700 Subject: [PATCH 2/3] PageRange rename --- .../azure-ai-formrecognizer/CHANGELOG.md | 2 + .../azure/ai/formrecognizer/Transforms.java | 14 ++--- .../models/CustomFormModel.java | 9 ++-- .../models/CustomFormSubmodel.java | 2 +- .../formrecognizer/models/FormPageRange.java | 53 +++++++++++++++++++ .../ai/formrecognizer/models/PageRange.java | 53 ------------------- .../formrecognizer/models/RecognizedForm.java | 12 ++--- .../FormRecognizerClientTestBase.java | 34 ++++++------ ...tModelInfos.json => listCustomModels.json} | 0 ....json => listCustomModelsWithContext.json} | 0 10 files changed, 92 insertions(+), 87 deletions(-) create mode 100644 sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/FormPageRange.java delete mode 100644 sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/PageRange.java rename sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/{getModelInfos.json => listCustomModels.json} (100%) rename sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/{getModelInfosWithContext.json => listCustomModelsWithContext.json} (100%) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/CHANGELOG.md b/sdk/formrecognizer/azure-ai-formrecognizer/CHANGELOG.md index 2090ebf05b5e..419a919491e0 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/CHANGELOG.md +++ b/sdk/formrecognizer/azure-ai-formrecognizer/CHANGELOG.md @@ -1,6 +1,8 @@ # Release History ## 1.0.0-beta.3 (Unreleased) +- Rename model `PageRange` to `FormPageRange` +- Rename property `startPageNumber` to `firstPageNumber` and `endPageNumber` to `lastPageNumber` in model `PageRange` - Rename `getCustomModelInfos` to `listCustomModels` - Rename property `lastUpdatedOn` to `completedOn` and `createdOn` to `requestedOn` in `CustomFormModel` and `CustomFormModelInfo` model diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/Transforms.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/Transforms.java index 63cd3d69b5f7..e3aa8517362e 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/Transforms.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/Transforms.java @@ -21,7 +21,7 @@ import com.azure.ai.formrecognizer.models.FormTable; import com.azure.ai.formrecognizer.models.FormTableCell; import com.azure.ai.formrecognizer.models.FormWord; -import com.azure.ai.formrecognizer.models.PageRange; +import com.azure.ai.formrecognizer.models.FormPageRange; import com.azure.ai.formrecognizer.models.Point; import com.azure.ai.formrecognizer.models.RecognizedForm; import com.azure.ai.formrecognizer.models.RecognizedReceipt; @@ -69,12 +69,12 @@ static List toRecognizedForm(AnalyzeResult analyzeResult, boolea if (!CoreUtils.isNullOrEmpty(documentResults)) { extractedFormList = new ArrayList<>(); for (DocumentResult documentResultItem : documentResults) { - PageRange pageRange; + FormPageRange formPageRange; List documentPageRange = documentResultItem.getPageRange(); if (documentPageRange.size() == 2) { - pageRange = new PageRange(documentPageRange.get(0), documentPageRange.get(1)); + formPageRange = new FormPageRange(documentPageRange.get(0), documentPageRange.get(1)); } else { - pageRange = new PageRange(1, 1); + formPageRange = new FormPageRange(1, 1); } Map> extractedFieldMap = getUnlabeledFieldMap(documentResultItem, readResults, @@ -82,8 +82,8 @@ static List toRecognizedForm(AnalyzeResult analyzeResult, boolea extractedFormList.add(new RecognizedForm( extractedFieldMap, documentResultItem.getDocType(), - pageRange, - formPages.subList(pageRange.getStartPageNumber() - 1, pageRange.getEndPageNumber()))); + formPageRange, + formPages.subList(formPageRange.getFirstPageNumber() - 1, formPageRange.getLastPageNumber()))); } } else { extractedFormList = new ArrayList<>(); @@ -100,7 +100,7 @@ static List toRecognizedForm(AnalyzeResult analyzeResult, boolea extractedFormList.add(new RecognizedForm( extractedFieldMap, formType.toString(), - new PageRange(pageNumber, pageNumber), + new FormPageRange(pageNumber, pageNumber), Collections.singletonList(formPages.get(index)))); })); } diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/CustomFormModel.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/CustomFormModel.java index a150968772c3..f0e6a6f2fca3 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/CustomFormModel.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/CustomFormModel.java @@ -41,7 +41,8 @@ public final class CustomFormModel { private final OffsetDateTime completedOn; /* - * List of sub models. + * List of sub model that are part of this model, each of which can recognize and extract fields + * from a different type of form. */ private final IterableStream submodels; @@ -57,7 +58,8 @@ public final class CustomFormModel { * @param modelStatus Status of the model. * @param requestedOn Date and time (UTC) when the training model was requested. * @param completedOn Date and time (UTC) when the model training was completed. - * @param submodels List of sub models. + * @param submodels List of sub model that are part of this model, each of which can recognize and extract fields + * from a different type of form. * @param modelError List of errors returned during the training operation. * @param trainingDocuments List of the documents used to train the model. */ @@ -120,7 +122,8 @@ public List getModelError() { } /** - * Get the recognized sub models returned during the training operation. + * Get the list of sub model that are part of this model, each of which can recognize + * and extract fields from a different type of form. * * @return the sub models value. */ diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/CustomFormSubmodel.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/CustomFormSubmodel.java index edfd6f0aa753..8bfe56f320b7 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/CustomFormSubmodel.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/CustomFormSubmodel.java @@ -23,7 +23,7 @@ public final class CustomFormSubmodel { */ private final Map fieldMap; - /** + /* * The form type. */ private final String formType; diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/FormPageRange.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/FormPageRange.java new file mode 100644 index 000000000000..97a5e77aeb02 --- /dev/null +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/FormPageRange.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.formrecognizer.models; + +import com.azure.core.annotation.Immutable; + +/** + * The PageRange model. + */ +@Immutable +public final class FormPageRange { + + /* + * The first page number property. + */ + private final int firstPageNumber; + + /* + * The last page number property. + */ + private final int lastPageNumber; + + + /** + * Construct a PageRange object. + * + * @param firstPageNumber The first page number of the range. + * @param lastPageNumber The first page number of the range.. + */ + public FormPageRange(final int firstPageNumber, final int lastPageNumber) { + this.firstPageNumber = firstPageNumber; + this.lastPageNumber = lastPageNumber; + } + + /** + * Get the first page number. + * + * @return the first page number of the range. + */ + public int getFirstPageNumber() { + return this.firstPageNumber; + } + + /** + * Get the last page number. + * + * @return the last page number of the range. + */ + public int getLastPageNumber() { + return this.lastPageNumber; + } +} diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/PageRange.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/PageRange.java deleted file mode 100644 index 8babfc15e9e1..000000000000 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/PageRange.java +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.formrecognizer.models; - -import com.azure.core.annotation.Immutable; - -/** - * The PageRange model. - */ -@Immutable -public final class PageRange { - - /* - * The start page number property. - */ - private final int startPageNumber; - - /* - * The end page number property. - */ - private final int endPageNumber; - - - /** - * Construct a PageRange object. - * - * @param startPageNumber The start page number property. - * @param endPageNumber The end page number property. - */ - public PageRange(final int startPageNumber, final int endPageNumber) { - this.startPageNumber = startPageNumber; - this.endPageNumber = endPageNumber; - } - - /** - * Get the start page number. - * - * @return the start value of the page number . - */ - public int getStartPageNumber() { - return this.startPageNumber; - } - - /** - * Get the end page number. - * - * @return the end value of the page number . - */ - public int getEndPageNumber() { - return this.endPageNumber; - } -} diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/RecognizedForm.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/RecognizedForm.java index 323bdcdef80e..192a470616ec 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/RecognizedForm.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/RecognizedForm.java @@ -27,7 +27,7 @@ public final class RecognizedForm { /* * First and last page number where the document is found. */ - private final PageRange pageRange; + private final FormPageRange formPageRange; /* * List of extracted pages from the form. @@ -39,14 +39,14 @@ public final class RecognizedForm { * * @param fields Dictionary of named field values. * @param formType Form type. - * @param pageRange First and last page number where the document is found. + * @param formPageRange First and last page number where the document is found. * @param pages List of extracted pages from the form. */ - public RecognizedForm(final Map> fields, final String formType, final PageRange pageRange, + public RecognizedForm(final Map> fields, final String formType, final FormPageRange formPageRange, final List pages) { this.fields = fields; this.formType = formType; - this.pageRange = pageRange; + this.formPageRange = formPageRange; this.pages = pages; } @@ -73,8 +73,8 @@ public String getFormType() { * * @return the pageRange value. */ - public PageRange getPageRange() { - return this.pageRange; + public FormPageRange getFormPageRange() { + return this.formPageRange; } /** diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/FormRecognizerClientTestBase.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/FormRecognizerClientTestBase.java index 7cbcab752e9e..3b31663c9db1 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/FormRecognizerClientTestBase.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/FormRecognizerClientTestBase.java @@ -23,7 +23,7 @@ import com.azure.ai.formrecognizer.models.FormTable; import com.azure.ai.formrecognizer.models.FormTableCell; import com.azure.ai.formrecognizer.models.FormWord; -import com.azure.ai.formrecognizer.models.PageRange; +import com.azure.ai.formrecognizer.models.FormPageRange; import com.azure.ai.formrecognizer.models.Point; import com.azure.ai.formrecognizer.models.ReceiptItemType; import com.azure.ai.formrecognizer.models.RecognizedForm; @@ -212,9 +212,9 @@ private static void validateFieldValueTransforms(FieldValue expectedFieldValue, } } - private static void validatePageRangeData(int expectedPageInfo, PageRange actualPageInfo) { - assertEquals(expectedPageInfo, actualPageInfo.getStartPageNumber()); - assertEquals(expectedPageInfo, actualPageInfo.getEndPageNumber()); + private static void validatePageRangeData(int expectedPageInfo, FormPageRange actualPageInfo) { + assertEquals(expectedPageInfo, actualPageInfo.getFirstPageNumber()); + assertEquals(expectedPageInfo, actualPageInfo.getLastPageNumber()); } private static void validateReceiptItemsData(List expectedReceiptItemList, @@ -315,9 +315,9 @@ void validateUSReceiptData(USReceipt actualRecognizedReceipt, boolean includeTex DocumentResult documentResult = analyzeResult.getDocumentResults().get(0); final Map expectedReceiptFields = documentResult.getFields(); validatePageRangeData(documentResult.getPageRange().get(0), - actualRecognizedReceipt.getRecognizedForm().getPageRange()); + actualRecognizedReceipt.getRecognizedForm().getFormPageRange()); validatePageRangeData(documentResult.getPageRange().get(1), - actualRecognizedReceipt.getRecognizedForm().getPageRange()); + actualRecognizedReceipt.getRecognizedForm().getFormPageRange()); assertEquals(expectedReceiptFields.get("ReceiptType").getValueString(), actualRecognizedReceipt.getReceiptType().getType()); assertEquals(expectedReceiptFields.get("ReceiptType").getConfidence(), @@ -465,7 +465,7 @@ void beginTrainingMultipageRunner(Consumer testRunner) { private void validateUnLabeledResult(RecognizedForm actualForm, boolean includeTextDetails, List readResults, PageResult expectedPage) { - validatePageRangeData(expectedPage.getPage(), actualForm.getPageRange()); + validatePageRangeData(expectedPage.getPage(), actualForm.getFormPageRange()); for (int i = 0; i < expectedPage.getKeyValuePairs().size(); i++) { final KeyValuePair expectedFormField = expectedPage.getKeyValuePairs().get(i); final FormField actualFormField = actualForm.getFields().get("field-" + i); @@ -488,8 +488,8 @@ private void validateUnLabeledResult(RecognizedForm actualForm, boolean includeT private void validateLabeledData(RecognizedForm actualForm, boolean includeTextDetails, List readResults, DocumentResult documentResult) { - assertEquals(documentResult.getPageRange().get(0), actualForm.getPageRange().getStartPageNumber()); - assertEquals(documentResult.getPageRange().get(1), actualForm.getPageRange().getEndPageNumber()); + assertEquals(documentResult.getPageRange().get(0), actualForm.getFormPageRange().getFirstPageNumber()); + assertEquals(documentResult.getPageRange().get(1), actualForm.getFormPageRange().getLastPageNumber()); documentResult.getFields().forEach((label, expectedFieldValue) -> { final FormField actualFormField = actualForm.getFields().get(label); assertEquals(label, actualFormField.getName()); @@ -507,8 +507,8 @@ private void validateLabeledData(RecognizedForm actualForm, boolean includeTextD static void validateMultiPageDataLabeled(List actualRecognizedFormsList) { actualRecognizedFormsList.forEach(recognizedForm -> { assertEquals("custom:form", recognizedForm.getFormType()); - assertEquals(1, recognizedForm.getPageRange().getStartPageNumber()); - assertEquals(3, recognizedForm.getPageRange().getEndPageNumber()); + assertEquals(1, recognizedForm.getFormPageRange().getFirstPageNumber()); + assertEquals(3, recognizedForm.getFormPageRange().getLastPageNumber()); assertEquals(3, recognizedForm.getPages().size()); recognizedForm.getFields().forEach((label, formField) -> { assertNotNull(formField.getName()); @@ -538,8 +538,8 @@ static void validateMultipageReceiptData(List recognizedRecei USReceipt receiptPage2 = ReceiptExtensions.asUSReceipt(recognizedReceipts.get(1)); USReceipt receiptPage3 = ReceiptExtensions.asUSReceipt(recognizedReceipts.get(2)); - assertEquals(1, receiptPage1.getRecognizedForm().getPageRange().getStartPageNumber()); - assertEquals(1, receiptPage1.getRecognizedForm().getPageRange().getEndPageNumber()); + assertEquals(1, receiptPage1.getRecognizedForm().getFormPageRange().getFirstPageNumber()); + assertEquals(1, receiptPage1.getRecognizedForm().getFormPageRange().getLastPageNumber()); assertEquals(EXPECTED_MULTIPAGE_ADDRESS_VALUE, receiptPage1.getMerchantAddress().getFieldValue()); assertEquals("Bilbo Baggins", receiptPage1.getMerchantName().getFieldValue()); assertEquals(EXPECTED_MULTIPAGE_PHONE_NUMBER_VALUE, receiptPage1.getMerchantPhoneNumber().getFieldValue()); @@ -553,11 +553,11 @@ static void validateMultipageReceiptData(List recognizedRecei assertEquals(1, receipt2Pages.size()); assertEquals(0, receipt2Pages.stream().findFirst().get().getTables().size()); assertEquals(0, receipt2Pages.stream().findFirst().get().getLines().size()); - assertEquals(2, receiptPage2.getRecognizedForm().getPageRange().getStartPageNumber()); - assertEquals(2, receiptPage2.getRecognizedForm().getPageRange().getEndPageNumber()); + assertEquals(2, receiptPage2.getRecognizedForm().getFormPageRange().getFirstPageNumber()); + assertEquals(2, receiptPage2.getRecognizedForm().getFormPageRange().getLastPageNumber()); - assertEquals(3, receiptPage3.getRecognizedForm().getPageRange().getStartPageNumber()); - assertEquals(3, receiptPage3.getRecognizedForm().getPageRange().getEndPageNumber()); + assertEquals(3, receiptPage3.getRecognizedForm().getFormPageRange().getFirstPageNumber()); + assertEquals(3, receiptPage3.getRecognizedForm().getFormPageRange().getLastPageNumber()); assertEquals(EXPECTED_MULTIPAGE_ADDRESS_VALUE, receiptPage3.getMerchantAddress().getFieldValue()); assertEquals("Frodo Baggins", receiptPage3.getMerchantName().getFieldValue()); assertEquals(EXPECTED_MULTIPAGE_PHONE_NUMBER_VALUE, receiptPage3.getMerchantPhoneNumber().getFieldValue()); diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/getModelInfos.json b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/listCustomModels.json similarity index 100% rename from sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/getModelInfos.json rename to sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/listCustomModels.json diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/getModelInfosWithContext.json b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/listCustomModelsWithContext.json similarity index 100% rename from sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/getModelInfosWithContext.json rename to sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/listCustomModelsWithContext.json From a70a9518bbc9aa841a06f4e8ab3951fb91705726 Mon Sep 17 00:00:00 2001 From: Sameeksha Vaity Date: Thu, 28 May 2020 17:09:48 -0700 Subject: [PATCH 3/3] udpate javadoc --- .../azure-ai-formrecognizer/CHANGELOG.md | 2 ++ .../ai/formrecognizer/models/CustomFormModel.java | 14 +++++++------- .../formrecognizer/models/CustomFormModelInfo.java | 10 +++++----- .../ai/formrecognizer/models/FormPageRange.java | 6 +++--- .../ai/formrecognizer/models/RecognizedForm.java | 4 ++-- 5 files changed, 19 insertions(+), 17 deletions(-) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/CHANGELOG.md b/sdk/formrecognizer/azure-ai-formrecognizer/CHANGELOG.md index 419a919491e0..e6682ec7c0e7 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/CHANGELOG.md +++ b/sdk/formrecognizer/azure-ai-formrecognizer/CHANGELOG.md @@ -8,6 +8,8 @@ `CustomFormModelInfo` model - Rename model `CustomFormSubModel` to `CustomFormSubmodel` - Rename `subModels` property on CustomFormModel to `submodels` +- Add `pageNumber` property to `FormPage` and `FormTable` model +- Remove `pageNumber` property from `FormField` model - Update FormRecognizer API calls to return a `List` instead of `IterableStream`. - Fix bug in FormRecognizer API's to support multipage document recognition. - Add `getFormRecognizerClient()` and `getFormRecognizerAsyncClient()` in FormTrainingClient and FormTrainingAsyncClient diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/CustomFormModel.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/CustomFormModel.java index f0e6a6f2fca3..6fdba56d021e 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/CustomFormModel.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/CustomFormModel.java @@ -79,7 +79,7 @@ public CustomFormModel(final String modelId, final CustomFormModelStatus modelSt /** * Get the Model identifier. * - * @return the modelId value. + * @return the {@code modelId} value. */ public String getModelId() { return this.modelId; @@ -88,7 +88,7 @@ public String getModelId() { /** * Get the status of the model. * - * @return the status value. + * @return the {@code modelStatus} value. */ public CustomFormModelStatus getModelStatus() { return this.modelStatus; @@ -97,7 +97,7 @@ public CustomFormModelStatus getModelStatus() { /** * Get the Date and time (UTC) when the training model was requested. * - * @return the requestedOn value. + * @return the {@code requestedOn} value. */ public OffsetDateTime getRequestedOn() { return this.requestedOn; @@ -106,7 +106,7 @@ public OffsetDateTime getRequestedOn() { /** * Get the Date and time (UTC) when the model training was completed. * - * @return the completedOn value. + * @return the {@code completedOn} value. */ public OffsetDateTime getCompletedOn() { return this.completedOn; @@ -115,7 +115,7 @@ public OffsetDateTime getCompletedOn() { /** * Get the errors returned during the training operation. * - * @return the errors value. + * @return the {@code modelError} value. */ public List getModelError() { return this.modelError; @@ -125,7 +125,7 @@ public List getModelError() { * Get the list of sub model that are part of this model, each of which can recognize * and extract fields from a different type of form. * - * @return the sub models value. + * @return the {@code submodels} value. */ public IterableStream getSubmodels() { return this.submodels; @@ -134,7 +134,7 @@ public IterableStream getSubmodels() { /** * Get the list of the documents used to train the model and any errors reported in each document. * - * @return the trainingDocuments value. + * @return the {@code trainingDocuments} value. */ public List getTrainingDocuments() { return this.trainingDocuments; diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/CustomFormModelInfo.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/CustomFormModelInfo.java index 38a49ffb3dfd..1e17b0e992c7 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/CustomFormModelInfo.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/CustomFormModelInfo.java @@ -34,7 +34,7 @@ public final class CustomFormModelInfo { private final OffsetDateTime completedOn; /** - * Constructs a {@link CustomFormModelInfo} box object. + * Constructs a {@link CustomFormModelInfo} object. * * @param modelId The model identifier. * @param status The status of the model. @@ -52,7 +52,7 @@ public CustomFormModelInfo(final String modelId, final CustomFormModelStatus sta /** * Get the model identifier. * - * @return the modelId value. + * @return the {@code modelId} value. */ public String getModelId() { return this.modelId; @@ -61,7 +61,7 @@ public String getModelId() { /** * Get the Status of the model. * - * @return the status value. + * @return the {@code status} value. */ public CustomFormModelStatus getStatus() { return this.status; @@ -70,7 +70,7 @@ public CustomFormModelStatus getStatus() { /** * Get the date and time (UTC) when the training was requested. * - * @return the requestedOn value. + * @return the {@code requestedOn} value. */ public OffsetDateTime getRequestedOn() { return this.requestedOn; @@ -79,7 +79,7 @@ public OffsetDateTime getRequestedOn() { /** * Get the date and time (UTC) when the model training was completed. * - * @return the completedOn value. + * @return the {@code completedOn} value. */ public OffsetDateTime getCompletedOn() { return this.completedOn; diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/FormPageRange.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/FormPageRange.java index 97a5e77aeb02..42bb00d8278d 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/FormPageRange.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/FormPageRange.java @@ -6,7 +6,7 @@ import com.azure.core.annotation.Immutable; /** - * The PageRange model. + * The FormPageRange model. */ @Immutable public final class FormPageRange { @@ -23,7 +23,7 @@ public final class FormPageRange { /** - * Construct a PageRange object. + * Construct a FormPageRange object. * * @param firstPageNumber The first page number of the range. * @param lastPageNumber The first page number of the range.. @@ -34,7 +34,7 @@ public FormPageRange(final int firstPageNumber, final int lastPageNumber) { } /** - * Get the first page number. + * Get the first page number of the range. * * @return the first page number of the range. */ diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/RecognizedForm.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/RecognizedForm.java index 192a470616ec..529a1e663bf0 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/RecognizedForm.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/RecognizedForm.java @@ -42,8 +42,8 @@ public final class RecognizedForm { * @param formPageRange First and last page number where the document is found. * @param pages List of extracted pages from the form. */ - public RecognizedForm(final Map> fields, final String formType, final FormPageRange formPageRange, - final List pages) { + public RecognizedForm(final Map> fields, final String formType, + final FormPageRange formPageRange, final List pages) { this.fields = fields; this.formType = formType; this.formPageRange = formPageRange;