Skip to content

Commit

Permalink
Form recognizer 06-30-preview (#29169)
Browse files Browse the repository at this point in the history
  • Loading branch information
samvaity authored Jun 7, 2022
1 parent 2cadcdc commit a50a808
Show file tree
Hide file tree
Showing 250 changed files with 6,828 additions and 11,564 deletions.
12 changes: 10 additions & 2 deletions sdk/formrecognizer/azure-ai-formrecognizer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,20 @@
## 4.0.0-beta.5 (Unreleased)

### Features Added
- Added support for address type field value.
- Added support for vertex coordinates with model `Point` to represent polygon vertices in `boundingPolygon` property.
- Added `paragraphs` property on `AnalyzeResult`.
- Added a new `DocumentParagraph` model to represent document paragraphs.
- Added `caption` and `footnotes` properties on `DocumentTable`.
- Added `DocumentCaption` and `DocumentFootnote` models to represent captions and footnotes found in the document.

### Breaking Changes
- Renamed `modelIDs` in method `beginCreateComposedModel` to `componentModelIds`
- Renamed method `beginCopyModel` to `beginCopyModelTo`
- Removed `modelId` as a required parameter from `beginBuildModel`, `beginCreateComposedModel` and `getCopyAuthorization`
and moved to `BuildModelOptions`, `CreateComposedModelOptions` and `CopyAuthorizationOptions` respectively
- Renamed property `boundingBox` in model `BoundingRegion`, `DocumentLine`, `DocumentWord`, and `DocumentSelectionMark`
to `boundingPolygon`.
- Removed `entities` property on model `AnalyzeResult`
- Renamed `code` property on `DocumentLanguage` model to `locale`

### Bugs Fixed

Expand Down
8 changes: 4 additions & 4 deletions sdk/formrecognizer/azure-ai-formrecognizer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,13 +265,13 @@ analyzeLayoutResult.getPages().forEach(documentPage -> {
documentPage.getLines().forEach(documentLine ->
System.out.printf("Line '%s' is within a bounding box %s.%n",
documentLine.getContent(),
documentLine.getBoundingBox().toString()));
documentLine.getBoundingPolygon().toString()));

// selection marks
documentPage.getSelectionMarks().forEach(documentSelectionMark ->
System.out.printf("Selection mark is '%s' and is within a bounding box %s with confidence %.2f.%n",
documentSelectionMark.getState().toString(),
documentSelectionMark.getBoundingBox().toString(),
documentSelectionMark.getBoundingPolygon().toString(),
documentSelectionMark.getConfidence()));
});

Expand Down Expand Up @@ -391,7 +391,7 @@ String trainingFilesUrl = "{SAS_URL_of_your_container_in_blob_storage}";
SyncPoller<DocumentOperationResult, DocumentModel> buildOperationPoller =
documentModelAdminClient.beginBuildModel(trainingFilesUrl,
DocumentBuildMode.TEMPLATE,
new BuildModelOptions().setDescription("model desc"), Context.NONE);
new BuildModelOptions().setModelId("my-build-model").setDescription("model desc"), Context.NONE);

DocumentModel documentModel = buildOperationPoller.getFinalResult();

Expand Down Expand Up @@ -445,7 +445,7 @@ analyzeResult.getPages().forEach(documentPage -> {
documentPage.getLines().forEach(documentLine ->
System.out.printf("Line '%s' is within a bounding box %s.%n",
documentLine.getContent(),
documentLine.getBoundingBox().toString()));
documentLine.getBoundingPolygon().toString()));

// words
documentPage.getWords().forEach(documentWord ->
Expand Down
18 changes: 5 additions & 13 deletions sdk/formrecognizer/azure-ai-formrecognizer/migration-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -302,13 +302,13 @@ analyzeLayoutResult.getPages().forEach(documentPage -> {
documentPage.getLines().forEach(documentLine ->
System.out.printf("Line '%s' is within a bounding box %s.%n",
documentLine.getContent(),
documentLine.getBoundingBox().toString()));
documentLine.getBoundingPolygon().toString()));

// selection marks
documentPage.getSelectionMarks().forEach(documentSelectionMark ->
System.out.printf("Selection mark is '%s' and is within a bounding box %s with confidence %.2f.%n",
documentSelectionMark.getState().toString(),
documentSelectionMark.getBoundingBox().toString(),
documentSelectionMark.getBoundingPolygon().toString(),
documentSelectionMark.getConfidence()));
});

Expand Down Expand Up @@ -382,7 +382,7 @@ analyzeResult.getPages().forEach(documentPage -> {
documentPage.getLines().forEach(documentLine ->
System.out.printf("Line '%s' is within a bounding box %s.%n",
documentLine.getContent(),
documentLine.getBoundingBox().toString()));
documentLine.getBoundingPolygon().toString()));

// words
documentPage.getWords().forEach(documentWord ->
Expand Down Expand Up @@ -433,7 +433,7 @@ analyzeResult.getPages().forEach(documentPage -> {
documentPage.getLines().forEach(documentLine ->
System.out.printf("Line '%s' is within a bounding box %s.%n",
documentLine.getContent(),
documentLine.getBoundingBox().toString()));
documentLine.getBoundingPolygon().toString()));

// words
documentPage.getWords().forEach(documentWord ->
Expand All @@ -456,14 +456,6 @@ for (int i = 0; i < tables.size(); i++) {
System.out.println();
}

// Entities
analyzeResult.getEntities().forEach(documentEntity -> {
System.out.printf("Entity category : %s, sub-category %s%n: ",
documentEntity.getCategory(), documentEntity.getSubCategory());
System.out.printf("Entity content: %s%n: ", documentEntity.getContent());
System.out.printf("Entity confidence: %.2f%n", documentEntity.getConfidence());
});

// Key-value
analyzeResult.getKeyValuePairs().forEach(documentKeyValuePair -> {
System.out.printf("Key content: %s%n", documentKeyValuePair.getKey().getContent());
Expand Down Expand Up @@ -533,7 +525,7 @@ String trainingFilesUrl = "{SAS_URL_of_your_container_in_blob_storage}";
SyncPoller<DocumentOperationResult, DocumentModel> buildOperationPoller =
documentModelAdminClient.beginBuildModel(trainingFilesUrl,
DocumentBuildMode.TEMPLATE,
new BuildModelOptions().setDescription("model desc"), Context.NONE);
new BuildModelOptions().setModelId("my-build-model").setDescription("model desc"), Context.NONE);

DocumentModel documentModel = buildOperationPoller.getFinalResult();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,16 @@
*/
public enum DocumentAnalysisServiceVersion implements ServiceVersion {
/**
* Service version {@code 2022-01-30-preview}.
* Service version {@code 2022-06-30-preview}.
*/
V2022_01_30_PREVIEW("2022-01-30-preview");
V2022_06_30_PREVIEW("2022-06-30-preview");

private final String version;

DocumentAnalysisServiceVersion(String version) {
this.version = version;
}


/** {@inheritDoc} */
@Override
public String getVersion() {
Expand All @@ -33,6 +32,6 @@ public String getVersion() {
* @return the latest {@link DocumentAnalysisServiceVersion}
*/
public static DocumentAnalysisServiceVersion getLatest() {
return V2022_01_30_PREVIEW;
return V2022_06_30_PREVIEW;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ Mono<Response<CopyAuthorization>> getCopyAuthorizationWithResponse(
* </pre>
* <!-- end com.azure.ai.formrecognizer.administration.DocumentModelAdministrationAsyncClient.beginCreateComposedModel#list -->
*
* @param componentModelIDs The list of component models to compose.
* @param componentModelIds The list of component models to compose.
* @return A {@link PollerFlux} that polls the create composed model operation until it has completed, has failed,
* or has been cancelled. The completed operation returns the created {@link DocumentModel composed model}.
* @throws DocumentModelOperationException If create composed model operation fails and model with
Expand All @@ -504,8 +504,8 @@ Mono<Response<CopyAuthorization>> getCopyAuthorizationWithResponse(
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux<DocumentOperationResult, DocumentModel> beginCreateComposedModel(
List<String> componentModelIDs) {
return beginCreateComposedModel(componentModelIDs, null);
List<String> componentModelIds) {
return beginCreateComposedModel(componentModelIds, null);
}

/**
Expand Down Expand Up @@ -549,7 +549,7 @@ public PollerFlux<DocumentOperationResult, DocumentModel> beginCreateComposedMod
* </pre>
* <!-- end com.azure.ai.formrecognizer.administration.DocumentModelAdministrationAsyncClient.beginCreateComposedModel#list-createComposedModelOptions -->
*
* @param componentModelIDs The list of component models to compose.
* @param componentModelIds The list of component models to compose.
* @param createComposedModelOptions The configurable {@link CreateComposedModelOptions options} to pass when
* creating a composed model.
* @return A {@link PollerFlux} that polls the create composed model operation until it has completed, has failed,
Expand All @@ -559,16 +559,16 @@ public PollerFlux<DocumentOperationResult, DocumentModel> beginCreateComposedMod
* @throws NullPointerException If the list of {@code modelIDs} is null or empty.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux<DocumentOperationResult, DocumentModel> beginCreateComposedModel(List<String> componentModelIDs,
public PollerFlux<DocumentOperationResult, DocumentModel> beginCreateComposedModel(List<String> componentModelIds,
CreateComposedModelOptions createComposedModelOptions) {
return beginCreateComposedModel(componentModelIDs, createComposedModelOptions, Context.NONE);
return beginCreateComposedModel(componentModelIds, createComposedModelOptions, Context.NONE);
}

PollerFlux<DocumentOperationResult, DocumentModel> beginCreateComposedModel(List<String> componentModelIDs,
PollerFlux<DocumentOperationResult, DocumentModel> beginCreateComposedModel(List<String> componentModelIds,
CreateComposedModelOptions createComposedModelOptions, Context context) {
try {
if (CoreUtils.isNullOrEmpty(componentModelIDs)) {
throw logger.logExceptionAsError(new NullPointerException("'componentModelIDs' cannot be null or empty"));
if (CoreUtils.isNullOrEmpty(componentModelIds)) {
throw logger.logExceptionAsError(new NullPointerException("'componentModelIds' cannot be null or empty"));
}
createComposedModelOptions = createComposedModelOptions == null
? new CreateComposedModelOptions() : createComposedModelOptions;
Expand All @@ -579,7 +579,7 @@ PollerFlux<DocumentOperationResult, DocumentModel> beginCreateComposedModel(List
createComposedModelOptions = getCreateComposeModelOptions(createComposedModelOptions);

final ComposeDocumentModelRequest composeRequest = new ComposeDocumentModelRequest()
.setComponentModels(componentModelIDs.stream()
.setComponentModels(componentModelIds.stream()
.map(modelIdString -> new ComponentModelInfo().setModelId(modelIdString))
.collect(Collectors.toList()))
.setModelId(modelId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ public Response<CopyAuthorization> getCopyAuthorizationWithResponse(
* </pre>
* <!-- end com.azure.ai.formrecognizer.administration.DocumentModelAdministrationClient.beginCreateComposedModel#list -->
*
* @param componentModelIDs The list of models IDs to form the composed model.
* @param componentModelIds The list of models IDs to form the composed model.
* @return A {@link SyncPoller} that polls the create composed model operation until it has completed, has failed,
* or has been cancelled. The completed operation returns the {@link DocumentModel composed model}.
* @throws DocumentModelOperationException If create composed model operation fails and model with
Expand All @@ -377,8 +377,8 @@ public Response<CopyAuthorization> getCopyAuthorizationWithResponse(
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller<DocumentOperationResult, DocumentModel> beginCreateComposedModel(
List<String> componentModelIDs) {
return beginCreateComposedModel(componentModelIDs, null, Context.NONE);
List<String> componentModelIds) {
return beginCreateComposedModel(componentModelIds, null, Context.NONE);
}

/**
Expand Down Expand Up @@ -423,7 +423,7 @@ public SyncPoller<DocumentOperationResult, DocumentModel> beginCreateComposedMod
* </pre>
* <!-- end com.azure.ai.formrecognizer.administration.DocumentModelAdministrationClient.beginCreateComposedModel#list-CreateComposedModelOptions-Context -->
*
* @param componentModelIDs The list of models IDs to form the composed model.
* @param componentModelIds The list of models IDs to form the composed model.
* @param createComposedModelOptions The configurable {@link CreateComposedModelOptions options} to pass when
* creating a composed model.
* @param context Additional context that is passed through the HTTP pipeline during the service call.
Expand All @@ -436,9 +436,9 @@ public SyncPoller<DocumentOperationResult, DocumentModel> beginCreateComposedMod
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller<DocumentOperationResult, DocumentModel> beginCreateComposedModel(
List<String> componentModelIDs, CreateComposedModelOptions createComposedModelOptions,
List<String> componentModelIds, CreateComposedModelOptions createComposedModelOptions,
Context context) {
return client.beginCreateComposedModel(componentModelIDs, createComposedModelOptions, context).getSyncPoller();
return client.beginCreateComposedModel(componentModelIds, createComposedModelOptions, context).getSyncPoller();
}

/**
Expand Down
Loading

0 comments on commit a50a808

Please sign in to comment.