import { Geometry, Relationship } from './Predictions'; export type BlockList = Block[]; export interface Block { /** *
The type of text that's recognized in a block. In text-detection operations, the following types are returned:
PAGE - Contains a list of the LINE Block objects that are detected on a document page.
WORD - A word detected on a document page. A word is one or more ISO basic Latin script characters that aren't separated by spaces.
LINE - A string of tab-delimited, contiguous words that's detected on a document page.
In text analysis operations, the following types are returned:
PAGE - Contains a list of child Block objects that are detected on a document page.
KEY_VALUE_SET - Stores the KEY and VALUE Block objects for a field that's detected on a document page. Use the EntityType field to determine if a KEY_VALUE_SET object is a KEY Block object or a VALUE Block object.
WORD - A word detected on a document page. A word is one or more ISO basic Latin script characters that aren't separated by spaces that's detected on a document page.
LINE - A string of tab-delimited, contiguous words that's detected on a document page.
TABLE - A table that's detected on a document page. A table is any grid-based information with 2 or more rows or columns with a cell span of 1 row and 1 column each.
CELL - A cell within a detected table. The cell is the parent of the block that contains the text in the cell.
SELECTION_ELEMENT - A selectable element such as a radio button or checkbox that's detected on a document page. Use the value of SelectionStatus to determine the status of the selection element.
The confidence that Amazon Textract has in the accuracy of the recognized text and the accuracy of the geometry points around the recognized text.
*/ Confidence?: number; /** *The word or line of text that's recognized by Amazon Textract.
*/ Text?: string; /** *The row in which a table cell is located. The first row position is 1. RowIndex isn't returned by DetectDocumentText and GetDocumentTextDetection.
The column in which a table cell appears. The first column position is 1. ColumnIndex isn't returned by DetectDocumentText and GetDocumentTextDetection.
The number of rows that a table spans. RowSpan isn't returned by DetectDocumentText and GetDocumentTextDetection.
The number of columns that a table cell spans. ColumnSpan isn't returned by DetectDocumentText and GetDocumentTextDetection.
The location of the recognized text on the image. It includes an axis-aligned, coarse bounding box that surrounds the text, and a finer-grain polygon for more accurate spatial information.
*/ Geometry?: Geometry; /** *The identifier for the recognized text. The identifier is only unique for a single operation.
*/ Id?: string; /** *A list of child blocks of the current block. For example a LINE object has child blocks for each WORD block that's part of the line of text. There aren't Relationship objects in the list for relationships that don't exist, such as when the current block has no child blocks. The list size can be the following:
0 - The block has no child blocks.
1 - The block has child blocks.
The type of entity. The following can be returned:
KEY - An identifier for a field on the document.
VALUE - The field text.
EntityTypes isn't returned by DetectDocumentText and GetDocumentTextDetection.
The selection status of a selectable element such as a radio button or checkbox.
*/ SelectionStatus?: 'SELECTED' | 'NOT_SELECTED' | string; /** *The page in which a block was detected. Page is returned by asynchronous operations. Page values greater than 1 are only returned for multi-page documents that are in PDF format. A scanned image (JPG/PNG), even if it contains multiple document pages, is always considered to be a single-page document and the value of Page is always 1. Synchronous operations don't return Page as every input document is considered to be a single-page document.
The word or line of text recognized by Amazon Rekognition.
*/ DetectedText?: string; /** *The type of text that was detected.
*/ Type?: 'LINE' | 'WORD' | string; /** *The identifier for the detected text. The identifier is only unique for a single call to DetectText.
The Parent identifier for the detected text identified by the value of ID. If the type of detected text is LINE, the value of ParentId is Null.
The confidence that Amazon Rekognition has in the accuracy of the detected text and the accuracy of the geometry points around the detected text.
*/ Confidence?: number; /** *The location of the detected text on the image. Includes an axis aligned coarse bounding box surrounding the text and a finer grain polygon for more accurate spatial information.
*/ Geometry?: Geometry; } export interface Image { /** *Blob of image bytes up to 5 MBs.
*/ Bytes?: Uint8Array; /** *Identifies an S3 object as the image source.
*/ S3Object?: S3Object; } export type ImageBlob = Buffer | Uint8Array | Blob | string; export type S3Bucket = string; export interface S3Object { /** * Name of the S3 bucket. */ Bucket?: S3Bucket; /** * S3 object key name. */ Name?: S3ObjectName; /** * If the bucket is versioning enabled, you can specify the object version. */ Version?: S3ObjectVersion; } export type S3ObjectName = string; export type S3ObjectVersion = string; /** *The input document, either as bytes or as an S3 object.
You pass image bytes to an Amazon Textract API operation by using the Bytes property. For example, you would use the Bytes property to pass a document loaded from a local file system. Image bytes passed by using the Bytes property must be base64 encoded. Your code might not need to encode document file bytes if you're using an AWS SDK to call Amazon Textract API operations.
You pass images stored in an S3 bucket to an Amazon Textract API operation by using the S3Object property. Documents stored in an S3 bucket don't need to be base64 encoded.
The AWS Region for the S3 bucket that contains the S3 object must match the AWS Region that you use for Amazon Textract operations.
If you use the AWS CLI to call Amazon Textract operations, passing image bytes using the Bytes property isn't supported. You must first upload the document to an Amazon S3 bucket, and then call the operation using the S3Object property.
For Amazon Textract to process an S3 object, the user must have permission to access the S3 object.
*/ export interface Document { /** *A blob of base-64 encoded documents bytes. The maximum size of a document that's provided in a blob of bytes is 5 MB. The document bytes must be in PNG or JPG format.
If you are using an AWS SDK to call Amazon Textract, you might not need to base64-encode image bytes passed using the Bytes field.
Identifies an S3 object as the document source. The maximum size of a document stored in an S3 bucket is 5 MB.
*/ S3Object?: S3Object; }