/* * Copyright 2010-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ package com.amazonaws.services.textract.model; import java.io.Serializable; import com.amazonaws.AmazonWebServiceRequest; /** *
* Analyzes an input document for relationships between detected items. *
** The types of information returned are as follows: *
*
* Form data (key-value pairs). The related information is returned in two
* Block objects, each of type KEY_VALUE_SET
: a KEY
* Block
object and a VALUE Block
object. For example,
* Name: Ana Silva Carolina contains a key and value. Name: is the
* key. Ana Silva Carolina is the value.
*
* Table and table cell data. A TABLE Block
object contains
* information about a detected table. A CELL Block
object is
* returned for each cell in a table.
*
* Lines and words of text. A LINE Block
object contains one or
* more WORD Block
objects. All lines and words that are detected
* in the document are returned (including text that doesn't have a relationship
* with the value of FeatureTypes
).
*
* Signatures. A SIGNATURE Block
object contains the location
* information of a signature in a document. If used in conjunction with forms
* or tables, a signature can be given a Key-Value pairing or be detected in the
* cell of a table.
*
* Query. A QUERY Block object contains the query text, alias and link to the * associated Query results block object. *
** Query Result. A QUERY_RESULT Block object contains the answer to the query * and an ID that connects it to the query asked. This Block also contains a * confidence score. *
*
* Selection elements such as check boxes and option buttons (radio buttons) can
* be detected in form data and in tables. A SELECTION_ELEMENT
* Block
object contains information about a selection element,
* including the selection status.
*
* You can choose which type of analysis to perform by specifying the
* FeatureTypes
list.
*
* The output is returned in a list of Block
objects.
*
* AnalyzeDocument
is a synchronous operation. To analyze documents
* asynchronously, use StartDocumentAnalysis.
*
* For more information, see Document Text Analysis. *
*/ public class AnalyzeDocumentRequest extends AmazonWebServiceRequest implements Serializable { /** ** The input document as base64-encoded bytes or an Amazon S3 object. If you * use the AWS CLI to call Amazon Textract operations, you can't pass image * bytes. The document must be an image in JPEG, PNG, PDF, or TIFF format. *
*
* If you're using an AWS SDK to call Amazon Textract, you might not need to
* base64-encode image bytes that are passed using the Bytes
* field.
*
* A list of the types of analysis to perform. Add TABLES to the list to
* return information about the tables that are detected in the input
* document. Add FORMS to return detected form data. Add SIGNATURES to
* return the locations of detected signatures. To perform both forms and
* table analysis, add TABLES and FORMS to FeatureTypes
. To
* detect signatures within form data and table data, add SIGNATURES to
* either TABLES or FORMS. All lines and words detected in the document are
* included in the response (including text that isn't related to the value
* of FeatureTypes
).
*
* Sets the configuration for the human in the loop workflow for analyzing * documents. *
*/ private HumanLoopConfig humanLoopConfig; /** ** Contains Queries and the alias for those Queries, as determined by the * input. *
*/ private QueriesConfig queriesConfig; /** ** The input document as base64-encoded bytes or an Amazon S3 object. If you * use the AWS CLI to call Amazon Textract operations, you can't pass image * bytes. The document must be an image in JPEG, PNG, PDF, or TIFF format. *
*
* If you're using an AWS SDK to call Amazon Textract, you might not need to
* base64-encode image bytes that are passed using the Bytes
* field.
*
* The input document as base64-encoded bytes or an Amazon S3 * object. If you use the AWS CLI to call Amazon Textract * operations, you can't pass image bytes. The document must be an * image in JPEG, PNG, PDF, or TIFF format. *
*
* If you're using an AWS SDK to call Amazon Textract, you might not
* need to base64-encode image bytes that are passed using the
* Bytes
field.
*
* The input document as base64-encoded bytes or an Amazon S3 object. If you * use the AWS CLI to call Amazon Textract operations, you can't pass image * bytes. The document must be an image in JPEG, PNG, PDF, or TIFF format. *
*
* If you're using an AWS SDK to call Amazon Textract, you might not need to
* base64-encode image bytes that are passed using the Bytes
* field.
*
* The input document as base64-encoded bytes or an Amazon S3 * object. If you use the AWS CLI to call Amazon Textract * operations, you can't pass image bytes. The document must be * an image in JPEG, PNG, PDF, or TIFF format. *
*
* If you're using an AWS SDK to call Amazon Textract, you might
* not need to base64-encode image bytes that are passed using
* the Bytes
field.
*
* The input document as base64-encoded bytes or an Amazon S3 object. If you * use the AWS CLI to call Amazon Textract operations, you can't pass image * bytes. The document must be an image in JPEG, PNG, PDF, or TIFF format. *
*
* If you're using an AWS SDK to call Amazon Textract, you might not need to
* base64-encode image bytes that are passed using the Bytes
* field.
*
* Returns a reference to this object so that method calls can be chained * together. * * @param document
* The input document as base64-encoded bytes or an Amazon S3 * object. If you use the AWS CLI to call Amazon Textract * operations, you can't pass image bytes. The document must be * an image in JPEG, PNG, PDF, or TIFF format. *
*
* If you're using an AWS SDK to call Amazon Textract, you might
* not need to base64-encode image bytes that are passed using
* the Bytes
field.
*
* A list of the types of analysis to perform. Add TABLES to the list to
* return information about the tables that are detected in the input
* document. Add FORMS to return detected form data. Add SIGNATURES to
* return the locations of detected signatures. To perform both forms and
* table analysis, add TABLES and FORMS to FeatureTypes
. To
* detect signatures within form data and table data, add SIGNATURES to
* either TABLES or FORMS. All lines and words detected in the document are
* included in the response (including text that isn't related to the value
* of FeatureTypes
).
*
* A list of the types of analysis to perform. Add TABLES to the
* list to return information about the tables that are detected in
* the input document. Add FORMS to return detected form data. Add
* SIGNATURES to return the locations of detected signatures. To
* perform both forms and table analysis, add TABLES and FORMS to
* FeatureTypes
. To detect signatures within form data
* and table data, add SIGNATURES to either TABLES or FORMS. All
* lines and words detected in the document are included in the
* response (including text that isn't related to the value of
* FeatureTypes
).
*
* A list of the types of analysis to perform. Add TABLES to the list to
* return information about the tables that are detected in the input
* document. Add FORMS to return detected form data. Add SIGNATURES to
* return the locations of detected signatures. To perform both forms and
* table analysis, add TABLES and FORMS to FeatureTypes
. To
* detect signatures within form data and table data, add SIGNATURES to
* either TABLES or FORMS. All lines and words detected in the document are
* included in the response (including text that isn't related to the value
* of FeatureTypes
).
*
* A list of the types of analysis to perform. Add TABLES to the
* list to return information about the tables that are detected
* in the input document. Add FORMS to return detected form data.
* Add SIGNATURES to return the locations of detected signatures.
* To perform both forms and table analysis, add TABLES and FORMS
* to FeatureTypes
. To detect signatures within form
* data and table data, add SIGNATURES to either TABLES or FORMS.
* All lines and words detected in the document are included in
* the response (including text that isn't related to the value
* of FeatureTypes
).
*
* A list of the types of analysis to perform. Add TABLES to the list to
* return information about the tables that are detected in the input
* document. Add FORMS to return detected form data. Add SIGNATURES to
* return the locations of detected signatures. To perform both forms and
* table analysis, add TABLES and FORMS to FeatureTypes
. To
* detect signatures within form data and table data, add SIGNATURES to
* either TABLES or FORMS. All lines and words detected in the document are
* included in the response (including text that isn't related to the value
* of FeatureTypes
).
*
* Returns a reference to this object so that method calls can be chained * together. * * @param featureTypes
* A list of the types of analysis to perform. Add TABLES to the
* list to return information about the tables that are detected
* in the input document. Add FORMS to return detected form data.
* Add SIGNATURES to return the locations of detected signatures.
* To perform both forms and table analysis, add TABLES and FORMS
* to FeatureTypes
. To detect signatures within form
* data and table data, add SIGNATURES to either TABLES or FORMS.
* All lines and words detected in the document are included in
* the response (including text that isn't related to the value
* of FeatureTypes
).
*
* A list of the types of analysis to perform. Add TABLES to the list to
* return information about the tables that are detected in the input
* document. Add FORMS to return detected form data. Add SIGNATURES to
* return the locations of detected signatures. To perform both forms and
* table analysis, add TABLES and FORMS to FeatureTypes
. To
* detect signatures within form data and table data, add SIGNATURES to
* either TABLES or FORMS. All lines and words detected in the document are
* included in the response (including text that isn't related to the value
* of FeatureTypes
).
*
* Returns a reference to this object so that method calls can be chained * together. * * @param featureTypes
* A list of the types of analysis to perform. Add TABLES to the
* list to return information about the tables that are detected
* in the input document. Add FORMS to return detected form data.
* Add SIGNATURES to return the locations of detected signatures.
* To perform both forms and table analysis, add TABLES and FORMS
* to FeatureTypes
. To detect signatures within form
* data and table data, add SIGNATURES to either TABLES or FORMS.
* All lines and words detected in the document are included in
* the response (including text that isn't related to the value
* of FeatureTypes
).
*
* Sets the configuration for the human in the loop workflow for analyzing * documents. *
* * @return* Sets the configuration for the human in the loop workflow for * analyzing documents. *
*/ public HumanLoopConfig getHumanLoopConfig() { return humanLoopConfig; } /** ** Sets the configuration for the human in the loop workflow for analyzing * documents. *
* * @param humanLoopConfig* Sets the configuration for the human in the loop workflow for * analyzing documents. *
*/ public void setHumanLoopConfig(HumanLoopConfig humanLoopConfig) { this.humanLoopConfig = humanLoopConfig; } /** ** Sets the configuration for the human in the loop workflow for analyzing * documents. *
** Returns a reference to this object so that method calls can be chained * together. * * @param humanLoopConfig
* Sets the configuration for the human in the loop workflow for * analyzing documents. *
* @return A reference to this updated object so that method calls can be * chained together. */ public AnalyzeDocumentRequest withHumanLoopConfig(HumanLoopConfig humanLoopConfig) { this.humanLoopConfig = humanLoopConfig; return this; } /** ** Contains Queries and the alias for those Queries, as determined by the * input. *
* * @return* Contains Queries and the alias for those Queries, as determined * by the input. *
*/ public QueriesConfig getQueriesConfig() { return queriesConfig; } /** ** Contains Queries and the alias for those Queries, as determined by the * input. *
* * @param queriesConfig* Contains Queries and the alias for those Queries, as * determined by the input. *
*/ public void setQueriesConfig(QueriesConfig queriesConfig) { this.queriesConfig = queriesConfig; } /** ** Contains Queries and the alias for those Queries, as determined by the * input. *
** Returns a reference to this object so that method calls can be chained * together. * * @param queriesConfig
* Contains Queries and the alias for those Queries, as * determined by the input. *
* @return A reference to this updated object so that method calls can be * chained together. */ public AnalyzeDocumentRequest withQueriesConfig(QueriesConfig queriesConfig) { this.queriesConfig = queriesConfig; return this; } /** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getDocument() != null) sb.append("Document: " + getDocument() + ","); if (getFeatureTypes() != null) sb.append("FeatureTypes: " + getFeatureTypes() + ","); if (getHumanLoopConfig() != null) sb.append("HumanLoopConfig: " + getHumanLoopConfig() + ","); if (getQueriesConfig() != null) sb.append("QueriesConfig: " + getQueriesConfig()); sb.append("}"); return sb.toString(); } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getDocument() == null) ? 0 : getDocument().hashCode()); hashCode = prime * hashCode + ((getFeatureTypes() == null) ? 0 : getFeatureTypes().hashCode()); hashCode = prime * hashCode + ((getHumanLoopConfig() == null) ? 0 : getHumanLoopConfig().hashCode()); hashCode = prime * hashCode + ((getQueriesConfig() == null) ? 0 : getQueriesConfig().hashCode()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof AnalyzeDocumentRequest == false) return false; AnalyzeDocumentRequest other = (AnalyzeDocumentRequest) obj; if (other.getDocument() == null ^ this.getDocument() == null) return false; if (other.getDocument() != null && other.getDocument().equals(this.getDocument()) == false) return false; if (other.getFeatureTypes() == null ^ this.getFeatureTypes() == null) return false; if (other.getFeatureTypes() != null && other.getFeatureTypes().equals(this.getFeatureTypes()) == false) return false; if (other.getHumanLoopConfig() == null ^ this.getHumanLoopConfig() == null) return false; if (other.getHumanLoopConfig() != null && other.getHumanLoopConfig().equals(this.getHumanLoopConfig()) == false) return false; if (other.getQueriesConfig() == null ^ this.getQueriesConfig() == null) return false; if (other.getQueriesConfig() != null && other.getQueriesConfig().equals(this.getQueriesConfig()) == false) return false; return true; } }