/AWS1/IF_TEX=>ANALYZEDOCUMENT()¶
About AnalyzeDocument¶
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 KEYBlockobject and a VALUEBlockobject. 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
Blockobject contains information about a detected table. A CELLBlockobject is returned for each cell in a table. -
Lines and words of text. A LINE
Blockobject contains one or more WORDBlockobjects. All lines and words that are detected in the document are returned (including text that doesn't have a relationship with the value ofFeatureTypes). -
Signatures. A SIGNATURE
Blockobject 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.
Method Signature¶
METHODS /AWS1/IF_TEX~ANALYZEDOCUMENT
IMPORTING
!IO_DOCUMENT TYPE REF TO /AWS1/CL_TEXDOCUMENT OPTIONAL
!IT_FEATURETYPES TYPE /AWS1/CL_TEXFEATURETYPES_W=>TT_FEATURETYPES OPTIONAL
!IO_HUMANLOOPCONFIG TYPE REF TO /AWS1/CL_TEXHUMANLOOPCONFIG OPTIONAL
!IO_QUERIESCONFIG TYPE REF TO /AWS1/CL_TEXQUERIESCONFIG OPTIONAL
!IO_ADAPTERSCONFIG TYPE REF TO /AWS1/CL_TEXADAPTERSCONFIG OPTIONAL
RETURNING
VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_texanalyzedocresponse
RAISING
/AWS1/CX_TEXACCESSDENIEDEX
/AWS1/CX_TEXBADDOCUMENTEX
/AWS1/CX_TEXDOCUMENTTOOLARGEEX
/AWS1/CX_TEXHLQUOTAEXCEEDEDEX
/AWS1/CX_TEXINTERNALSERVERERR
/AWS1/CX_TEXINVALIDPARAMETEREX
/AWS1/CX_TEXINVALIDS3OBJECTEX
/AWS1/CX_TEXPROVTHRUPUTEXCDEX
/AWS1/CX_TEXTHROTTLINGEX
/AWS1/CX_TEXUNSUPPORTEDDOCEX
/AWS1/CX_TEXCLIENTEXC
/AWS1/CX_TEXSERVEREXC
/AWS1/CX_RT_TECHNICAL_GENERIC
/AWS1/CX_RT_SERVICE_GENERIC.
IMPORTING¶
Required arguments:¶
io_document TYPE REF TO /AWS1/CL_TEXDOCUMENT /AWS1/CL_TEXDOCUMENT¶
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
Bytesfield.
it_featuretypes TYPE /AWS1/CL_TEXFEATURETYPES_W=>TT_FEATURETYPES TT_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. Add LAYOUT to the list to return information about the layout of the document. All lines and words detected in the document are included in the response (including text that isn't related to the value of
FeatureTypes).
Optional arguments:¶
io_humanloopconfig TYPE REF TO /AWS1/CL_TEXHUMANLOOPCONFIG /AWS1/CL_TEXHUMANLOOPCONFIG¶
Sets the configuration for the human in the loop workflow for analyzing documents.
io_queriesconfig TYPE REF TO /AWS1/CL_TEXQUERIESCONFIG /AWS1/CL_TEXQUERIESCONFIG¶
Contains Queries and the alias for those Queries, as determined by the input.
io_adaptersconfig TYPE REF TO /AWS1/CL_TEXADAPTERSCONFIG /AWS1/CL_TEXADAPTERSCONFIG¶
Specifies the adapter to be used when analyzing a document.
RETURNING¶
oo_output TYPE REF TO /aws1/cl_texanalyzedocresponse /AWS1/CL_TEXANALYZEDOCRESPONSE¶
Domain /AWS1/RT_ACCOUNT_ID Primitive Type NUMC
Examples¶
Syntax Example¶
This is an example of the syntax for calling the method. It includes every possible argument and initializes every possible value. The data provided is not necessarily semantically accurate (for example the value "string" may be provided for something that is intended to be an instance ID, or in some cases two arguments may be mutually exclusive). The syntax shows the ABAP syntax for creating the various data structures.
DATA(lo_result) = lo_client->analyzedocument(
io_adaptersconfig = new /aws1/cl_texadaptersconfig(
it_adapters = VALUE /aws1/cl_texadapter=>tt_adapters(
(
new /aws1/cl_texadapter(
it_pages = VALUE /aws1/cl_texadapterpages_w=>tt_adapterpages(
( new /aws1/cl_texadapterpages_w( |string| ) )
)
iv_adapterid = |string|
iv_version = |string|
)
)
)
)
io_document = new /aws1/cl_texdocument(
io_s3object = new /aws1/cl_texs3object(
iv_bucket = |string|
iv_name = |string|
iv_version = |string|
)
iv_bytes = '5347567362473873563239796247513D'
)
io_humanloopconfig = new /aws1/cl_texhumanloopconfig(
io_dataattributes = new /aws1/cl_texhumanloopdataattrs(
it_contentclassifiers = VALUE /aws1/cl_texcontclassifiers_w=>tt_contentclassifiers(
( new /aws1/cl_texcontclassifiers_w( |string| ) )
)
)
iv_flowdefinitionarn = |string|
iv_humanloopname = |string|
)
io_queriesconfig = new /aws1/cl_texqueriesconfig(
it_queries = VALUE /aws1/cl_texquery=>tt_queries(
(
new /aws1/cl_texquery(
it_pages = VALUE /aws1/cl_texquerypages_w=>tt_querypages(
( new /aws1/cl_texquerypages_w( |string| ) )
)
iv_alias = |string|
iv_text = |string|
)
)
)
)
it_featuretypes = VALUE /aws1/cl_texfeaturetypes_w=>tt_featuretypes(
( new /aws1/cl_texfeaturetypes_w( |string| ) )
)
).
This is an example of reading all possible response values
lo_result = lo_result.
IF lo_result IS NOT INITIAL.
lo_documentmetadata = lo_result->get_documentmetadata( ).
IF lo_documentmetadata IS NOT INITIAL.
lv_uinteger = lo_documentmetadata->get_pages( ).
ENDIF.
LOOP AT lo_result->get_blocks( ) into lo_row.
lo_row_1 = lo_row.
IF lo_row_1 IS NOT INITIAL.
lv_blocktype = lo_row_1->get_blocktype( ).
lv_percent = lo_row_1->get_confidence( ).
lv_string = lo_row_1->get_text( ).
lv_texttype = lo_row_1->get_texttype( ).
lv_uinteger = lo_row_1->get_rowindex( ).
lv_uinteger = lo_row_1->get_columnindex( ).
lv_uinteger = lo_row_1->get_rowspan( ).
lv_uinteger = lo_row_1->get_columnspan( ).
lo_geometry = lo_row_1->get_geometry( ).
IF lo_geometry IS NOT INITIAL.
lo_boundingbox = lo_geometry->get_boundingbox( ).
IF lo_boundingbox IS NOT INITIAL.
lv_float = lo_boundingbox->get_width( ).
lv_float = lo_boundingbox->get_height( ).
lv_float = lo_boundingbox->get_left( ).
lv_float = lo_boundingbox->get_top( ).
ENDIF.
LOOP AT lo_geometry->get_polygon( ) into lo_row_2.
lo_row_3 = lo_row_2.
IF lo_row_3 IS NOT INITIAL.
lv_float = lo_row_3->get_x( ).
lv_float = lo_row_3->get_y( ).
ENDIF.
ENDLOOP.
lv_angle = lo_geometry->get_rotationangle( ).
ENDIF.
lv_nonemptystring = lo_row_1->get_id( ).
LOOP AT lo_row_1->get_relationships( ) into lo_row_4.
lo_row_5 = lo_row_4.
IF lo_row_5 IS NOT INITIAL.
lv_relationshiptype = lo_row_5->get_type( ).
LOOP AT lo_row_5->get_ids( ) into lo_row_6.
lo_row_7 = lo_row_6.
IF lo_row_7 IS NOT INITIAL.
lv_nonemptystring = lo_row_7->get_value( ).
ENDIF.
ENDLOOP.
ENDIF.
ENDLOOP.
LOOP AT lo_row_1->get_entitytypes( ) into lo_row_8.
lo_row_9 = lo_row_8.
IF lo_row_9 IS NOT INITIAL.
lv_entitytype = lo_row_9->get_value( ).
ENDIF.
ENDLOOP.
lv_selectionstatus = lo_row_1->get_selectionstatus( ).
lv_uinteger = lo_row_1->get_page( ).
lo_query = lo_row_1->get_query( ).
IF lo_query IS NOT INITIAL.
lv_queryinput = lo_query->get_text( ).
lv_queryinput = lo_query->get_alias( ).
LOOP AT lo_query->get_pages( ) into lo_row_10.
lo_row_11 = lo_row_10.
IF lo_row_11 IS NOT INITIAL.
lv_querypage = lo_row_11->get_value( ).
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
ENDLOOP.
lo_humanloopactivationoutp = lo_result->get_humanloopactoutput( ).
IF lo_humanloopactivationoutp IS NOT INITIAL.
lv_humanlooparn = lo_humanloopactivationoutp->get_humanlooparn( ).
LOOP AT lo_humanloopactivationoutp->get_humanloopactreasons( ) into lo_row_12.
lo_row_13 = lo_row_12.
IF lo_row_13 IS NOT INITIAL.
lv_humanloopactivationreas = lo_row_13->get_value( ).
ENDIF.
ENDLOOP.
lv_synthesizedjsonhumanloo = lo_humanloopactivationoutp->get_hlactcondsevalresults( ).
ENDIF.
lv_string = lo_result->get_analyzedocmodelversion( ).
ENDIF.