Skip to content

Commit

Permalink
feat(client-textract): This release adds new feature - Layout to Anal…
Browse files Browse the repository at this point in the history
…yze Document API which can automatically extract layout elements such as titles, paragraphs, headers, section headers, lists, page numbers, footers, table areas, key-value areas and figure areas and order the elements as a human would read.
  • Loading branch information
awstools committed Sep 27, 2023
1 parent 605746f commit 10647e5
Show file tree
Hide file tree
Showing 11 changed files with 100 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export interface AnalyzeDocumentCommandOutput extends AnalyzeDocumentResponse, _
* },
* },
* FeatureTypes: [ // FeatureTypes // required
* "TABLES" || "FORMS" || "QUERIES" || "SIGNATURES",
* "TABLES" || "FORMS" || "QUERIES" || "SIGNATURES" || "LAYOUT",
* ],
* HumanLoopConfig: { // HumanLoopConfig
* HumanLoopName: "STRING_VALUE", // required
Expand Down Expand Up @@ -131,7 +131,7 @@ export interface AnalyzeDocumentCommandOutput extends AnalyzeDocumentResponse, _
* // },
* // Blocks: [ // BlockList
* // { // Block
* // BlockType: "KEY_VALUE_SET" || "PAGE" || "LINE" || "WORD" || "TABLE" || "CELL" || "SELECTION_ELEMENT" || "MERGED_CELL" || "TITLE" || "QUERY" || "QUERY_RESULT" || "SIGNATURE" || "TABLE_TITLE" || "TABLE_FOOTER",
* // BlockType: "KEY_VALUE_SET" || "PAGE" || "LINE" || "WORD" || "TABLE" || "CELL" || "SELECTION_ELEMENT" || "MERGED_CELL" || "TITLE" || "QUERY" || "QUERY_RESULT" || "SIGNATURE" || "TABLE_TITLE" || "TABLE_FOOTER" || "LAYOUT_TEXT" || "LAYOUT_TITLE" || "LAYOUT_HEADER" || "LAYOUT_FOOTER" || "LAYOUT_SECTION_HEADER" || "LAYOUT_PAGE_NUMBER" || "LAYOUT_LIST" || "LAYOUT_FIGURE" || "LAYOUT_TABLE" || "LAYOUT_KEY_VALUE",
* // Confidence: Number("float"),
* // Text: "STRING_VALUE",
* // TextType: "HANDWRITING" || "PRINTED",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ export interface AnalyzeExpenseCommandOutput extends AnalyzeExpenseResponse, __M
* // ],
* // Blocks: [ // BlockList
* // { // Block
* // BlockType: "KEY_VALUE_SET" || "PAGE" || "LINE" || "WORD" || "TABLE" || "CELL" || "SELECTION_ELEMENT" || "MERGED_CELL" || "TITLE" || "QUERY" || "QUERY_RESULT" || "SIGNATURE" || "TABLE_TITLE" || "TABLE_FOOTER",
* // BlockType: "KEY_VALUE_SET" || "PAGE" || "LINE" || "WORD" || "TABLE" || "CELL" || "SELECTION_ELEMENT" || "MERGED_CELL" || "TITLE" || "QUERY" || "QUERY_RESULT" || "SIGNATURE" || "TABLE_TITLE" || "TABLE_FOOTER" || "LAYOUT_TEXT" || "LAYOUT_TITLE" || "LAYOUT_HEADER" || "LAYOUT_FOOTER" || "LAYOUT_SECTION_HEADER" || "LAYOUT_PAGE_NUMBER" || "LAYOUT_LIST" || "LAYOUT_FIGURE" || "LAYOUT_TABLE" || "LAYOUT_KEY_VALUE",
* // Confidence: Number("float"),
* // Text: "STRING_VALUE",
* // TextType: "HANDWRITING" || "PRINTED",
Expand Down
2 changes: 1 addition & 1 deletion clients/client-textract/src/commands/AnalyzeIDCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export interface AnalyzeIDCommandOutput extends AnalyzeIDResponse, __MetadataBea
* // ],
* // Blocks: [ // BlockList
* // { // Block
* // BlockType: "KEY_VALUE_SET" || "PAGE" || "LINE" || "WORD" || "TABLE" || "CELL" || "SELECTION_ELEMENT" || "MERGED_CELL" || "TITLE" || "QUERY" || "QUERY_RESULT" || "SIGNATURE" || "TABLE_TITLE" || "TABLE_FOOTER",
* // BlockType: "KEY_VALUE_SET" || "PAGE" || "LINE" || "WORD" || "TABLE" || "CELL" || "SELECTION_ELEMENT" || "MERGED_CELL" || "TITLE" || "QUERY" || "QUERY_RESULT" || "SIGNATURE" || "TABLE_TITLE" || "TABLE_FOOTER" || "LAYOUT_TEXT" || "LAYOUT_TITLE" || "LAYOUT_HEADER" || "LAYOUT_FOOTER" || "LAYOUT_SECTION_HEADER" || "LAYOUT_PAGE_NUMBER" || "LAYOUT_LIST" || "LAYOUT_FIGURE" || "LAYOUT_TABLE" || "LAYOUT_KEY_VALUE",
* // Confidence: Number("float"),
* // Text: "STRING_VALUE",
* // TextType: "HANDWRITING" || "PRINTED",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export interface DetectDocumentTextCommandOutput extends DetectDocumentTextRespo
* // },
* // Blocks: [ // BlockList
* // { // Block
* // BlockType: "KEY_VALUE_SET" || "PAGE" || "LINE" || "WORD" || "TABLE" || "CELL" || "SELECTION_ELEMENT" || "MERGED_CELL" || "TITLE" || "QUERY" || "QUERY_RESULT" || "SIGNATURE" || "TABLE_TITLE" || "TABLE_FOOTER",
* // BlockType: "KEY_VALUE_SET" || "PAGE" || "LINE" || "WORD" || "TABLE" || "CELL" || "SELECTION_ELEMENT" || "MERGED_CELL" || "TITLE" || "QUERY" || "QUERY_RESULT" || "SIGNATURE" || "TABLE_TITLE" || "TABLE_FOOTER" || "LAYOUT_TEXT" || "LAYOUT_TITLE" || "LAYOUT_HEADER" || "LAYOUT_FOOTER" || "LAYOUT_SECTION_HEADER" || "LAYOUT_PAGE_NUMBER" || "LAYOUT_LIST" || "LAYOUT_FIGURE" || "LAYOUT_TABLE" || "LAYOUT_KEY_VALUE",
* // Confidence: Number("float"),
* // Text: "STRING_VALUE",
* // TextType: "HANDWRITING" || "PRINTED",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export interface GetDocumentAnalysisCommandOutput extends GetDocumentAnalysisRes
* // NextToken: "STRING_VALUE",
* // Blocks: [ // BlockList
* // { // Block
* // BlockType: "KEY_VALUE_SET" || "PAGE" || "LINE" || "WORD" || "TABLE" || "CELL" || "SELECTION_ELEMENT" || "MERGED_CELL" || "TITLE" || "QUERY" || "QUERY_RESULT" || "SIGNATURE" || "TABLE_TITLE" || "TABLE_FOOTER",
* // BlockType: "KEY_VALUE_SET" || "PAGE" || "LINE" || "WORD" || "TABLE" || "CELL" || "SELECTION_ELEMENT" || "MERGED_CELL" || "TITLE" || "QUERY" || "QUERY_RESULT" || "SIGNATURE" || "TABLE_TITLE" || "TABLE_FOOTER" || "LAYOUT_TEXT" || "LAYOUT_TITLE" || "LAYOUT_HEADER" || "LAYOUT_FOOTER" || "LAYOUT_SECTION_HEADER" || "LAYOUT_PAGE_NUMBER" || "LAYOUT_LIST" || "LAYOUT_FIGURE" || "LAYOUT_TABLE" || "LAYOUT_KEY_VALUE",
* // Confidence: Number("float"),
* // Text: "STRING_VALUE",
* // TextType: "HANDWRITING" || "PRINTED",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export interface GetDocumentTextDetectionCommandOutput extends GetDocumentTextDe
* // NextToken: "STRING_VALUE",
* // Blocks: [ // BlockList
* // { // Block
* // BlockType: "KEY_VALUE_SET" || "PAGE" || "LINE" || "WORD" || "TABLE" || "CELL" || "SELECTION_ELEMENT" || "MERGED_CELL" || "TITLE" || "QUERY" || "QUERY_RESULT" || "SIGNATURE" || "TABLE_TITLE" || "TABLE_FOOTER",
* // BlockType: "KEY_VALUE_SET" || "PAGE" || "LINE" || "WORD" || "TABLE" || "CELL" || "SELECTION_ELEMENT" || "MERGED_CELL" || "TITLE" || "QUERY" || "QUERY_RESULT" || "SIGNATURE" || "TABLE_TITLE" || "TABLE_FOOTER" || "LAYOUT_TEXT" || "LAYOUT_TITLE" || "LAYOUT_HEADER" || "LAYOUT_FOOTER" || "LAYOUT_SECTION_HEADER" || "LAYOUT_PAGE_NUMBER" || "LAYOUT_LIST" || "LAYOUT_FIGURE" || "LAYOUT_TABLE" || "LAYOUT_KEY_VALUE",
* // Confidence: Number("float"),
* // Text: "STRING_VALUE",
* // TextType: "HANDWRITING" || "PRINTED",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ export interface GetExpenseAnalysisCommandOutput extends GetExpenseAnalysisRespo
* // ],
* // Blocks: [ // BlockList
* // { // Block
* // BlockType: "KEY_VALUE_SET" || "PAGE" || "LINE" || "WORD" || "TABLE" || "CELL" || "SELECTION_ELEMENT" || "MERGED_CELL" || "TITLE" || "QUERY" || "QUERY_RESULT" || "SIGNATURE" || "TABLE_TITLE" || "TABLE_FOOTER",
* // BlockType: "KEY_VALUE_SET" || "PAGE" || "LINE" || "WORD" || "TABLE" || "CELL" || "SELECTION_ELEMENT" || "MERGED_CELL" || "TITLE" || "QUERY" || "QUERY_RESULT" || "SIGNATURE" || "TABLE_TITLE" || "TABLE_FOOTER" || "LAYOUT_TEXT" || "LAYOUT_TITLE" || "LAYOUT_HEADER" || "LAYOUT_FOOTER" || "LAYOUT_SECTION_HEADER" || "LAYOUT_PAGE_NUMBER" || "LAYOUT_LIST" || "LAYOUT_FIGURE" || "LAYOUT_TABLE" || "LAYOUT_KEY_VALUE",
* // Confidence: Number("float"),
* // Text: "STRING_VALUE",
* // TextType: "HANDWRITING" || "PRINTED",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ export interface GetLendingAnalysisCommandOutput extends GetLendingAnalysisRespo
* // ],
* // Blocks: [ // BlockList
* // { // Block
* // BlockType: "KEY_VALUE_SET" || "PAGE" || "LINE" || "WORD" || "TABLE" || "CELL" || "SELECTION_ELEMENT" || "MERGED_CELL" || "TITLE" || "QUERY" || "QUERY_RESULT" || "SIGNATURE" || "TABLE_TITLE" || "TABLE_FOOTER",
* // BlockType: "KEY_VALUE_SET" || "PAGE" || "LINE" || "WORD" || "TABLE" || "CELL" || "SELECTION_ELEMENT" || "MERGED_CELL" || "TITLE" || "QUERY" || "QUERY_RESULT" || "SIGNATURE" || "TABLE_TITLE" || "TABLE_FOOTER" || "LAYOUT_TEXT" || "LAYOUT_TITLE" || "LAYOUT_HEADER" || "LAYOUT_FOOTER" || "LAYOUT_SECTION_HEADER" || "LAYOUT_PAGE_NUMBER" || "LAYOUT_LIST" || "LAYOUT_FIGURE" || "LAYOUT_TABLE" || "LAYOUT_KEY_VALUE",
* // Confidence: Number("float"),
* // Text: "STRING_VALUE",
* // TextType: "HANDWRITING" || "PRINTED",
Expand Down Expand Up @@ -271,7 +271,7 @@ export interface GetLendingAnalysisCommandOutput extends GetLendingAnalysisRespo
* // ],
* // Blocks: [
* // {
* // BlockType: "KEY_VALUE_SET" || "PAGE" || "LINE" || "WORD" || "TABLE" || "CELL" || "SELECTION_ELEMENT" || "MERGED_CELL" || "TITLE" || "QUERY" || "QUERY_RESULT" || "SIGNATURE" || "TABLE_TITLE" || "TABLE_FOOTER",
* // BlockType: "KEY_VALUE_SET" || "PAGE" || "LINE" || "WORD" || "TABLE" || "CELL" || "SELECTION_ELEMENT" || "MERGED_CELL" || "TITLE" || "QUERY" || "QUERY_RESULT" || "SIGNATURE" || "TABLE_TITLE" || "TABLE_FOOTER" || "LAYOUT_TEXT" || "LAYOUT_TITLE" || "LAYOUT_HEADER" || "LAYOUT_FOOTER" || "LAYOUT_SECTION_HEADER" || "LAYOUT_PAGE_NUMBER" || "LAYOUT_LIST" || "LAYOUT_FIGURE" || "LAYOUT_TABLE" || "LAYOUT_KEY_VALUE",
* // Confidence: Number("float"),
* // Text: "STRING_VALUE",
* // TextType: "HANDWRITING" || "PRINTED",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export interface StartDocumentAnalysisCommandOutput extends StartDocumentAnalysi
* },
* },
* FeatureTypes: [ // FeatureTypes // required
* "TABLES" || "FORMS" || "QUERIES" || "SIGNATURES",
* "TABLES" || "FORMS" || "QUERIES" || "SIGNATURES" || "LAYOUT",
* ],
* ClientRequestToken: "STRING_VALUE",
* JobTag: "STRING_VALUE",
Expand Down
27 changes: 19 additions & 8 deletions clients/client-textract/src/models/models_0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ export interface Document {
*/
export const FeatureType = {
FORMS: "FORMS",
LAYOUT: "LAYOUT",
QUERIES: "QUERIES",
SIGNATURES: "SIGNATURES",
TABLES: "TABLES",
Expand Down Expand Up @@ -244,11 +245,12 @@ export interface AnalyzeDocumentRequest {
* @public
* <p>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 <code>FeatureTypes</code>. 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 <code>FeatureTypes</code>). </p>
* data. Add SIGNATURES to return the locations of detected signatures. Add LAYOUT to the list
* to return information about the layout of the document. To perform both forms
* and table analysis, add TABLES and FORMS to <code>FeatureTypes</code>. To detect signatures
* within the document and 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 <code>FeatureTypes</code>). </p>
*/
FeatureTypes: (FeatureType | string)[] | undefined;

Expand All @@ -273,6 +275,16 @@ export interface AnalyzeDocumentRequest {
export const BlockType = {
CELL: "CELL",
KEY_VALUE_SET: "KEY_VALUE_SET",
LAYOUT_FIGURE: "LAYOUT_FIGURE",
LAYOUT_FOOTER: "LAYOUT_FOOTER",
LAYOUT_HEADER: "LAYOUT_HEADER",
LAYOUT_KEY_VALUE: "LAYOUT_KEY_VALUE",
LAYOUT_LIST: "LAYOUT_LIST",
LAYOUT_PAGE_NUMBER: "LAYOUT_PAGE_NUMBER",
LAYOUT_SECTION_HEADER: "LAYOUT_SECTION_HEADER",
LAYOUT_TABLE: "LAYOUT_TABLE",
LAYOUT_TEXT: "LAYOUT_TEXT",
LAYOUT_TITLE: "LAYOUT_TITLE",
LINE: "LINE",
MERGED_CELL: "MERGED_CELL",
PAGE: "PAGE",
Expand Down Expand Up @@ -613,7 +625,7 @@ export interface Block {
* </li>
* <li>
* <p>
* <i>SIGNATURE</i> - The location and confidene score of a signature detected on a
* <i>SIGNATURE</i> - The location and confidence score of a signature detected on a
* document page. Can be returned as part of a Key-Value pair or a detected cell.</p>
* </li>
* <li>
Expand Down Expand Up @@ -776,8 +788,7 @@ export interface Block {
* documents that are in PDF or TIFF format. A scanned image (JPEG/PNG) provided to an
* asynchronous operation, even if it contains multiple document pages, is considered a
* single-page document. This means that for scanned images the value of <code>Page</code> is
* always 1. Synchronous operations will also return a <code>Page</code> value of 1
* because every input document is considered to be a single-page document.</p>
* always 1. </p>
*/
Page?: number;

Expand Down
Loading

0 comments on commit 10647e5

Please sign in to comment.