Package com.google.cloud.documentai.v1beta2 (2.7.2)

The interfaces provided are listed below, along with usage samples.

DocumentUnderstandingServiceClient

Service Description: Service to parse structured information from unstructured or semi-structured documents using state-of-the-art Google AI such as natural language, computer vision, and translation.

Sample for DocumentUnderstandingServiceClient:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (DocumentUnderstandingServiceClient documentUnderstandingServiceClient =
     DocumentUnderstandingServiceClient.create()) {
   ProcessDocumentRequest request =
       ProcessDocumentRequest.newBuilder()
           .setParent("parent-995424086")
           .setInputConfig(InputConfig.newBuilder().build())
           .setOutputConfig(OutputConfig.newBuilder().build())
           .setDocumentType("documentType-1473196299")
           .setTableExtractionParams(TableExtractionParams.newBuilder().build())
           .setFormExtractionParams(FormExtractionParams.newBuilder().build())
           .setEntityExtractionParams(EntityExtractionParams.newBuilder().build())
           .setOcrParams(OcrParams.newBuilder().build())
           .setAutomlParams(AutoMlParams.newBuilder().build())
           .build();
   Document response = documentUnderstandingServiceClient.processDocument(request);
 }
 

Classes

AutoMlParams

Parameters to control AutoML model prediction behavior.

Protobuf type google.cloud.documentai.v1beta2.AutoMlParams

AutoMlParams.Builder

Parameters to control AutoML model prediction behavior.

Protobuf type google.cloud.documentai.v1beta2.AutoMlParams

BatchProcessDocumentsRequest

Request to batch process documents as an asynchronous operation. The output is written to Cloud Storage as JSON in the [Document] format.

Protobuf type google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest

BatchProcessDocumentsRequest.Builder

Request to batch process documents as an asynchronous operation. The output is written to Cloud Storage as JSON in the [Document] format.

Protobuf type google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest

BatchProcessDocumentsResponse

Response to an batch document processing request. This is returned in the LRO Operation after the operation is complete.

Protobuf type google.cloud.documentai.v1beta2.BatchProcessDocumentsResponse

BatchProcessDocumentsResponse.Builder

Response to an batch document processing request. This is returned in the LRO Operation after the operation is complete.

Protobuf type google.cloud.documentai.v1beta2.BatchProcessDocumentsResponse

BoundingPoly

A bounding polygon for the detected image annotation.

Protobuf type google.cloud.documentai.v1beta2.BoundingPoly

BoundingPoly.Builder

A bounding polygon for the detected image annotation.

Protobuf type google.cloud.documentai.v1beta2.BoundingPoly

Document

Document represents the canonical document resource in Document Understanding AI. It is an interchange format that provides insights into documents and allows for collaboration between users and Document Understanding AI to iterate and optimize for quality.

Protobuf type google.cloud.documentai.v1beta2.Document

Document.Builder

Document represents the canonical document resource in Document Understanding AI. It is an interchange format that provides insights into documents and allows for collaboration between users and Document Understanding AI to iterate and optimize for quality.

Protobuf type google.cloud.documentai.v1beta2.Document

Document.Entity

A phrase in the text that is a known entity type, such as a person, an organization, or location.

Protobuf type google.cloud.documentai.v1beta2.Document.Entity

Document.Entity.Builder

A phrase in the text that is a known entity type, such as a person, an organization, or location.

Protobuf type google.cloud.documentai.v1beta2.Document.Entity

Document.EntityRelation

Relationship between Entities.

Protobuf type google.cloud.documentai.v1beta2.Document.EntityRelation

Document.EntityRelation.Builder

Relationship between Entities.

Protobuf type google.cloud.documentai.v1beta2.Document.EntityRelation

Document.Label

Label attaches schema information and/or other metadata to segments within a Document. Multiple Labels on a single field can denote either different labels, different instances of the same label created at different times, or some combination of both.

Protobuf type google.cloud.documentai.v1beta2.Document.Label

Document.Label.Builder

Label attaches schema information and/or other metadata to segments within a Document. Multiple Labels on a single field can denote either different labels, different instances of the same label created at different times, or some combination of both.

Protobuf type google.cloud.documentai.v1beta2.Document.Label

Document.Page

A page in a Document.

Protobuf type google.cloud.documentai.v1beta2.Document.Page

Document.Page.Block

A block has a set of lines (collected into paragraphs) that have a common line-spacing and orientation.

Protobuf type google.cloud.documentai.v1beta2.Document.Page.Block

Document.Page.Block.Builder

A block has a set of lines (collected into paragraphs) that have a common line-spacing and orientation.

Protobuf type google.cloud.documentai.v1beta2.Document.Page.Block

Document.Page.Builder

A page in a Document.

Protobuf type google.cloud.documentai.v1beta2.Document.Page

Document.Page.DetectedLanguage

Detected language for a structural component.

Protobuf type google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage

Document.Page.DetectedLanguage.Builder

Detected language for a structural component.

Protobuf type google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage

Document.Page.Dimension

Dimension for the page.

Protobuf type google.cloud.documentai.v1beta2.Document.Page.Dimension

Document.Page.Dimension.Builder

Dimension for the page.

Protobuf type google.cloud.documentai.v1beta2.Document.Page.Dimension

Document.Page.FormField

A form field detected on the page.

Protobuf type google.cloud.documentai.v1beta2.Document.Page.FormField

Document.Page.FormField.Builder

A form field detected on the page.

Protobuf type google.cloud.documentai.v1beta2.Document.Page.FormField

Document.Page.Layout

Visual element describing a layout unit on a page.

Protobuf type google.cloud.documentai.v1beta2.Document.Page.Layout

Document.Page.Layout.Builder

Visual element describing a layout unit on a page.

Protobuf type google.cloud.documentai.v1beta2.Document.Page.Layout

Document.Page.Line

A collection of tokens that a human would perceive as a line. Does not cross column boundaries, can be horizontal, vertical, etc.

Protobuf type google.cloud.documentai.v1beta2.Document.Page.Line

Document.Page.Line.Builder

A collection of tokens that a human would perceive as a line. Does not cross column boundaries, can be horizontal, vertical, etc.

Protobuf type google.cloud.documentai.v1beta2.Document.Page.Line

Document.Page.Paragraph

A collection of lines that a human would perceive as a paragraph.

Protobuf type google.cloud.documentai.v1beta2.Document.Page.Paragraph

Document.Page.Paragraph.Builder

A collection of lines that a human would perceive as a paragraph.

Protobuf type google.cloud.documentai.v1beta2.Document.Page.Paragraph

Document.Page.Table

A table representation similar to HTML table structure.

Protobuf type google.cloud.documentai.v1beta2.Document.Page.Table

Document.Page.Table.Builder

A table representation similar to HTML table structure.

Protobuf type google.cloud.documentai.v1beta2.Document.Page.Table

Document.Page.Table.TableCell

A cell representation inside the table.

Protobuf type google.cloud.documentai.v1beta2.Document.Page.Table.TableCell

Document.Page.Table.TableCell.Builder

A cell representation inside the table.

Protobuf type google.cloud.documentai.v1beta2.Document.Page.Table.TableCell

Document.Page.Table.TableRow

A row of table cells.

Protobuf type google.cloud.documentai.v1beta2.Document.Page.Table.TableRow

Document.Page.Table.TableRow.Builder

A row of table cells.

Protobuf type google.cloud.documentai.v1beta2.Document.Page.Table.TableRow

Document.Page.Token

A detected token.

Protobuf type google.cloud.documentai.v1beta2.Document.Page.Token

Document.Page.Token.Builder

A detected token.

Protobuf type google.cloud.documentai.v1beta2.Document.Page.Token

Document.Page.Token.DetectedBreak

Detected break at the end of a Token.

Protobuf type google.cloud.documentai.v1beta2.Document.Page.Token.DetectedBreak

Document.Page.Token.DetectedBreak.Builder

Detected break at the end of a Token.

Protobuf type google.cloud.documentai.v1beta2.Document.Page.Token.DetectedBreak

Document.Page.VisualElement

Detected non-text visual elements e.g. checkbox, signature etc. on the page.

Protobuf type google.cloud.documentai.v1beta2.Document.Page.VisualElement

Document.Page.VisualElement.Builder

Detected non-text visual elements e.g. checkbox, signature etc. on the page.

Protobuf type google.cloud.documentai.v1beta2.Document.Page.VisualElement

Document.PageAnchor

Referencing elements in Document.pages.

Protobuf type google.cloud.documentai.v1beta2.Document.PageAnchor

Document.PageAnchor.Builder

Referencing elements in Document.pages.

Protobuf type google.cloud.documentai.v1beta2.Document.PageAnchor

Document.PageAnchor.PageRef

Represents a weak reference to a page element within a document.

Protobuf type google.cloud.documentai.v1beta2.Document.PageAnchor.PageRef

Document.PageAnchor.PageRef.Builder

Represents a weak reference to a page element within a document.

Protobuf type google.cloud.documentai.v1beta2.Document.PageAnchor.PageRef

Document.ShardInfo

For a large document, sharding may be performed to produce several document shards. Each document shard contains this field to detail which shard it is.

Protobuf type google.cloud.documentai.v1beta2.Document.ShardInfo

Document.ShardInfo.Builder

For a large document, sharding may be performed to produce several document shards. Each document shard contains this field to detail which shard it is.

Protobuf type google.cloud.documentai.v1beta2.Document.ShardInfo

Document.Style

Annotation for common text style attributes. This adheres to CSS conventions as much as possible.

Protobuf type google.cloud.documentai.v1beta2.Document.Style

Document.Style.Builder

Annotation for common text style attributes. This adheres to CSS conventions as much as possible.

Protobuf type google.cloud.documentai.v1beta2.Document.Style

Document.Style.FontSize

Font size with unit.

Protobuf type google.cloud.documentai.v1beta2.Document.Style.FontSize

Document.Style.FontSize.Builder

Font size with unit.

Protobuf type google.cloud.documentai.v1beta2.Document.Style.FontSize

Document.TextAnchor

Text reference indexing into the Document.text.

Protobuf type google.cloud.documentai.v1beta2.Document.TextAnchor

Document.TextAnchor.Builder

Text reference indexing into the Document.text.

Protobuf type google.cloud.documentai.v1beta2.Document.TextAnchor

Document.TextAnchor.TextSegment

A text segment in the Document.text. The indices may be out of bounds which indicate that the text extends into another document shard for large sharded documents. See ShardInfo.text_offset

Protobuf type google.cloud.documentai.v1beta2.Document.TextAnchor.TextSegment

Document.TextAnchor.TextSegment.Builder

A text segment in the Document.text. The indices may be out of bounds which indicate that the text extends into another document shard for large sharded documents. See ShardInfo.text_offset

Protobuf type google.cloud.documentai.v1beta2.Document.TextAnchor.TextSegment

DocumentAiProto

DocumentProto

DocumentUnderstandingServiceClient

Service Description: Service to parse structured information from unstructured or semi-structured documents using state-of-the-art Google AI such as natural language, computer vision, and translation.

This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (DocumentUnderstandingServiceClient documentUnderstandingServiceClient =
     DocumentUnderstandingServiceClient.create()) {
   ProcessDocumentRequest request =
       ProcessDocumentRequest.newBuilder()
           .setParent("parent-995424086")
           .setInputConfig(InputConfig.newBuilder().build())
           .setOutputConfig(OutputConfig.newBuilder().build())
           .setDocumentType("documentType-1473196299")
           .setTableExtractionParams(TableExtractionParams.newBuilder().build())
           .setFormExtractionParams(FormExtractionParams.newBuilder().build())
           .setEntityExtractionParams(EntityExtractionParams.newBuilder().build())
           .setOcrParams(OcrParams.newBuilder().build())
           .setAutomlParams(AutoMlParams.newBuilder().build())
           .build();
   Document response = documentUnderstandingServiceClient.processDocument(request);
 }
 

Note: close() needs to be called on the DocumentUnderstandingServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

The surface of this class includes several types of Java methods for each of the API's methods:

  1. A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
  2. A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
  3. A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.

See the individual methods for example code.

Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.

This class can be customized by passing in a custom instance of DocumentUnderstandingServiceSettings to create(). For example:

To customize credentials:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 DocumentUnderstandingServiceSettings documentUnderstandingServiceSettings =
     DocumentUnderstandingServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 DocumentUnderstandingServiceClient documentUnderstandingServiceClient =
     DocumentUnderstandingServiceClient.create(documentUnderstandingServiceSettings);
 

To customize the endpoint:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 DocumentUnderstandingServiceSettings documentUnderstandingServiceSettings =
     DocumentUnderstandingServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 DocumentUnderstandingServiceClient documentUnderstandingServiceClient =
     DocumentUnderstandingServiceClient.create(documentUnderstandingServiceSettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

DocumentUnderstandingServiceGrpc

Service to parse structured information from unstructured or semi-structured documents using state-of-the-art Google AI such as natural language, computer vision, and translation.

DocumentUnderstandingServiceGrpc.DocumentUnderstandingServiceBlockingStub

Service to parse structured information from unstructured or semi-structured documents using state-of-the-art Google AI such as natural language, computer vision, and translation.

DocumentUnderstandingServiceGrpc.DocumentUnderstandingServiceFutureStub

Service to parse structured information from unstructured or semi-structured documents using state-of-the-art Google AI such as natural language, computer vision, and translation.

DocumentUnderstandingServiceGrpc.DocumentUnderstandingServiceImplBase

Service to parse structured information from unstructured or semi-structured documents using state-of-the-art Google AI such as natural language, computer vision, and translation.

DocumentUnderstandingServiceGrpc.DocumentUnderstandingServiceStub

Service to parse structured information from unstructured or semi-structured documents using state-of-the-art Google AI such as natural language, computer vision, and translation.

DocumentUnderstandingServiceSettings

Settings class to configure an instance of DocumentUnderstandingServiceClient.

The default instance has everything set to sensible defaults:

  • The default service address (documentai.googleapis.com) and default port (443) are used.
  • Credentials are acquired automatically through Application Default Credentials.
  • Retries are configured for idempotent methods but not for non-idempotent methods.

The builder of this class is recursive, so contained classes are themselves builders. When build() is called, the tree of builders is called to create the complete settings object.

For example, to set the total timeout of processDocument to 30 seconds:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 DocumentUnderstandingServiceSettings.Builder documentUnderstandingServiceSettingsBuilder =
     DocumentUnderstandingServiceSettings.newBuilder();
 documentUnderstandingServiceSettingsBuilder
     .processDocumentSettings()
     .setRetrySettings(
         documentUnderstandingServiceSettingsBuilder
             .processDocumentSettings()
             .getRetrySettings()
             .toBuilder()
             .setTotalTimeout(Duration.ofSeconds(30))
             .build());
 DocumentUnderstandingServiceSettings documentUnderstandingServiceSettings =
     documentUnderstandingServiceSettingsBuilder.build();
 

DocumentUnderstandingServiceSettings.Builder

Builder for DocumentUnderstandingServiceSettings.

EntityExtractionParams

Parameters to control entity extraction behavior.

Protobuf type google.cloud.documentai.v1beta2.EntityExtractionParams

EntityExtractionParams.Builder

Parameters to control entity extraction behavior.

Protobuf type google.cloud.documentai.v1beta2.EntityExtractionParams

FormExtractionParams

Parameters to control form extraction behavior.

Protobuf type google.cloud.documentai.v1beta2.FormExtractionParams

FormExtractionParams.Builder

Parameters to control form extraction behavior.

Protobuf type google.cloud.documentai.v1beta2.FormExtractionParams

GcsDestination

The Google Cloud Storage location where the output file will be written to.

Protobuf type google.cloud.documentai.v1beta2.GcsDestination

GcsDestination.Builder

The Google Cloud Storage location where the output file will be written to.

Protobuf type google.cloud.documentai.v1beta2.GcsDestination

GcsSource

The Google Cloud Storage location where the input file will be read from.

Protobuf type google.cloud.documentai.v1beta2.GcsSource

GcsSource.Builder

The Google Cloud Storage location where the input file will be read from.

Protobuf type google.cloud.documentai.v1beta2.GcsSource

GeometryProto

InputConfig

The desired input location and metadata.

Protobuf type google.cloud.documentai.v1beta2.InputConfig

InputConfig.Builder

The desired input location and metadata.

Protobuf type google.cloud.documentai.v1beta2.InputConfig

KeyValuePairHint

User-provided hint for key value pair.

Protobuf type google.cloud.documentai.v1beta2.KeyValuePairHint

KeyValuePairHint.Builder

User-provided hint for key value pair.

Protobuf type google.cloud.documentai.v1beta2.KeyValuePairHint

NormalizedVertex

A vertex represents a 2D point in the image. NOTE: the normalized vertex coordinates are relative to the original image and range from 0 to 1.

Protobuf type google.cloud.documentai.v1beta2.NormalizedVertex

NormalizedVertex.Builder

A vertex represents a 2D point in the image. NOTE: the normalized vertex coordinates are relative to the original image and range from 0 to 1.

Protobuf type google.cloud.documentai.v1beta2.NormalizedVertex

OcrParams

Parameters to control Optical Character Recognition (OCR) behavior.

Protobuf type google.cloud.documentai.v1beta2.OcrParams

OcrParams.Builder

Parameters to control Optical Character Recognition (OCR) behavior.

Protobuf type google.cloud.documentai.v1beta2.OcrParams

OperationMetadata

Contains metadata for the BatchProcessDocuments operation.

Protobuf type google.cloud.documentai.v1beta2.OperationMetadata

OperationMetadata.Builder

Contains metadata for the BatchProcessDocuments operation.

Protobuf type google.cloud.documentai.v1beta2.OperationMetadata

OutputConfig

The desired output location and metadata.

Protobuf type google.cloud.documentai.v1beta2.OutputConfig

OutputConfig.Builder

The desired output location and metadata.

Protobuf type google.cloud.documentai.v1beta2.OutputConfig

ProcessDocumentRequest

Request to process one document.

Protobuf type google.cloud.documentai.v1beta2.ProcessDocumentRequest

ProcessDocumentRequest.Builder

Request to process one document.

Protobuf type google.cloud.documentai.v1beta2.ProcessDocumentRequest

ProcessDocumentResponse

Response to a single document processing request.

Protobuf type google.cloud.documentai.v1beta2.ProcessDocumentResponse

ProcessDocumentResponse.Builder

Response to a single document processing request.

Protobuf type google.cloud.documentai.v1beta2.ProcessDocumentResponse

TableBoundHint

A hint for a table bounding box on the page for table parsing.

Protobuf type google.cloud.documentai.v1beta2.TableBoundHint

TableBoundHint.Builder

A hint for a table bounding box on the page for table parsing.

Protobuf type google.cloud.documentai.v1beta2.TableBoundHint

TableExtractionParams

Parameters to control table extraction behavior.

Protobuf type google.cloud.documentai.v1beta2.TableExtractionParams

TableExtractionParams.Builder

Parameters to control table extraction behavior.

Protobuf type google.cloud.documentai.v1beta2.TableExtractionParams

Vertex

A vertex represents a 2D point in the image. NOTE: the vertex coordinates are in the same scale as the original image.

Protobuf type google.cloud.documentai.v1beta2.Vertex

Vertex.Builder

A vertex represents a 2D point in the image. NOTE: the vertex coordinates are in the same scale as the original image.

Protobuf type google.cloud.documentai.v1beta2.Vertex

Interfaces

AutoMlParamsOrBuilder

BatchProcessDocumentsRequestOrBuilder

BatchProcessDocumentsResponseOrBuilder

BoundingPolyOrBuilder

Document.EntityOrBuilder

Document.EntityRelationOrBuilder

Document.LabelOrBuilder

Document.Page.BlockOrBuilder

Document.Page.DetectedLanguageOrBuilder

Document.Page.DimensionOrBuilder

Document.Page.FormFieldOrBuilder

Document.Page.LayoutOrBuilder

Document.Page.LineOrBuilder

Document.Page.ParagraphOrBuilder

Document.Page.Table.TableCellOrBuilder

Document.Page.Table.TableRowOrBuilder

Document.Page.TableOrBuilder

Document.Page.Token.DetectedBreakOrBuilder

Document.Page.TokenOrBuilder

Document.Page.VisualElementOrBuilder

Document.PageAnchor.PageRefOrBuilder

Document.PageAnchorOrBuilder

Document.PageOrBuilder

Document.ShardInfoOrBuilder

Document.Style.FontSizeOrBuilder

Document.StyleOrBuilder

Document.TextAnchor.TextSegmentOrBuilder

Document.TextAnchorOrBuilder

DocumentOrBuilder

EntityExtractionParamsOrBuilder

FormExtractionParamsOrBuilder

GcsDestinationOrBuilder

GcsSourceOrBuilder

InputConfigOrBuilder

KeyValuePairHintOrBuilder

NormalizedVertexOrBuilder

OcrParamsOrBuilder

OperationMetadataOrBuilder

OutputConfigOrBuilder

ProcessDocumentRequestOrBuilder

ProcessDocumentResponseOrBuilder

TableBoundHintOrBuilder

TableExtractionParamsOrBuilder

VertexOrBuilder

Enums

Document.Label.SourceCase

Document.Page.Layout.Orientation

Detected human reading orientation.

Protobuf enum google.cloud.documentai.v1beta2.Document.Page.Layout.Orientation

Document.Page.Token.DetectedBreak.Type

Enum to denote the type of break found.

Protobuf enum google.cloud.documentai.v1beta2.Document.Page.Token.DetectedBreak.Type

Document.PageAnchor.PageRef.LayoutType

The type of layout that is being referenced.

Protobuf enum google.cloud.documentai.v1beta2.Document.PageAnchor.PageRef.LayoutType

Document.SourceCase

InputConfig.SourceCase

OperationMetadata.State

Protobuf enum google.cloud.documentai.v1beta2.OperationMetadata.State

OutputConfig.DestinationCase