このセクションでは、ドキュメントファイルで API オペレーション InvokeDataAutomationAsync を実行することで受け取るさまざまなレスポンスオブジェクトに焦点を当てます。以下に、レスポンスオブジェクトの各セクションを分類し、サンプルドキュメントの完全な入力済みレスポンスを示します。最初に受け取るセクションは metadata です。
"metadata":{
"logical_subdocument_id":"XXXX-XXXX-XXXX-XXXX",
"semantic_modality":"DOCUMENT",
"s3_bucket":"bucket",
"s3_prefix":"prefix"
},
上記の最初のセクションでは、ドキュメントに関連付けられたメタデータの概要を示します。このセクションでは、S3 情報に加えて、レスポンスにどのモダリティが選択されたかついても説明します。
"document":{
"representation":{
"text":"document text",
"html":"document title document content",
"markdown":"# text"
},
"description":"document text",
"summary":"summary text",
"statistics":{
"element_count":5,
"table_count":1,
"figure_count":1,
"word_count":1000,
"line_count":32
}
},
上記のセクションでは、ドキュメントレベルの詳細度情報を提供します。説明セクションと概要セクションは、ドキュメントに基づいて生成されたフィールドです。表現セクションは、ドキュメントの実際のコンテンツをさまざまなフォーマットスタイルで提供します。最後に、統計には、セマンティック要素の数、図、単語、行の数など、ドキュメントの実際のコンテンツに関する情報が含まれます。
これはテーブルエンティティに関する情報です。InvokeDataAutomationAsync (非同期) リクエストでは、位置情報、さまざまな形式のテキスト、テーブル、および読み取り順序に加えて、S3 バケット内のテーブルの csv 情報とトリミングされたイメージを特に返します。CSV 情報には、さまざまなヘッダー、フッター、タイトルが示されます。イメージは、InvokeDataAutomationAsync リクエストで設定されたプレフィックスの s3 バケットにルーティングされます。InvokeDataAutomation (同期) リクエストでは、S3 バケット内のテーブルの csv およびトリミングされたイメージはサポートされていません。
PDF を処理すると、レスポンスの統計セクションに、ドキュメント内に存在するハイパーリンクの数を示す hyperlinks_count も含まれます。
{
"id":"entity_id",
"type":"TEXT",
"representation":{
"text":"document text",
"html":"document title document content",
"markdown":"# text"
},
"reading_order":2,
"page_indices":[
0
],
"locations":[
{
"page_index":0,
"bounding_box":{
"left":0.0,
"top":0.0,
"width":0.05,
"height":0.5
}
}
],
"sub_type":"TITLE/SECTION_TITLE/HEADER/FOOTER/PARAGRAPH/LIST/PAGE_NUMBER"
},
これは、レスポンスの TYPE 行で示される、ドキュメント内のテキストに使用されるエンティティです。ここでも表現は、テキストをさまざまなフォーマットで示します。reading_order は、読者がテキストを論理的に見る時期を示します。これは、関連するキーと値に基づくセマンティック順序です。例えば、段落のタイトルをそれぞれの段落に読み取り順に関連付けます。page_indices は、テキストがどのページにあるかを示します。次は位置情報です。レスポンスで有効になっていた場合は、テキスト境界ボックスが表示されます。最後に、エンティティサブタイプがあります。このサブタイプは、検出されたテキストの種類に関するより詳細な情報を提供します。サブタイプの完全な一覧については、「API リファレンス」を参照してください。
{
"id":"entity_id",
"type":"TABLE",
"representation":{
"html":"table.../table",
"markdown":"| header | ...",
"text":"header \t header",
"csv":"header, header, header\n..."
},
"csv_s3_uri":"s3://",
"headers":[
"date",
"amount",
"description",
"total"
],
"reading_order":3,
"title":"Title of the table",
"footers":[
"the footers of the table"
],
"crop_images":[
"s3://bucket/prefix.png",
"s3://bucket/prefix.png"
],
"page_indices":[
0,
1
],
"locations":[
{
"page_index":0,
"bounding_box":{
"left":0,
"top":0,
"width":1,
"height":1
}
},
{
"page_index":1,
"bounding_box":{
"left":0,
"top":0,
"width":1,
"height":1
}
}
],
"sub_type":"TITLE/SECTION_TITLE/HEADER/FOOTER/PARAGRAPH/LIST/PAGE_NUMBER"
},
これはテーブルエンティティに関する情報です。位置情報、テキスト、テーブル、読み取り順序のさまざまな形式に加えて、S3 バケット内のテーブルの csv 情報とトリミングされたイメージを特に返します。CSV 情報には、さまざまなヘッダー、フッター、タイトルが示されます。イメージは、InvokeDataAutomation リクエストで設定されたプレフィックスの s3 バケットにルーティングされます。
{
"id":"entity_id",
"type":"FIGURE",
"summary":"",
"representation":{
"text":"document text",
"html":"document title document content",
"markdown":"# text"
},
"crop_images":[
"s3://bucket/prefix.png",
"s3://bucket/prefix.png"
],
"locations":[
{
"page_index":0,
"bounding_box":{
"left":0,
"top":0,
"width":1,
"height":1
}
}
],
"sub_type":"CHART",
"title":"figure title",
"rai_flag":"APPROVED/REDACTED/REJECTED",
"reading_order":1,
"page_indices":[
0
]
}
,
これは、ドキュメントのグラフやチャートなどの図に使用されるエンティティです。テーブルと同様に、これらの数値はトリミングされ、イメージはプレフィックスに設定された s3 バケットに送信されます。さらに、タイトルテキストの sub_type と図タイトルのレスポンスが返され、それがどのような図であるかを示されます。
"pages":[
{
"id":"page_id",
"page_index":0,
"detected_page_number":1,
"representation":{
"text":"document text",
"html":"document title document content",
"markdown":"# text"
},
"statistics":{
"element_count":5,
"table_count":1,
"figure_count":1,
"word_count":1000,
"line_count":32
},
"asset_metadata":{
"rectified_image":"s3://bucket/prefix.png",
"rectified_image_width_pixels":1700,
"rectified_image_height_pixels":2200
}
}
],
標準出力で抽出するエンティティの最後はページです。「ページ」は「テキスト」エンティティと同じですが、さらにページ番号が含まれ、検出されたページ番号がページに表示されます。
"text_lines":[
{
"id":"line_id",
"text":"line text",
"reading_order":1,
"page_index":0,
"locations":{
"page_index":0,
"bounding_box":{
"left":0,
"top":0,
"width":1,
"height":1
}
}
}
],
"text_words":[
{
"id":"word_id",
"text":"word text",
"line_id":"line_id",
"reading_order":1,
"page_index":0,
"locations":{
"page_index":0,
"bounding_box":{
"left":0,
"top":0,
"width":1,
"height":1
}
}
}
]
これらの最後の 2 つの要素は、個々のテキスト部用です。単語レベルの詳細度では各単語のレスポンスが返されますが、デフォルトの出力ではテキスト行のみが報告されます。
このセクションでは、ドキュメントファイルで API オペレーション InvokeDataAutomation を実行することで受け取る、さまざまなレスポンスオブジェクトに焦点を当てます。以下に、レスポンスオブジェクトの各セクションを分類し、サンプルドキュメントの完全な入力済みレスポンスを示します。最初に受け取るセクションは metadata です。
"metadata": {
"logical_subdocument_id": "1",
"semantic_modality": "DOCUMENT",
"number_of_pages": X,
"start_page_index": "1",
"end_page_index": X,
"file_type": "PDF"
},
上記の最初のセクションでは、ドキュメントに関連付けられたメタデータの概要を示します。Synchronous InvokeDataAutomation API は現在ドキュメント分割をサポートしていないため、logical_subdocument_id は常に 1 に等しくなります。
"document":{
"representation":{
"text":"document text",
"html":"document title document content",
"markdown":"# text"
},
"description":"document text",
"summary":"summary text",
"statistics":{
"element_count":5,
"table_count":1,
"figure_count":1,
"word_count":1000,
"line_count":32
}
},
上記のセクションでは、ドキュメントレベルの詳細度情報を提供します。説明セクションと概要セクションは、ドキュメントに基づいて生成されたフィールドです。表現セクションは、ドキュメントの実際のコンテンツをさまざまなフォーマットスタイルで提供します。最後に、統計には、セマンティック要素の数、図、単語、行の数など、ドキュメントの実際のコンテンツに関する情報が含まれます。
注: 非同期 InvokeDataAutomationAsync リクエストとは異なり、同期 InvokeDataAutomation リクエストは、S3 バケット内のテーブルの csv 情報とトリミングされたイメージの返しをサポートしていません。
{
"id":"entity_id",
"type":"TEXT",
"representation":{
"text":"document text",
"html":"document title document content",
"markdown":"# text"
},
"reading_order":2,
"page_indices":[
0
],
"locations":[
{
"page_index":0,
"bounding_box":{
"left":0.0,
"top":0.0,
"width":0.05,
"height":0.5
}
}
],
"sub_type":"TITLE/SECTION_TITLE/HEADER/FOOTER/PARAGRAPH/LIST/PAGE_NUMBER"
},
これはドキュメント内のテキストに使用されるエンティティで、レスポンスの TYPE 行で示されます。ここでも表現はテキストをさまざまな形式で示します。 reading_order は、読者がテキストを論理的に見るタイミングを示します。これは、関連するキーと値に基づくセマンティック順序です。たとえば、段落のタイトルをそれぞれの段落に読み上げ順に関連付けます。 page_indices は、テキストがどのページにあるかを示します。次は位置情報です。レスポンスで有効になっていた場合は、テキスト境界ボックスが表示されます。最後に、エンティティサブタイプがあります。このサブタイプは、検出されたテキストの種類に関するより詳細な情報を提供します。サブタイプの完全な一覧については、「API リファレンス」を参照してください。
{
"id": "entity_id",
"type": "TABLE",
"representation": {
"html": "table.../table",
"markdown": "| header | ...",
"text": "header \t header",
"csv": "header, header, header\n..."
},
"headers": ["date", "amount", "description", "total"],
"reading_order": 3,
"title": "Title of the table",
"footers": ["the footers of the table"],
"page_indices": [0, 1],
"locations": [{
"page_index": 0,
"bounding_box": {
"left": 0,
"top": 0,
"width": 1,
"height": 1
}
}, {
"page_index": 1,
"bounding_box": {
"left": 0,
"top": 0,
"width": 1,
"height": 1
}
}]
},
これはテーブルエンティティに関する情報です。CSV 情報には、さまざまなヘッダー、フッター、タイトルが示されます。
{
"id": "entity_id",
"type": "FIGURE",
"summary": "",
"representation": {
"text": "document text",
"html": "document title document content",
"markdown": "# text"
},
"locations": [
{
"page_index": 0,
"bounding_box": {
"left": 0,
"top": 0,
"width": 1,
"height": 1
}
}
],
"sub_type": "CHART",
"title": "figure title",
"reading_order": 1,
"page_indices": [
0
]
},
これは、ドキュメントのグラフやチャートなどの図に使用されるエンティティです。タイトルテキストの sub_typeとフィギュアタイトルレスポンスが表示され、どのようなフィギュアであるかが示されます。
"pages":[
"pages":[
{
"id":"page_id",
"page_index":0,
"detected_page_number":1,
"representation":{
"text":"document text",
"html":"document title document content",
"markdown":"# text"
},
"statistics":{
"element_count":5,
"table_count":1,
"figure_count":1,
"word_count":1000,
"line_count":32
},
"asset_metadata":{
"rectified_image":"s3://bucket/prefix.png",
"rectified_image_width_pixels":1700,
"rectified_image_height_pixels":2200
}
}
],
標準出力で抽出するエンティティの最後はページです。「ページ」は「テキスト」エンティティと同じですが、さらにページ番号が含まれ、検出されたページ番号がページに表示されます。
"text_lines":[
{
"id":"line_id",
"text":"line text",
"reading_order":1,
"page_index":0,
"locations":{
"page_index":0,
"bounding_box":{
"left":0,
"top":0,
"width":1,
"height":1
}
}
}
],
"text_words":[
{
"id":"word_id",
"text":"word text",
"line_id":"line_id",
"reading_order":1,
"page_index":0,
"locations":{
"page_index":0,
"bounding_box":{
"left":0,
"top":0,
"width":1,
"height":1
}
}
}
]
これらの最後の 2 つの要素は、個々のテキスト部用です。単語レベルの詳細度では各単語のレスポンスが返されますが、デフォルトの出力ではテキスト行のみが報告されます。