

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# 同期操作によるドキュメントの処理
<a name="sync"></a>

Amazon Textract は、JPEG、PNG、PDF、および TIFF 形式の画像として提供される単一ページのドキュメント内のテキストを検出して分析できます。オペレーションは同期しており、ほぼリアルタイムに結果を返します。ドキュメントの詳細については、「[テキスト検出および文書分析応答オブジェクト](how-it-works-document-layout.md)」を参照してください。

このセクションでは、Amazon Textract を使用して、単一ページのドキュメント内のテキストを同期的に検出して分析する方法について説明します。複数ページのドキュメント内のテキストの検出と分析、または JPEG および PNG ドキュメントを非同期的に検出するには、を参照してください。[非同期操作によるドキュメントの処理](async.md)。

Amazon Textract 同期オペレーションは以下の目的に使用できます。
+ テキスト検出-単一ページのドキュメントイメージの行と単語を検出するには、[DetectDocumentText](API_DetectDocumentText.md)オペレーション. 詳細については、「[テキストの検出](how-it-works-detecting.md)」を参照してください。
+ テキスト分析-単一ページのドキュメントで検出されたテキスト間の関係を特定するには、[AnalyzeDocument](API_AnalyzeDocument.md)オペレーション. 詳細については、「[ドキュメントを分析する](how-it-works-analyzing.md)」を参照してください。
+ 請求書と領収書の分析 — AnalyzeExpense操作を使用して、単一ページの請求書または領収書で検出されたテキスト間の財務関係を特定できます。詳細については、「」を参照してください。[請求書と領収書の分析](invoices-receipts.md)
+ アイデンティティドキュメント分析 — 米国政府によって発行された身分証明書を分析し、アイデンティティドキュメントで見つかった一般的な種類の情報とともに情報を抽出できます。詳細については、「」を参照してください。[アイデンティティドキュメントの分析](how-it-works-identity.md)。

**Topics**
+ [Amazon Textract 同期オペレーションを呼び出す](sync-calling.md)
+ [Amazon Textract でドキュメントテキストの検出](detecting-document-text.md)
+ [Amazon Textract を使用したドキュメントテキストの分析](analyzing-document-text.md)
+ [Amazon Textract を使用した請求書と領収書の分析](analyzing-document-expense.md)
+ [Amazon Textract を使用したアイデンティティドキュメントの分析](analyzing-document-identity.md)

# Amazon Textract 同期オペレーションを呼び出す
<a name="sync-calling"></a>

Amazon Textract オペレーションは、ローカルファイルシステムに保存されているドキュメントイメージ、または Amazon S3 バケットに格納されているドキュメントイメージを処理します。入力ドキュメントの場所を指定するには、[Document](API_Document.md)入力パラメータ。ドキュメントイメージは PNG、JPEG、PDF、または TIFF のいずれかの形式にすることができます。同期操作の結果はすぐに返され、取得用に格納されません。

詳しい例については、「」を参照してください。[Amazon Textract でドキュメントテキストの検出](detecting-document-text.md)。

## リクエスト
<a name="sync-request"></a>

以下では、Amazon Textract でのリクエストの仕組みについて説明します。

### イメージバイトとして渡されたドキュメント
<a name="sync-pass-image-bytes"></a>

イメージを base64 でエンコードされたバイト配列として渡すことで、ドキュメントイメージを Amazon Textract オペレーションに渡すことができます。例として、ローカルファイルシステムからロードされたドキュメントイメージがあります。を使用している場合、コードでは、ドキュメントファイルのバイトをエンコードする必要がない場合があります。AWSAmazon Textract API オペレーションを呼び出すためのSDK。

イメージバイトは、`Bytes`のフィールド`Document`入力パラメータ。次の例は、イメージバイトを渡す Amazon Textract オペレーションの入力 JSON を示しています。`Bytes`入力パラメータ。

```
{
    "Document": {
        "Bytes": "/9j/4AAQSk....."
    }
}
```

**注記**  
使用しているAWS CLIでは、Amazon Textract オペレーションにイメージバイトを渡すことはできません。代わりに、Amazon S3 バケットに保存されたイメージを参照する必要があります。

次の Java コードは、ローカルファイルシステムからイメージをロードし、Amazon Textract オペレーションを呼び出します。

```
String document="input.png";

ByteBuffer imageBytes;
try (InputStream inputStream = new FileInputStream(new File(document))) {
    imageBytes = ByteBuffer.wrap(IOUtils.toByteArray(inputStream));
}
AmazonTextract client = AmazonTextractClientBuilder.defaultClient();

DetectDocumentTextRequest request = new DetectDocumentTextRequest()
        .withDocument(new Document()
                .withBytes(imageBytes));


DetectDocumentTextResult result = client.detectDocumentText(request);
```

### Amazon S3 バケットに保存されたドキュメント
<a name="sync-pass-s3"></a>

Amazon Textract は、Amazon S3 バケットに保存されているドキュメントイメージを分析できます。を使用してバケットとファイル名を指定します。[S3Object](API_S3Object.md)のフィールド`Document`入力パラメータ。次の例では、Amazon S3 バケットに格納されているドキュメントを処理する Amazon Textract オペレーションの入力 JSON を示しています。

```
{
    "Document": {
        "S3Object": {
            "Bucket": "bucket",
            "Name": "input.png"
        }
    }
}
```

次の例では、Amazon S3 バケットに格納されているイメージを使用して Amazon Textract オペレーションを呼び出す方法を示しています。

```
String document="input.png";
String bucket="bucket";

AmazonTextract client = AmazonTextractClientBuilder.defaultClient();

DetectDocumentTextRequest request = new DetectDocumentTextRequest()
        .withDocument(new Document()
                .withS3Object(new S3Object()
                        .withName(document)
                        .withBucket(bucket)));

DetectDocumentTextResult result = client.detectDocumentText(request);
```

## 対処
<a name="sync-response"></a>

への呼び出しの JSON レスポンスの例を次に示します。`DetectDocumentText`。詳細については、「[テキストの検出](how-it-works-detecting.md)」を参照してください。

```
{
{
  "DocumentMetadata": {
    "Pages": 1
  },
  "Blocks": [
    {
      "BlockType": "PAGE",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.9995205998420715,
          "Height": 1.0,
          "Left": 0.0,
          "Top": 0.0
        },
        "Polygon": [
          {
            "X": 0.0,
            "Y": 0.0
          },
          {
            "X": 0.9995205998420715,
            "Y": 2.297314024515845E-16
          },
          {
            "X": 0.9995205998420715,
            "Y": 1.0
          },
          {
            "X": 0.0,
            "Y": 1.0
          }
        ]
      },
      "Id": "ca4b9171-7109-4adb-a811-e09bbe4834dd",
      "Relationships": [
        {
          "Type": "CHILD",
          "Ids": [
            "26085884-d005-4144-b4c2-4d83dc50739b",
            "ee9d01bc-d91c-401d-8c0a-eec76f5f7862",
            "404bb3d3-d7ab-4008-a195-5dec87a08664",
            "8ae1b4ba-67c1-4486-bd20-54f461886ce9",
            "47aab5ab-be2c-4c73-97c7-d0a45454e843",
            "dd06bb49-6a56-4ea7-beec-a2aa09835c3c",
            "8837153d-81b8-4031-a49f-83a3d81803c2",
            "5dae3b74-9e95-4b62-99b7-93b88fe70648",
            "4508da80-64d8-42a8-8846-cfafe6eab10c",
            "e87be7a9-5519-42e1-b18e-ae10e2d3ed13",
            "f04bb223-d075-41c3-b328-7354611c826b",
            "a234f0e8-67de-46f4-a7c7-0bbe8d5159ce",
            "61b20e27-ff8a-450a-a8b1-bc0259f82fd6",
            "445f4fdd-c77b-4a7b-a2fc-6ca07cfe9ed7",
            "359f3870-7183-43f5-b638-970f5cefe4d5",
            "b9deea0a-244c-4d54-b774-cf03fbaaa8b1",
            "e2a43881-f620-44f2-b067-500ce7dc8d4d",
            "41756974-64ef-432d-b4b2-34702505975a",
            "93d96d32-8b4a-4a98-9578-8b4df4f227a6",
            "bc907357-63d6-43c0-ab87-80d7e76d377e",
            "2d727ca7-3acb-4bb9-a564-5885c90e9325",
            "f32a5989-cbfb-41e6-b0fc-ce1c77c014bd",
            "e0ba06d0-dbb6-4962-8047-8cac3adfe45a",
            "b6ed204d-ae01-4b75-bb91-c85d4147a37e",
            "ac4b9ee0-c9b2-4239-a741-5753e5282033",
            "ebc18885-48d7-45b8-90e3-d172b4357802",
            "babf6360-789e-49c1-9c78-0784acc14a0c"
          ]
        }
      ]
    },
    {
      "BlockType": "LINE",
      "Confidence": 99.93761444091797,
      "Text": "Employment Application",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.3391372561454773,
          "Height": 0.06906412541866302,
          "Left": 0.29548385739326477,
          "Top": 0.027493247762322426
        },
        "Polygon": [
          {
            "X": 0.29548385739326477,
            "Y": 0.027493247762322426
          },
          {
            "X": 0.6346210837364197,
            "Y": 0.027493247762322426
          },
          {
            "X": 0.6346210837364197,
            "Y": 0.0965573713183403
          },
          {
            "X": 0.29548385739326477,
            "Y": 0.0965573713183403
          }
        ]
      },
      "Id": "26085884-d005-4144-b4c2-4d83dc50739b",
      "Relationships": [
        {
          "Type": "CHILD",
          "Ids": [
            "ed48dacc-d089-498f-8e93-1cee1e5f39f3",
            "ac7370f3-cbb7-4cd9-a8f9-bdcb2252caaf"
          ]
        }
      ]
    },
    {
      "BlockType": "LINE",
      "Confidence": 99.91246795654297,
      "Text": "Application Information",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.19878505170345306,
          "Height": 0.03754019737243652,
          "Left": 0.03988289833068848,
          "Top": 0.14050349593162537
        },
        "Polygon": [
          {
            "X": 0.03988289833068848,
            "Y": 0.14050349593162537
          },
          {
            "X": 0.23866795003414154,
            "Y": 0.14050349593162537
          },
          {
            "X": 0.23866795003414154,
            "Y": 0.1780436933040619
          },
          {
            "X": 0.03988289833068848,
            "Y": 0.1780436933040619
          }
        ]
      },
      "Id": "ee9d01bc-d91c-401d-8c0a-eec76f5f7862",
      "Relationships": [
        {
          "Type": "CHILD",
          "Ids": [
            "efe3fc6d-becb-4520-80ee-49a329386aee",
            "c2260852-6cfd-4a71-9fc6-62b2f9b02355"
          ]
        }
      ]
    },
    {
      "BlockType": "LINE",
      "Confidence": 99.88693237304688,
      "Text": "Full Name: Jane Doe",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.16733919084072113,
          "Height": 0.031106337904930115,
          "Left": 0.03899926319718361,
          "Top": 0.21361036598682404
        },
        "Polygon": [
          {
            "X": 0.03899926319718361,
            "Y": 0.21361036598682404
          },
          {
            "X": 0.20633845031261444,
            "Y": 0.21361036598682404
          },
          {
            "X": 0.20633845031261444,
            "Y": 0.24471670389175415
          },
          {
            "X": 0.03899926319718361,
            "Y": 0.24471670389175415
          }
        ]
      },
      "Id": "404bb3d3-d7ab-4008-a195-5dec87a08664",
      "Relationships": [
        {
          "Type": "CHILD",
          "Ids": [
            "e94eb587-9545-4215-b0fc-8e8cb1172958",
            "090aeba5-8428-4b7a-a54b-7a95a774120e",
            "64ff0abb-736b-4a6b-aa8d-ad2c0086ae1d",
            "565ffc30-89d6-4295-b8c6-d22b4ed76584"
          ]
        }
      ]
    },
    {
      "BlockType": "LINE",
      "Confidence": 99.9206314086914,
      "Text": "Phone Number: 555-0100",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.3115004599094391,
          "Height": 0.047169625759124756,
          "Left": 0.03604753687977791,
          "Top": 0.2812676727771759
        },
        "Polygon": [
          {
            "X": 0.03604753687977791,
            "Y": 0.2812676727771759
          },
          {
            "X": 0.3475480079650879,
            "Y": 0.2812676727771759
          },
          {
            "X": 0.3475480079650879,
            "Y": 0.32843729853630066
          },
          {
            "X": 0.03604753687977791,
            "Y": 0.32843729853630066
          }
        ]
      },
      "Id": "8ae1b4ba-67c1-4486-bd20-54f461886ce9",
      "Relationships": [
        {
          "Type": "CHILD",
          "Ids": [
            "d782f847-225b-4a1b-b52d-f252f8221b1f",
            "fa69c5cd-c80d-4fac-81df-569edae8d259",
            "d4bbc0f1-ae02-41cf-a26f-8a1e899968cc"
          ]
        }
      ]
    },
    {
      "BlockType": "LINE",
      "Confidence": 99.48902893066406,
      "Text": "Home Address: 123 Any Street, Any Town. USA",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.7431139945983887,
          "Height": 0.09577702730894089,
          "Left": 0.03359385207295418,
          "Top": 0.3258342146873474
        },
        "Polygon": [
          {
            "X": 0.03359385207295418,
            "Y": 0.3258342146873474
          },
          {
            "X": 0.7767078280448914,
            "Y": 0.3258342146873474
          },
          {
            "X": 0.7767078280448914,
            "Y": 0.4216112196445465
          },
          {
            "X": 0.03359385207295418,
            "Y": 0.4216112196445465
          }
        ]
      },
      "Id": "47aab5ab-be2c-4c73-97c7-d0a45454e843",
      "Relationships": [
        {
          "Type": "CHILD",
          "Ids": [
            "acfbed90-4a00-42c6-8a90-d0a0756eea36",
            "046c8a40-bb0e-4718-9c71-954d3630e1dd",
            "82b838bc-4591-4287-8dea-60c94a4925e4",
            "5cdcde7a-f5a6-4231-a941-b6396e42e7ba",
            "beafd497-185f-487e-b070-db4df5803e94",
            "ef1b77fb-8ba6-41fe-ba53-dce039af22ed",
            "7b555310-e7f8-4cd2-bb3d-dcec37f3d90e",
            "b479c24d-448d-40ef-9ed5-36a6ef08e5c7"
          ]
        }
      ]
    },
    {
      "BlockType": "LINE",
      "Confidence": 99.89382934570312,
      "Text": "Mailing Address: same as above",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.26575741171836853,
          "Height": 0.039571404457092285,
          "Left": 0.03068041242659092,
          "Top": 0.43351811170578003
        },
        "Polygon": [
          {
            "X": 0.03068041242659092,
            "Y": 0.43351811170578003
          },
          {
            "X": 0.2964377999305725,
            "Y": 0.43351811170578003
          },
          {
            "X": 0.2964377999305725,
            "Y": 0.4730895161628723
          },
          {
            "X": 0.03068041242659092,
            "Y": 0.4730895161628723
          }
        ]
      },
      "Id": "dd06bb49-6a56-4ea7-beec-a2aa09835c3c",
      "Relationships": [
        {
          "Type": "CHILD",
          "Ids": [
            "d7261cdc-6ac5-4711-903c-4598fe94952d",
            "287f80c3-6db2-4dd7-90ec-5f017c80aa31",
            "ce31c3ad-b51e-4068-be64-5fc9794bc1bc",
            "e96eb92c-6774-4d6f-8f4a-68a7618d4c66",
            "88b85c05-427a-4d4f-8cc4-3667234e8364"
          ]
        }
      ]
    },
    {
      "BlockType": "LINE",
      "Confidence": 94.67343139648438,
      "Text": "Previous Employment History",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.3309842050075531,
          "Height": 0.051920413970947266,
          "Left": 0.3194798231124878,
          "Top": 0.5172380208969116
        },
        "Polygon": [
          {
            "X": 0.3194798231124878,
            "Y": 0.5172380208969116
          },
          {
            "X": 0.6504639983177185,
            "Y": 0.5172380208969116
          },
          {
            "X": 0.6504639983177185,
            "Y": 0.5691584348678589
          },
          {
            "X": 0.3194798231124878,
            "Y": 0.5691584348678589
          }
        ]
      },
      "Id": "8837153d-81b8-4031-a49f-83a3d81803c2",
      "Relationships": [
        {
          "Type": "CHILD",
          "Ids": [
            "8b324501-bf38-4ce9-9777-6514b7ade760",
            "b0cea99a-5045-464d-ac8a-a63ab0470995",
            "b92a6ee5-ca59-44dc-9c47-534c133b11e7"
          ]
        }
      ]
    },
    {
      "BlockType": "LINE",
      "Confidence": 99.66949462890625,
      "Text": "Start Date",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.08310240507125854,
          "Height": 0.030944595113396645,
          "Left": 0.034429505467414856,
          "Top": 0.6123942136764526
        },
        "Polygon": [
          {
            "X": 0.034429505467414856,
            "Y": 0.6123942136764526
          },
          {
            "X": 0.1175319030880928,
            "Y": 0.6123942136764526
          },
          {
            "X": 0.1175319030880928,
            "Y": 0.6433387994766235
          },
          {
            "X": 0.034429505467414856,
            "Y": 0.6433387994766235
          }
        ]
      },
      "Id": "5dae3b74-9e95-4b62-99b7-93b88fe70648",
      "Relationships": [
        {
          "Type": "CHILD",
          "Ids": [
            "ffe8b8e0-df59-4ac5-9aba-6b54b7c51b45",
            "91e582cd-9871-4e9c-93cc-848baa426338"
          ]
        }
      ]
    },
    {
      "BlockType": "LINE",
      "Confidence": 99.86717224121094,
      "Text": "End Date",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.07581500709056854,
          "Height": 0.03223184868693352,
          "Left": 0.14846202731132507,
          "Top": 0.6120467782020569
        },
        "Polygon": [
          {
            "X": 0.14846202731132507,
            "Y": 0.6120467782020569
          },
          {
            "X": 0.22427703440189362,
            "Y": 0.6120467782020569
          },
          {
            "X": 0.22427703440189362,
            "Y": 0.6442786455154419
          },
          {
            "X": 0.14846202731132507,
            "Y": 0.6442786455154419
          }
        ]
      },
      "Id": "4508da80-64d8-42a8-8846-cfafe6eab10c",
      "Relationships": [
        {
          "Type": "CHILD",
          "Ids": [
            "7c97b56b-699f-49b0-93f4-98e6d90b107c",
            "7af04e27-0c15-447e-a569-b30edb99a133"
          ]
        }
      ]
    },
    {
      "BlockType": "LINE",
      "Confidence": 99.9539794921875,
      "Text": "Employer Name",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.1347292959690094,
          "Height": 0.0392492413520813,
          "Left": 0.2647075653076172,
          "Top": 0.6140711903572083
        },
        "Polygon": [
          {
            "X": 0.2647075653076172,
            "Y": 0.6140711903572083
          },
          {
            "X": 0.3994368314743042,
            "Y": 0.6140711903572083
          },
          {
            "X": 0.3994368314743042,
            "Y": 0.6533204317092896
          },
          {
            "X": 0.2647075653076172,
            "Y": 0.6533204317092896
          }
        ]
      },
      "Id": "e87be7a9-5519-42e1-b18e-ae10e2d3ed13",
      "Relationships": [
        {
          "Type": "CHILD",
          "Ids": [
            "a9bfeb55-75cd-47cd-b953-728e602a3564",
            "9f0f9c06-d02c-4b07-bb39-7ade70be2c1b"
          ]
        }
      ]
    },
    {
      "BlockType": "LINE",
      "Confidence": 99.35584259033203,
      "Text": "Position Held",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.11393272876739502,
          "Height": 0.03415105864405632,
          "Left": 0.49973347783088684,
          "Top": 0.614840030670166
        },
        "Polygon": [
          {
            "X": 0.49973347783088684,
            "Y": 0.614840030670166
          },
          {
            "X": 0.6136661767959595,
            "Y": 0.614840030670166
          },
          {
            "X": 0.6136661767959595,
            "Y": 0.6489911079406738
          },
          {
            "X": 0.49973347783088684,
            "Y": 0.6489911079406738
          }
        ]
      },
      "Id": "f04bb223-d075-41c3-b328-7354611c826b",
      "Relationships": [
        {
          "Type": "CHILD",
          "Ids": [
            "6d5edf02-845c-40e0-9514-e56d0d652ae0",
            "3297ab59-b237-45fb-ae60-a108f0c95ac2"
          ]
        }
      ]
    },
    {
      "BlockType": "LINE",
      "Confidence": 99.9817886352539,
      "Text": "Reason for leaving",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.16511960327625275,
          "Height": 0.04062700271606445,
          "Left": 0.7430596351623535,
          "Top": 0.6116235852241516
        },
        "Polygon": [
          {
            "X": 0.7430596351623535,
            "Y": 0.6116235852241516
          },
          {
            "X": 0.9081792235374451,
            "Y": 0.6116235852241516
          },
          {
            "X": 0.9081792235374451,
            "Y": 0.6522505879402161
          },
          {
            "X": 0.7430596351623535,
            "Y": 0.6522505879402161
          }
        ]
      },
      "Id": "a234f0e8-67de-46f4-a7c7-0bbe8d5159ce",
      "Relationships": [
        {
          "Type": "CHILD",
          "Ids": [
            "f4b8cf26-d2da-4a76-8345-69562de3cc11",
            "386d4a63-1194-4c0e-a18d-4d074a0b1f93",
            "a8622541-1896-4d54-8d10-7da2c800ec5c"
          ]
        }
      ]
    },
    {
      "BlockType": "LINE",
      "Confidence": 99.77413177490234,
      "Text": "1/15/2009",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.08799663186073303,
          "Height": 0.03832906484603882,
          "Left": 0.03175082430243492,
          "Top": 0.691371738910675
        },
        "Polygon": [
          {
            "X": 0.03175082430243492,
            "Y": 0.691371738910675
          },
          {
            "X": 0.11974745243787766,
            "Y": 0.691371738910675
          },
          {
            "X": 0.11974745243787766,
            "Y": 0.7297008037567139
          },
          {
            "X": 0.03175082430243492,
            "Y": 0.7297008037567139
          }
        ]
      },
      "Id": "61b20e27-ff8a-450a-a8b1-bc0259f82fd6",
      "Relationships": [
        {
          "Type": "CHILD",
          "Ids": [
            "da7a6482-0964-49a4-bc7d-56942ff3b4e1"
          ]
        }
      ]
    },
    {
      "BlockType": "LINE",
      "Confidence": 99.72286224365234,
      "Text": "6/30/2011",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.08843101561069489,
          "Height": 0.03991425037384033,
          "Left": 0.14642837643623352,
          "Top": 0.6919752955436707
        },
        "Polygon": [
          {
            "X": 0.14642837643623352,
            "Y": 0.6919752955436707
          },
          {
            "X": 0.2348593920469284,
            "Y": 0.6919752955436707
          },
          {
            "X": 0.2348593920469284,
            "Y": 0.731889545917511
          },
          {
            "X": 0.14642837643623352,
            "Y": 0.731889545917511
          }
        ]
      },
      "Id": "445f4fdd-c77b-4a7b-a2fc-6ca07cfe9ed7",
      "Relationships": [
        {
          "Type": "CHILD",
          "Ids": [
            "5a8da66a-ecce-4ee9-a765-a46d6cdc6cde"
          ]
        }
      ]
    },
    {
      "BlockType": "LINE",
      "Confidence": 99.86936950683594,
      "Text": "Any Company",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.11800950765609741,
          "Height": 0.03943679481744766,
          "Left": 0.2626699209213257,
          "Top": 0.6972727179527283
        },
        "Polygon": [
          {
            "X": 0.2626699209213257,
            "Y": 0.6972727179527283
          },
          {
            "X": 0.3806794285774231,
            "Y": 0.6972727179527283
          },
          {
            "X": 0.3806794285774231,
            "Y": 0.736709475517273
          },
          {
            "X": 0.2626699209213257,
            "Y": 0.736709475517273
          }
        ]
      },
      "Id": "359f3870-7183-43f5-b638-970f5cefe4d5",
      "Relationships": [
        {
          "Type": "CHILD",
          "Ids": [
            "77749c2b-aa7f-450e-8dd2-62bcaf253ba2",
            "713bad19-158d-4e3e-b01f-f5707ddb04e5"
          ]
        }
      ]
    },
    {
      "BlockType": "LINE",
      "Confidence": 99.582275390625,
      "Text": "Assistant baker",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.13280922174453735,
          "Height": 0.032666124403476715,
          "Left": 0.49814170598983765,
          "Top": 0.699238657951355
        },
        "Polygon": [
          {
            "X": 0.49814170598983765,
            "Y": 0.699238657951355
          },
          {
            "X": 0.630950927734375,
            "Y": 0.699238657951355
          },
          {
            "X": 0.630950927734375,
            "Y": 0.7319048047065735
          },
          {
            "X": 0.49814170598983765,
            "Y": 0.7319048047065735
          }
        ]
      },
      "Id": "b9deea0a-244c-4d54-b774-cf03fbaaa8b1",
      "Relationships": [
        {
          "Type": "CHILD",
          "Ids": [
            "989944f9-f684-4714-87d8-9ad9a321d65c",
            "ae82e2aa-1601-4e0c-8340-1db7ad0c9a31"
          ]
        }
      ]
    },
    {
      "BlockType": "LINE",
      "Confidence": 99.96180725097656,
      "Text": "relocated",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.08668994903564453,
          "Height": 0.033302485942840576,
          "Left": 0.7426905632019043,
          "Top": 0.6974037289619446
        },
        "Polygon": [
          {
            "X": 0.7426905632019043,
            "Y": 0.6974037289619446
          },
          {
            "X": 0.8293805122375488,
            "Y": 0.6974037289619446
          },
          {
            "X": 0.8293805122375488,
            "Y": 0.7307062149047852
          },
          {
            "X": 0.7426905632019043,
            "Y": 0.7307062149047852
          }
        ]
      },
      "Id": "e2a43881-f620-44f2-b067-500ce7dc8d4d",
      "Relationships": [
        {
          "Type": "CHILD",
          "Ids": [
            "a9cf9a8c-fdaa-413e-9346-5a28a98aebdb"
          ]
        }
      ]
    },
    {
      "BlockType": "LINE",
      "Confidence": 99.98190307617188,
      "Text": "7/1/2011",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.09747002273797989,
          "Height": 0.07067441940307617,
          "Left": 0.028500309213995934,
          "Top": 0.7745237946510315
        },
        "Polygon": [
          {
            "X": 0.028500309213995934,
            "Y": 0.7745237946510315
          },
          {
            "X": 0.12597033381462097,
            "Y": 0.7745237946510315
          },
          {
            "X": 0.12597033381462097,
            "Y": 0.8451982140541077
          },
          {
            "X": 0.028500309213995934,
            "Y": 0.8451982140541077
          }
        ]
      },
      "Id": "41756974-64ef-432d-b4b2-34702505975a",
      "Relationships": [
        {
          "Type": "CHILD",
          "Ids": [
            "0f711065-1872-442a-ba6d-8fababaa452a"
          ]
        }
      ]
    },
    {
      "BlockType": "LINE",
      "Confidence": 99.98418426513672,
      "Text": "8/10/2013",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.10664612054824829,
          "Height": 0.06439518928527832,
          "Left": 0.14159755408763885,
          "Top": 0.7791688442230225
        },
        "Polygon": [
          {
            "X": 0.14159755408763885,
            "Y": 0.7791688442230225
          },
          {
            "X": 0.24824367463588715,
            "Y": 0.7791688442230225
          },
          {
            "X": 0.24824367463588715,
            "Y": 0.8435640335083008
          },
          {
            "X": 0.14159755408763885,
            "Y": 0.8435640335083008
          }
        ]
      },
      "Id": "93d96d32-8b4a-4a98-9578-8b4df4f227a6",
      "Relationships": [
        {
          "Type": "CHILD",
          "Ids": [
            "a92d8eef-db28-45ba-801a-5da0f589d277"
          ]
        }
      ]
    },
    {
      "BlockType": "LINE",
      "Confidence": 99.98075866699219,
      "Text": "Example Corp.",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.2114926278591156,
          "Height": 0.058415766805410385,
          "Left": 0.26764172315597534,
          "Top": 0.794414758682251
        },
        "Polygon": [
          {
            "X": 0.26764172315597534,
            "Y": 0.794414758682251
          },
          {
            "X": 0.47913435101509094,
            "Y": 0.794414758682251
          },
          {
            "X": 0.47913435101509094,
            "Y": 0.8528305292129517
          },
          {
            "X": 0.26764172315597534,
            "Y": 0.8528305292129517
          }
        ]
      },
      "Id": "bc907357-63d6-43c0-ab87-80d7e76d377e",
      "Relationships": [
        {
          "Type": "CHILD",
          "Ids": [
            "d6962efb-34ab-4ffb-9f2f-5f263e813558",
            "1876c8ea-d3e8-4c39-870e-47512b3b5080"
          ]
        }
      ]
    },
    {
      "BlockType": "LINE",
      "Confidence": 99.91166687011719,
      "Text": "Baker",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.09931200742721558,
          "Height": 0.06008726358413696,
          "Left": 0.5098910331726074,
          "Top": 0.787897527217865
        },
        "Polygon": [
          {
            "X": 0.5098910331726074,
            "Y": 0.787897527217865
          },
          {
            "X": 0.609203040599823,
            "Y": 0.787897527217865
          },
          {
            "X": 0.609203040599823,
            "Y": 0.847984790802002
          },
          {
            "X": 0.5098910331726074,
            "Y": 0.847984790802002
          }
        ]
      },
      "Id": "2d727ca7-3acb-4bb9-a564-5885c90e9325",
      "Relationships": [
        {
          "Type": "CHILD",
          "Ids": [
            "00adeaef-ed57-44eb-b8a9-503575236d62"
          ]
        }
      ]
    },
    {
      "BlockType": "LINE",
      "Confidence": 99.93852233886719,
      "Text": "better opp.",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.18919607996940613,
          "Height": 0.06994765996932983,
          "Left": 0.7428008317947388,
          "Top": 0.7928366661071777
        },
        "Polygon": [
          {
            "X": 0.7428008317947388,
            "Y": 0.7928366661071777
          },
          {
            "X": 0.9319968819618225,
            "Y": 0.7928366661071777
          },
          {
            "X": 0.9319968819618225,
            "Y": 0.8627843260765076
          },
          {
            "X": 0.7428008317947388,
            "Y": 0.8627843260765076
          }
        ]
      },
      "Id": "f32a5989-cbfb-41e6-b0fc-ce1c77c014bd",
      "Relationships": [
        {
          "Type": "CHILD",
          "Ids": [
            "c0fc9a58-7a4b-4f69-bafd-2cff32be2665",
            "bf6dc8ee-2fb3-4b6c-aee4-31e96912a2d8"
          ]
        }
      ]
    },
    {
      "BlockType": "LINE",
      "Confidence": 99.92573547363281,
      "Text": "8/15/2013",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.10257463902235031,
          "Height": 0.05412459373474121,
          "Left": 0.027909137308597565,
          "Top": 0.8608770370483398
        },
        "Polygon": [
          {
            "X": 0.027909137308597565,
            "Y": 0.8608770370483398
          },
          {
            "X": 0.13048377633094788,
            "Y": 0.8608770370483398
          },
          {
            "X": 0.13048377633094788,
            "Y": 0.915001630783081
          },
          {
            "X": 0.027909137308597565,
            "Y": 0.915001630783081
          }
        ]
      },
      "Id": "e0ba06d0-dbb6-4962-8047-8cac3adfe45a",
      "Relationships": [
        {
          "Type": "CHILD",
          "Ids": [
            "5384f860-f857-4a94-9438-9dfa20eed1c6"
          ]
        }
      ]
    },
    {
      "BlockType": "LINE",
      "Confidence": 99.99625396728516,
      "Text": "Present",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.09982697665691376,
          "Height": 0.06888341903686523,
          "Left": 0.1420602649450302,
          "Top": 0.8511748909950256
        },
        "Polygon": [
          {
            "X": 0.1420602649450302,
            "Y": 0.8511748909950256
          },
          {
            "X": 0.24188724160194397,
            "Y": 0.8511748909950256
          },
          {
            "X": 0.24188724160194397,
            "Y": 0.9200583100318909
          },
          {
            "X": 0.1420602649450302,
            "Y": 0.9200583100318909
          }
        ]
      },
      "Id": "b6ed204d-ae01-4b75-bb91-c85d4147a37e",
      "Relationships": [
        {
          "Type": "CHILD",
          "Ids": [
            "0bb96ed6-b2e6-4da4-90b3-b85561bbd89d"
          ]
        }
      ]
    },
    {
      "BlockType": "LINE",
      "Confidence": 99.9826431274414,
      "Text": "AnyCompany",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.18611276149749756,
          "Height": 0.08581399917602539,
          "Left": 0.2615866959095001,
          "Top": 0.869536280632019
        },
        "Polygon": [
          {
            "X": 0.2615866959095001,
            "Y": 0.869536280632019
          },
          {
            "X": 0.4476994574069977,
            "Y": 0.869536280632019
          },
          {
            "X": 0.4476994574069977,
            "Y": 0.9553502798080444
          },
          {
            "X": 0.2615866959095001,
            "Y": 0.9553502798080444
          }
        ]
      },
      "Id": "ac4b9ee0-c9b2-4239-a741-5753e5282033",
      "Relationships": [
        {
          "Type": "CHILD",
          "Ids": [
            "25343360-d906-440a-88b7-92eb89e95949"
          ]
        }
      ]
    },
    {
      "BlockType": "LINE",
      "Confidence": 99.99549102783203,
      "Text": "head baker",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.1937451809644699,
          "Height": 0.056156039237976074,
          "Left": 0.49359121918678284,
          "Top": 0.8702592849731445
        },
        "Polygon": [
          {
            "X": 0.49359121918678284,
            "Y": 0.8702592849731445
          },
          {
            "X": 0.6873363852500916,
            "Y": 0.8702592849731445
          },
          {
            "X": 0.6873363852500916,
            "Y": 0.9264153242111206
          },
          {
            "X": 0.49359121918678284,
            "Y": 0.9264153242111206
          }
        ]
      },
      "Id": "ebc18885-48d7-45b8-90e3-d172b4357802",
      "Relationships": [
        {
          "Type": "CHILD",
          "Ids": [
            "0ef3c194-8322-4575-94f1-82819ee57e3a",
            "d296acd9-3e9a-4985-95f8-f863614f2c46"
          ]
        }
      ]
    },
    {
      "BlockType": "LINE",
      "Confidence": 99.98360443115234,
      "Text": "N/A, current",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.22544169425964355,
          "Height": 0.06588292121887207,
          "Left": 0.7411766648292542,
          "Top": 0.8722732067108154
        },
        "Polygon": [
          {
            "X": 0.7411766648292542,
            "Y": 0.8722732067108154
          },
          {
            "X": 0.9666183590888977,
            "Y": 0.8722732067108154
          },
          {
            "X": 0.9666183590888977,
            "Y": 0.9381561279296875
          },
          {
            "X": 0.7411766648292542,
            "Y": 0.9381561279296875
          }
        ]
      },
      "Id": "babf6360-789e-49c1-9c78-0784acc14a0c",
      "Relationships": [
        {
          "Type": "CHILD",
          "Ids": [
            "195cfb5b-ae06-4203-8520-4e4b0a73b5ce",
            "549ef3f9-3a13-4b77-bc25-fb2e0996839a"
          ]
        }
      ]
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.94815826416016,
      "Text": "Employment",
      "TextType": "PRINTED",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.17462396621704102,
          "Height": 0.06266549974679947,
          "Left": 0.29548385739326477,
          "Top": 0.03389188274741173
        },
        "Polygon": [
          {
            "X": 0.29548385739326477,
            "Y": 0.03389188274741173
          },
          {
            "X": 0.4701078236103058,
            "Y": 0.03389188274741173
          },
          {
            "X": 0.4701078236103058,
            "Y": 0.0965573862195015
          },
          {
            "X": 0.29548385739326477,
            "Y": 0.0965573862195015
          }
        ]
      },
      "Id": "ed48dacc-d089-498f-8e93-1cee1e5f39f3"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.92706298828125,
      "Text": "Application",
      "TextType": "PRINTED",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.15933875739574432,
          "Height": 0.062391020357608795,
          "Left": 0.47528234124183655,
          "Top": 0.027493247762322426
        },
        "Polygon": [
          {
            "X": 0.47528234124183655,
            "Y": 0.027493247762322426
          },
          {
            "X": 0.6346211433410645,
            "Y": 0.027493247762322426
          },
          {
            "X": 0.6346211433410645,
            "Y": 0.08988427370786667
          },
          {
            "X": 0.47528234124183655,
            "Y": 0.08988427370786667
          }
        ]
      },
      "Id": "ac7370f3-cbb7-4cd9-a8f9-bdcb2252caaf"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.9821548461914,
      "Text": "Application",
      "TextType": "PRINTED",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.09610454738140106,
          "Height": 0.03656719997525215,
          "Left": 0.03988289833068848,
          "Top": 0.14147649705410004
        },
        "Polygon": [
          {
            "X": 0.03988289833068848,
            "Y": 0.14147649705410004
          },
          {
            "X": 0.13598744571208954,
            "Y": 0.14147649705410004
          },
          {
            "X": 0.13598744571208954,
            "Y": 0.1780436933040619
          },
          {
            "X": 0.03988289833068848,
            "Y": 0.1780436933040619
          }
        ]
      },
      "Id": "efe3fc6d-becb-4520-80ee-49a329386aee"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.84278106689453,
      "Text": "Information",
      "TextType": "PRINTED",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.10029315203428268,
          "Height": 0.03209415823221207,
          "Left": 0.13837480545043945,
          "Top": 0.14050349593162537
        },
        "Polygon": [
          {
            "X": 0.13837480545043945,
            "Y": 0.14050349593162537
          },
          {
            "X": 0.23866795003414154,
            "Y": 0.14050349593162537
          },
          {
            "X": 0.23866795003414154,
            "Y": 0.17259766161441803
          },
          {
            "X": 0.13837480545043945,
            "Y": 0.17259766161441803
          }
        ]
      },
      "Id": "c2260852-6cfd-4a71-9fc6-62b2f9b02355"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.83993530273438,
      "Text": "Full",
      "TextType": "PRINTED",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.03039788082242012,
          "Height": 0.031106330454349518,
          "Left": 0.03899926319718361,
          "Top": 0.21361036598682404
        },
        "Polygon": [
          {
            "X": 0.03899926319718361,
            "Y": 0.21361036598682404
          },
          {
            "X": 0.06939714401960373,
            "Y": 0.21361036598682404
          },
          {
            "X": 0.06939714401960373,
            "Y": 0.24471670389175415
          },
          {
            "X": 0.03899926319718361,
            "Y": 0.24471670389175415
          }
        ]
      },
      "Id": "e94eb587-9545-4215-b0fc-8e8cb1172958"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.93611907958984,
      "Text": "Name:",
      "TextType": "PRINTED",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.05555811896920204,
          "Height": 0.030184319242835045,
          "Left": 0.07123806327581406,
          "Top": 0.2137702852487564
        },
        "Polygon": [
          {
            "X": 0.07123806327581406,
            "Y": 0.2137702852487564
          },
          {
            "X": 0.1267961859703064,
            "Y": 0.2137702852487564
          },
          {
            "X": 0.1267961859703064,
            "Y": 0.2439546138048172
          },
          {
            "X": 0.07123806327581406,
            "Y": 0.2439546138048172
          }
        ]
      },
      "Id": "090aeba5-8428-4b7a-a54b-7a95a774120e"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.91043853759766,
      "Text": "Jane",
      "TextType": "PRINTED",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.03905024006962776,
          "Height": 0.02941947989165783,
          "Left": 0.12933772802352905,
          "Top": 0.214289128780365
        },
        "Polygon": [
          {
            "X": 0.12933772802352905,
            "Y": 0.214289128780365
          },
          {
            "X": 0.16838796436786652,
            "Y": 0.214289128780365
          },
          {
            "X": 0.16838796436786652,
            "Y": 0.24370861053466797
          },
          {
            "X": 0.12933772802352905,
            "Y": 0.24370861053466797
          }
        ]
      },
      "Id": "64ff0abb-736b-4a6b-aa8d-ad2c0086ae1d"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.86123657226562,
      "Text": "Doe",
      "TextType": "PRINTED",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.035229459404945374,
          "Height": 0.030427640303969383,
          "Left": 0.17110899090766907,
          "Top": 0.21377210319042206
        },
        "Polygon": [
          {
            "X": 0.17110899090766907,
            "Y": 0.21377210319042206
          },
          {
            "X": 0.20633845031261444,
            "Y": 0.21377210319042206
          },
          {
            "X": 0.20633845031261444,
            "Y": 0.244199737906456
          },
          {
            "X": 0.17110899090766907,
            "Y": 0.244199737906456
          }
        ]
      },
      "Id": "565ffc30-89d6-4295-b8c6-d22b4ed76584"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.92633056640625,
      "Text": "Phone",
      "TextType": "PRINTED",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.052783288061618805,
          "Height": 0.03104414977133274,
          "Left": 0.03604753687977791,
          "Top": 0.28701552748680115
        },
        "Polygon": [
          {
            "X": 0.03604753687977791,
            "Y": 0.28701552748680115
          },
          {
            "X": 0.08883082121610641,
            "Y": 0.28701552748680115
          },
          {
            "X": 0.08883082121610641,
            "Y": 0.31805968284606934
          },
          {
            "X": 0.03604753687977791,
            "Y": 0.31805968284606934
          }
        ]
      },
      "Id": "d782f847-225b-4a1b-b52d-f252f8221b1f"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.86275482177734,
      "Text": "Number:",
      "TextType": "PRINTED",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.07424934208393097,
          "Height": 0.030300479382276535,
          "Left": 0.0915418416261673,
          "Top": 0.28639692068099976
        },
        "Polygon": [
          {
            "X": 0.0915418416261673,
            "Y": 0.28639692068099976
          },
          {
            "X": 0.16579118371009827,
            "Y": 0.28639692068099976
          },
          {
            "X": 0.16579118371009827,
            "Y": 0.3166973888874054
          },
          {
            "X": 0.0915418416261673,
            "Y": 0.3166973888874054
          }
        ]
      },
      "Id": "fa69c5cd-c80d-4fac-81df-569edae8d259"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.97282409667969,
      "Text": "555-0100",
      "TextType": "HANDWRITING",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.17021971940994263,
          "Height": 0.047169629484415054,
          "Left": 0.17732827365398407,
          "Top": 0.2812676727771759
        },
        "Polygon": [
          {
            "X": 0.17732827365398407,
            "Y": 0.2812676727771759
          },
          {
            "X": 0.3475480079650879,
            "Y": 0.2812676727771759
          },
          {
            "X": 0.3475480079650879,
            "Y": 0.32843729853630066
          },
          {
            "X": 0.17732827365398407,
            "Y": 0.32843729853630066
          }
        ]
      },
      "Id": "d4bbc0f1-ae02-41cf-a26f-8a1e899968cc"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.66238403320312,
      "Text": "Home",
      "TextType": "PRINTED",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.049357783049345016,
          "Height": 0.03134990110993385,
          "Left": 0.03359385207295418,
          "Top": 0.36172014474868774
        },
        "Polygon": [
          {
            "X": 0.03359385207295418,
            "Y": 0.36172014474868774
          },
          {
            "X": 0.0829516351222992,
            "Y": 0.36172014474868774
          },
          {
            "X": 0.0829516351222992,
            "Y": 0.3930700421333313
          },
          {
            "X": 0.03359385207295418,
            "Y": 0.3930700421333313
          }
        ]
      },
      "Id": "acfbed90-4a00-42c6-8a90-d0a0756eea36"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.6871109008789,
      "Text": "Address:",
      "TextType": "PRINTED",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.07411003112792969,
          "Height": 0.0314042791724205,
          "Left": 0.08516156673431396,
          "Top": 0.3600046932697296
        },
        "Polygon": [
          {
            "X": 0.08516156673431396,
            "Y": 0.3600046932697296
          },
          {
            "X": 0.15927159786224365,
            "Y": 0.3600046932697296
          },
          {
            "X": 0.15927159786224365,
            "Y": 0.3914089798927307
          },
          {
            "X": 0.08516156673431396,
            "Y": 0.3914089798927307
          }
        ]
      },
      "Id": "046c8a40-bb0e-4718-9c71-954d3630e1dd"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.93781280517578,
      "Text": "123",
      "TextType": "HANDWRITING",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.05761868134140968,
          "Height": 0.05008566007018089,
          "Left": 0.1750781387090683,
          "Top": 0.35484206676483154
        },
        "Polygon": [
          {
            "X": 0.1750781387090683,
            "Y": 0.35484206676483154
          },
          {
            "X": 0.23269681632518768,
            "Y": 0.35484206676483154
          },
          {
            "X": 0.23269681632518768,
            "Y": 0.40492773056030273
          },
          {
            "X": 0.1750781387090683,
            "Y": 0.40492773056030273
          }
        ]
      },
      "Id": "82b838bc-4591-4287-8dea-60c94a4925e4"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.96530151367188,
      "Text": "Any",
      "TextType": "HANDWRITING",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.06814215332269669,
          "Height": 0.06354366987943649,
          "Left": 0.2550157308578491,
          "Top": 0.35471394658088684
        },
        "Polygon": [
          {
            "X": 0.2550157308578491,
            "Y": 0.35471394658088684
          },
          {
            "X": 0.3231579065322876,
            "Y": 0.35471394658088684
          },
          {
            "X": 0.3231579065322876,
            "Y": 0.41825762391090393
          },
          {
            "X": 0.2550157308578491,
            "Y": 0.41825762391090393
          }
        ]
      },
      "Id": "5cdcde7a-f5a6-4231-a941-b6396e42e7ba"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.87527465820312,
      "Text": "Street,",
      "TextType": "HANDWRITING",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.12156613171100616,
          "Height": 0.05449587106704712,
          "Left": 0.3357025980949402,
          "Top": 0.3550415635108948
        },
        "Polygon": [
          {
            "X": 0.3357025980949402,
            "Y": 0.3550415635108948
          },
          {
            "X": 0.45726871490478516,
            "Y": 0.3550415635108948
          },
          {
            "X": 0.45726871490478516,
            "Y": 0.4095374345779419
          },
          {
            "X": 0.3357025980949402,
            "Y": 0.4095374345779419
          }
        ]
      },
      "Id": "beafd497-185f-487e-b070-db4df5803e94"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.99514770507812,
      "Text": "Any",
      "TextType": "HANDWRITING",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.07748188823461533,
          "Height": 0.07339789718389511,
          "Left": 0.47723668813705444,
          "Top": 0.3482133150100708
        },
        "Polygon": [
          {
            "X": 0.47723668813705444,
            "Y": 0.3482133150100708
          },
          {
            "X": 0.554718554019928,
            "Y": 0.3482133150100708
          },
          {
            "X": 0.554718554019928,
            "Y": 0.4216112196445465
          },
          {
            "X": 0.47723668813705444,
            "Y": 0.4216112196445465
          }
        ]
      },
      "Id": "ef1b77fb-8ba6-41fe-ba53-dce039af22ed"
    },
    {
      "BlockType": "WORD",
      "Confidence": 96.80656433105469,
      "Text": "Town.",
      "TextType": "HANDWRITING",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.11213835328817368,
          "Height": 0.057233039289712906,
          "Left": 0.5563329458236694,
          "Top": 0.3331930637359619
        },
        "Polygon": [
          {
            "X": 0.5563329458236694,
            "Y": 0.3331930637359619
          },
          {
            "X": 0.6684713363647461,
            "Y": 0.3331930637359619
          },
          {
            "X": 0.6684713363647461,
            "Y": 0.3904260993003845
          },
          {
            "X": 0.5563329458236694,
            "Y": 0.3904260993003845
          }
        ]
      },
      "Id": "7b555310-e7f8-4cd2-bb3d-dcec37f3d90e"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.98260498046875,
      "Text": "USA",
      "TextType": "HANDWRITING",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.08771833777427673,
          "Height": 0.05706935003399849,
          "Left": 0.6889894604682922,
          "Top": 0.3258342146873474
        },
        "Polygon": [
          {
            "X": 0.6889894604682922,
            "Y": 0.3258342146873474
          },
          {
            "X": 0.7767078280448914,
            "Y": 0.3258342146873474
          },
          {
            "X": 0.7767078280448914,
            "Y": 0.3829035460948944
          },
          {
            "X": 0.6889894604682922,
            "Y": 0.3829035460948944
          }
        ]
      },
      "Id": "b479c24d-448d-40ef-9ed5-36a6ef08e5c7"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.9583969116211,
      "Text": "Mailing",
      "TextType": "PRINTED",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.06291338801383972,
          "Height": 0.03957144916057587,
          "Left": 0.03068041242659092,
          "Top": 0.43351811170578003
        },
        "Polygon": [
          {
            "X": 0.03068041242659092,
            "Y": 0.43351811170578003
          },
          {
            "X": 0.09359379857778549,
            "Y": 0.43351811170578003
          },
          {
            "X": 0.09359379857778549,
            "Y": 0.4730895459651947
          },
          {
            "X": 0.03068041242659092,
            "Y": 0.4730895459651947
          }
        ]
      },
      "Id": "d7261cdc-6ac5-4711-903c-4598fe94952d"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.87476348876953,
      "Text": "Address:",
      "TextType": "PRINTED",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.07364854216575623,
          "Height": 0.03147412836551666,
          "Left": 0.0954652726650238,
          "Top": 0.43450701236724854
        },
        "Polygon": [
          {
            "X": 0.0954652726650238,
            "Y": 0.43450701236724854
          },
          {
            "X": 0.16911381483078003,
            "Y": 0.43450701236724854
          },
          {
            "X": 0.16911381483078003,
            "Y": 0.465981125831604
          },
          {
            "X": 0.0954652726650238,
            "Y": 0.465981125831604
          }
        ]
      },
      "Id": "287f80c3-6db2-4dd7-90ec-5f017c80aa31"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.94071960449219,
      "Text": "same",
      "TextType": "PRINTED",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.04640670120716095,
          "Height": 0.026415130123496056,
          "Left": 0.17156922817230225,
          "Top": 0.44010937213897705
        },
        "Polygon": [
          {
            "X": 0.17156922817230225,
            "Y": 0.44010937213897705
          },
          {
            "X": 0.2179759293794632,
            "Y": 0.44010937213897705
          },
          {
            "X": 0.2179759293794632,
            "Y": 0.46652451157569885
          },
          {
            "X": 0.17156922817230225,
            "Y": 0.46652451157569885
          }
        ]
      },
      "Id": "ce31c3ad-b51e-4068-be64-5fc9794bc1bc"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.76510620117188,
      "Text": "as",
      "TextType": "PRINTED",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.02041218988597393,
          "Height": 0.025104399770498276,
          "Left": 0.2207803726196289,
          "Top": 0.44124215841293335
        },
        "Polygon": [
          {
            "X": 0.2207803726196289,
            "Y": 0.44124215841293335
          },
          {
            "X": 0.24119256436824799,
            "Y": 0.44124215841293335
          },
          {
            "X": 0.24119256436824799,
            "Y": 0.4663465619087219
          },
          {
            "X": 0.2207803726196289,
            "Y": 0.4663465619087219
          }
        ]
      },
      "Id": "e96eb92c-6774-4d6f-8f4a-68a7618d4c66"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.9301528930664,
      "Text": "above",
      "TextType": "PRINTED",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.05268359184265137,
          "Height": 0.03216424956917763,
          "Left": 0.24375422298908234,
          "Top": 0.4354657828807831
        },
        "Polygon": [
          {
            "X": 0.24375422298908234,
            "Y": 0.4354657828807831
          },
          {
            "X": 0.2964377999305725,
            "Y": 0.4354657828807831
          },
          {
            "X": 0.2964377999305725,
            "Y": 0.4676300287246704
          },
          {
            "X": 0.24375422298908234,
            "Y": 0.4676300287246704
          }
        ]
      },
      "Id": "88b85c05-427a-4d4f-8cc4-3667234e8364"
    },
    {
      "BlockType": "WORD",
      "Confidence": 85.3905029296875,
      "Text": "Previous",
      "TextType": "PRINTED",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.09860499948263168,
          "Height": 0.04000622034072876,
          "Left": 0.3194798231124878,
          "Top": 0.5194430351257324
        },
        "Polygon": [
          {
            "X": 0.3194798231124878,
            "Y": 0.5194430351257324
          },
          {
            "X": 0.4180848002433777,
            "Y": 0.5194430351257324
          },
          {
            "X": 0.4180848002433777,
            "Y": 0.5594492554664612
          },
          {
            "X": 0.3194798231124878,
            "Y": 0.5594492554664612
          }
        ]
      },
      "Id": "8b324501-bf38-4ce9-9777-6514b7ade760"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.14524841308594,
      "Text": "Employment",
      "TextType": "PRINTED",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.14039960503578186,
          "Height": 0.04645847901701927,
          "Left": 0.4214291274547577,
          "Top": 0.5219109654426575
        },
        "Polygon": [
          {
            "X": 0.4214291274547577,
            "Y": 0.5219109654426575
          },
          {
            "X": 0.5618287324905396,
            "Y": 0.5219109654426575
          },
          {
            "X": 0.5618287324905396,
            "Y": 0.568369448184967
          },
          {
            "X": 0.4214291274547577,
            "Y": 0.568369448184967
          }
        ]
      },
      "Id": "b0cea99a-5045-464d-ac8a-a63ab0470995"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.48454284667969,
      "Text": "History",
      "TextType": "PRINTED",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.08361124992370605,
          "Height": 0.05192042887210846,
          "Left": 0.5668527483940125,
          "Top": 0.5172380208969116
        },
        "Polygon": [
          {
            "X": 0.5668527483940125,
            "Y": 0.5172380208969116
          },
          {
            "X": 0.6504639983177185,
            "Y": 0.5172380208969116
          },
          {
            "X": 0.6504639983177185,
            "Y": 0.5691584348678589
          },
          {
            "X": 0.5668527483940125,
            "Y": 0.5691584348678589
          }
        ]
      },
      "Id": "b92a6ee5-ca59-44dc-9c47-534c133b11e7"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.78699493408203,
      "Text": "Start",
      "TextType": "PRINTED",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.041341401636600494,
          "Height": 0.030926469713449478,
          "Left": 0.034429505467414856,
          "Top": 0.6124123334884644
        },
        "Polygon": [
          {
            "X": 0.034429505467414856,
            "Y": 0.6124123334884644
          },
          {
            "X": 0.07577090710401535,
            "Y": 0.6124123334884644
          },
          {
            "X": 0.07577090710401535,
            "Y": 0.6433387994766235
          },
          {
            "X": 0.034429505467414856,
            "Y": 0.6433387994766235
          }
        ]
      },
      "Id": "ffe8b8e0-df59-4ac5-9aba-6b54b7c51b45"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.55198669433594,
      "Text": "Date",
      "TextType": "PRINTED",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.03923053666949272,
          "Height": 0.03072454035282135,
          "Left": 0.07830137014389038,
          "Top": 0.6123942136764526
        },
        "Polygon": [
          {
            "X": 0.07830137014389038,
            "Y": 0.6123942136764526
          },
          {
            "X": 0.1175319105386734,
            "Y": 0.6123942136764526
          },
          {
            "X": 0.1175319105386734,
            "Y": 0.6431187391281128
          },
          {
            "X": 0.07830137014389038,
            "Y": 0.6431187391281128
          }
        ]
      },
      "Id": "91e582cd-9871-4e9c-93cc-848baa426338"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.8897705078125,
      "Text": "End",
      "TextType": "PRINTED",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.03212086856365204,
          "Height": 0.03193363919854164,
          "Left": 0.14846202731132507,
          "Top": 0.6120467782020569
        },
        "Polygon": [
          {
            "X": 0.14846202731132507,
            "Y": 0.6120467782020569
          },
          {
            "X": 0.1805828958749771,
            "Y": 0.6120467782020569
          },
          {
            "X": 0.1805828958749771,
            "Y": 0.6439804434776306
          },
          {
            "X": 0.14846202731132507,
            "Y": 0.6439804434776306
          }
        ]
      },
      "Id": "7c97b56b-699f-49b0-93f4-98e6d90b107c"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.8445816040039,
      "Text": "Date",
      "TextType": "PRINTED",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.03987143933773041,
          "Height": 0.03142518177628517,
          "Left": 0.1844055950641632,
          "Top": 0.612853467464447
        },
        "Polygon": [
          {
            "X": 0.1844055950641632,
            "Y": 0.612853467464447
          },
          {
            "X": 0.22427703440189362,
            "Y": 0.612853467464447
          },
          {
            "X": 0.22427703440189362,
            "Y": 0.6442786455154419
          },
          {
            "X": 0.1844055950641632,
            "Y": 0.6442786455154419
          }
        ]
      },
      "Id": "7af04e27-0c15-447e-a569-b30edb99a133"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.9652328491211,
      "Text": "Employer",
      "TextType": "PRINTED",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.08150768280029297,
          "Height": 0.0392492301762104,
          "Left": 0.2647075653076172,
          "Top": 0.6140711903572083
        },
        "Polygon": [
          {
            "X": 0.2647075653076172,
            "Y": 0.6140711903572083
          },
          {
            "X": 0.34621524810791016,
            "Y": 0.6140711903572083
          },
          {
            "X": 0.34621524810791016,
            "Y": 0.6533204317092896
          },
          {
            "X": 0.2647075653076172,
            "Y": 0.6533204317092896
          }
        ]
      },
      "Id": "a9bfeb55-75cd-47cd-b953-728e602a3564"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.94273376464844,
      "Text": "Name",
      "TextType": "PRINTED",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.05018233880400658,
          "Height": 0.03248906135559082,
          "Left": 0.34925445914268494,
          "Top": 0.6162016987800598
        },
        "Polygon": [
          {
            "X": 0.34925445914268494,
            "Y": 0.6162016987800598
          },
          {
            "X": 0.3994368016719818,
            "Y": 0.6162016987800598
          },
          {
            "X": 0.3994368016719818,
            "Y": 0.6486907601356506
          },
          {
            "X": 0.34925445914268494,
            "Y": 0.6486907601356506
          }
        ]
      },
      "Id": "9f0f9c06-d02c-4b07-bb39-7ade70be2c1b"
    },
    {
      "BlockType": "WORD",
      "Confidence": 98.85071563720703,
      "Text": "Position",
      "TextType": "PRINTED",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.07007700204849243,
          "Height": 0.03255689889192581,
          "Left": 0.49973347783088684,
          "Top": 0.6164342164993286
        },
        "Polygon": [
          {
            "X": 0.49973347783088684,
            "Y": 0.6164342164993286
          },
          {
            "X": 0.5698104500770569,
            "Y": 0.6164342164993286
          },
          {
            "X": 0.5698104500770569,
            "Y": 0.6489911079406738
          },
          {
            "X": 0.49973347783088684,
            "Y": 0.6489911079406738
          }
        ]
      },
      "Id": "6d5edf02-845c-40e0-9514-e56d0d652ae0"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.86096954345703,
      "Text": "Held",
      "TextType": "PRINTED",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.04017873853445053,
          "Height": 0.03292537108063698,
          "Left": 0.5734874606132507,
          "Top": 0.614840030670166
        },
        "Polygon": [
          {
            "X": 0.5734874606132507,
            "Y": 0.614840030670166
          },
          {
            "X": 0.6136662364006042,
            "Y": 0.614840030670166
          },
          {
            "X": 0.6136662364006042,
            "Y": 0.6477653980255127
          },
          {
            "X": 0.5734874606132507,
            "Y": 0.6477653980255127
          }
        ]
      },
      "Id": "3297ab59-b237-45fb-ae60-a108f0c95ac2"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.97740936279297,
      "Text": "Reason",
      "TextType": "PRINTED",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.06497219949960709,
          "Height": 0.03248770162463188,
          "Left": 0.7430596351623535,
          "Top": 0.6136704087257385
        },
        "Polygon": [
          {
            "X": 0.7430596351623535,
            "Y": 0.6136704087257385
          },
          {
            "X": 0.8080317974090576,
            "Y": 0.6136704087257385
          },
          {
            "X": 0.8080317974090576,
            "Y": 0.6461580991744995
          },
          {
            "X": 0.7430596351623535,
            "Y": 0.6461580991744995
          }
        ]
      },
      "Id": "f4b8cf26-d2da-4a76-8345-69562de3cc11"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.98371887207031,
      "Text": "for",
      "TextType": "PRINTED",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.029645200818777084,
          "Height": 0.03462234139442444,
          "Left": 0.8108851909637451,
          "Top": 0.6117717623710632
        },
        "Polygon": [
          {
            "X": 0.8108851909637451,
            "Y": 0.6117717623710632
          },
          {
            "X": 0.8405303955078125,
            "Y": 0.6117717623710632
          },
          {
            "X": 0.8405303955078125,
            "Y": 0.6463940739631653
          },
          {
            "X": 0.8108851909637451,
            "Y": 0.6463940739631653
          }
        ]
      },
      "Id": "386d4a63-1194-4c0e-a18d-4d074a0b1f93"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.98424530029297,
      "Text": "leaving",
      "TextType": "PRINTED",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.06517849862575531,
          "Height": 0.040626998990774155,
          "Left": 0.8430007100105286,
          "Top": 0.6116235852241516
        },
        "Polygon": [
          {
            "X": 0.8430007100105286,
            "Y": 0.6116235852241516
          },
          {
            "X": 0.9081792235374451,
            "Y": 0.6116235852241516
          },
          {
            "X": 0.9081792235374451,
            "Y": 0.6522505879402161
          },
          {
            "X": 0.8430007100105286,
            "Y": 0.6522505879402161
          }
        ]
      },
      "Id": "a8622541-1896-4d54-8d10-7da2c800ec5c"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.77413177490234,
      "Text": "1/15/2009",
      "TextType": "PRINTED",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.08799663186073303,
          "Height": 0.03832906112074852,
          "Left": 0.03175082430243492,
          "Top": 0.691371738910675
        },
        "Polygon": [
          {
            "X": 0.03175082430243492,
            "Y": 0.691371738910675
          },
          {
            "X": 0.11974745243787766,
            "Y": 0.691371738910675
          },
          {
            "X": 0.11974745243787766,
            "Y": 0.7297008037567139
          },
          {
            "X": 0.03175082430243492,
            "Y": 0.7297008037567139
          }
        ]
      },
      "Id": "da7a6482-0964-49a4-bc7d-56942ff3b4e1"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.72286224365234,
      "Text": "6/30/2011",
      "TextType": "PRINTED",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.08843102306127548,
          "Height": 0.03991425037384033,
          "Left": 0.14642837643623352,
          "Top": 0.6919752955436707
        },
        "Polygon": [
          {
            "X": 0.14642837643623352,
            "Y": 0.6919752955436707
          },
          {
            "X": 0.2348593920469284,
            "Y": 0.6919752955436707
          },
          {
            "X": 0.2348593920469284,
            "Y": 0.731889545917511
          },
          {
            "X": 0.14642837643623352,
            "Y": 0.731889545917511
          }
        ]
      },
      "Id": "5a8da66a-ecce-4ee9-a765-a46d6cdc6cde"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.92295837402344,
      "Text": "Any",
      "TextType": "PRINTED",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.034067559987306595,
          "Height": 0.037968240678310394,
          "Left": 0.2626699209213257,
          "Top": 0.6972727179527283
        },
        "Polygon": [
          {
            "X": 0.2626699209213257,
            "Y": 0.6972727179527283
          },
          {
            "X": 0.2967374622821808,
            "Y": 0.6972727179527283
          },
          {
            "X": 0.2967374622821808,
            "Y": 0.7352409362792969
          },
          {
            "X": 0.2626699209213257,
            "Y": 0.7352409362792969
          }
        ]
      },
      "Id": "77749c2b-aa7f-450e-8dd2-62bcaf253ba2"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.81578063964844,
      "Text": "Company",
      "TextType": "PRINTED",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.08160992711782455,
          "Height": 0.03890080004930496,
          "Left": 0.29906952381134033,
          "Top": 0.6978086829185486
        },
        "Polygon": [
          {
            "X": 0.29906952381134033,
            "Y": 0.6978086829185486
          },
          {
            "X": 0.3806794583797455,
            "Y": 0.6978086829185486
          },
          {
            "X": 0.3806794583797455,
            "Y": 0.736709475517273
          },
          {
            "X": 0.29906952381134033,
            "Y": 0.736709475517273
          }
        ]
      },
      "Id": "713bad19-158d-4e3e-b01f-f5707ddb04e5"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.37964630126953,
      "Text": "Assistant",
      "TextType": "PRINTED",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.0789310410618782,
          "Height": 0.03139699995517731,
          "Left": 0.49814170598983765,
          "Top": 0.7005078196525574
        },
        "Polygon": [
          {
            "X": 0.49814170598983765,
            "Y": 0.7005078196525574
          },
          {
            "X": 0.5770727396011353,
            "Y": 0.7005078196525574
          },
          {
            "X": 0.5770727396011353,
            "Y": 0.7319048047065735
          },
          {
            "X": 0.49814170598983765,
            "Y": 0.7319048047065735
          }
        ]
      },
      "Id": "989944f9-f684-4714-87d8-9ad9a321d65c"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.784912109375,
      "Text": "baker",
      "TextType": "PRINTED",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.050264399498701096,
          "Height": 0.03237773850560188,
          "Left": 0.5806865096092224,
          "Top": 0.699238657951355
        },
        "Polygon": [
          {
            "X": 0.5806865096092224,
            "Y": 0.699238657951355
          },
          {
            "X": 0.630950927734375,
            "Y": 0.699238657951355
          },
          {
            "X": 0.630950927734375,
            "Y": 0.7316163778305054
          },
          {
            "X": 0.5806865096092224,
            "Y": 0.7316163778305054
          }
        ]
      },
      "Id": "ae82e2aa-1601-4e0c-8340-1db7ad0c9a31"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.96180725097656,
      "Text": "relocated",
      "TextType": "PRINTED",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.08668994158506393,
          "Height": 0.03330250084400177,
          "Left": 0.7426905632019043,
          "Top": 0.6974037289619446
        },
        "Polygon": [
          {
            "X": 0.7426905632019043,
            "Y": 0.6974037289619446
          },
          {
            "X": 0.8293805122375488,
            "Y": 0.6974037289619446
          },
          {
            "X": 0.8293805122375488,
            "Y": 0.7307062149047852
          },
          {
            "X": 0.7426905632019043,
            "Y": 0.7307062149047852
          }
        ]
      },
      "Id": "a9cf9a8c-fdaa-413e-9346-5a28a98aebdb"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.98190307617188,
      "Text": "7/1/2011",
      "TextType": "HANDWRITING",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.09747002273797989,
          "Height": 0.07067439705133438,
          "Left": 0.028500309213995934,
          "Top": 0.7745237946510315
        },
        "Polygon": [
          {
            "X": 0.028500309213995934,
            "Y": 0.7745237946510315
          },
          {
            "X": 0.12597033381462097,
            "Y": 0.7745237946510315
          },
          {
            "X": 0.12597033381462097,
            "Y": 0.8451982140541077
          },
          {
            "X": 0.028500309213995934,
            "Y": 0.8451982140541077
          }
        ]
      },
      "Id": "0f711065-1872-442a-ba6d-8fababaa452a"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.98418426513672,
      "Text": "8/10/2013",
      "TextType": "HANDWRITING",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.10664612054824829,
          "Height": 0.06439515948295593,
          "Left": 0.14159755408763885,
          "Top": 0.7791688442230225
        },
        "Polygon": [
          {
            "X": 0.14159755408763885,
            "Y": 0.7791688442230225
          },
          {
            "X": 0.24824367463588715,
            "Y": 0.7791688442230225
          },
          {
            "X": 0.24824367463588715,
            "Y": 0.843563973903656
          },
          {
            "X": 0.14159755408763885,
            "Y": 0.843563973903656
          }
        ]
      },
      "Id": "a92d8eef-db28-45ba-801a-5da0f589d277"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.97722625732422,
      "Text": "Example",
      "TextType": "HANDWRITING",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.12127546221017838,
          "Height": 0.05682983994483948,
          "Left": 0.26764172315597534,
          "Top": 0.794414758682251
        },
        "Polygon": [
          {
            "X": 0.26764172315597534,
            "Y": 0.794414758682251
          },
          {
            "X": 0.3889172077178955,
            "Y": 0.794414758682251
          },
          {
            "X": 0.3889172077178955,
            "Y": 0.8512446284294128
          },
          {
            "X": 0.26764172315597534,
            "Y": 0.8512446284294128
          }
        ]
      },
      "Id": "d6962efb-34ab-4ffb-9f2f-5f263e813558"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.98429870605469,
      "Text": "Corp.",
      "TextType": "HANDWRITING",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.07650306820869446,
          "Height": 0.05481306090950966,
          "Left": 0.4026312530040741,
          "Top": 0.7980174422264099
        },
        "Polygon": [
          {
            "X": 0.4026312530040741,
            "Y": 0.7980174422264099
          },
          {
            "X": 0.47913432121276855,
            "Y": 0.7980174422264099
          },
          {
            "X": 0.47913432121276855,
            "Y": 0.8528305292129517
          },
          {
            "X": 0.4026312530040741,
            "Y": 0.8528305292129517
          }
        ]
      },
      "Id": "1876c8ea-d3e8-4c39-870e-47512b3b5080"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.91166687011719,
      "Text": "Baker",
      "TextType": "HANDWRITING",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.09931197017431259,
          "Height": 0.06008723005652428,
          "Left": 0.5098910331726074,
          "Top": 0.787897527217865
        },
        "Polygon": [
          {
            "X": 0.5098910331726074,
            "Y": 0.787897527217865
          },
          {
            "X": 0.609203040599823,
            "Y": 0.787897527217865
          },
          {
            "X": 0.609203040599823,
            "Y": 0.8479847311973572
          },
          {
            "X": 0.5098910331726074,
            "Y": 0.8479847311973572
          }
        ]
      },
      "Id": "00adeaef-ed57-44eb-b8a9-503575236d62"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.98870849609375,
      "Text": "better",
      "TextType": "HANDWRITING",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.10782185196876526,
          "Height": 0.06207133084535599,
          "Left": 0.7428008317947388,
          "Top": 0.7928366661071777
        },
        "Polygon": [
          {
            "X": 0.7428008317947388,
            "Y": 0.7928366661071777
          },
          {
            "X": 0.8506226539611816,
            "Y": 0.7928366661071777
          },
          {
            "X": 0.8506226539611816,
            "Y": 0.8549079895019531
          },
          {
            "X": 0.7428008317947388,
            "Y": 0.8549079895019531
          }
        ]
      },
      "Id": "c0fc9a58-7a4b-4f69-bafd-2cff32be2665"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.8883285522461,
      "Text": "opp.",
      "TextType": "HANDWRITING",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.07421936094760895,
          "Height": 0.058906231075525284,
          "Left": 0.8577775359153748,
          "Top": 0.8038780689239502
        },
        "Polygon": [
          {
            "X": 0.8577775359153748,
            "Y": 0.8038780689239502
          },
          {
            "X": 0.9319969415664673,
            "Y": 0.8038780689239502
          },
          {
            "X": 0.9319969415664673,
            "Y": 0.8627843260765076
          },
          {
            "X": 0.8577775359153748,
            "Y": 0.8627843260765076
          }
        ]
      },
      "Id": "bf6dc8ee-2fb3-4b6c-aee4-31e96912a2d8"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.92573547363281,
      "Text": "8/15/2013",
      "TextType": "HANDWRITING",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.10257463902235031,
          "Height": 0.05412459000945091,
          "Left": 0.027909137308597565,
          "Top": 0.8608770370483398
        },
        "Polygon": [
          {
            "X": 0.027909137308597565,
            "Y": 0.8608770370483398
          },
          {
            "X": 0.13048377633094788,
            "Y": 0.8608770370483398
          },
          {
            "X": 0.13048377633094788,
            "Y": 0.915001630783081
          },
          {
            "X": 0.027909137308597565,
            "Y": 0.915001630783081
          }
        ]
      },
      "Id": "5384f860-f857-4a94-9438-9dfa20eed1c6"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.99625396728516,
      "Text": "Present",
      "TextType": "HANDWRITING",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.09982697665691376,
          "Height": 0.06888339668512344,
          "Left": 0.1420602649450302,
          "Top": 0.8511748909950256
        },
        "Polygon": [
          {
            "X": 0.1420602649450302,
            "Y": 0.8511748909950256
          },
          {
            "X": 0.24188724160194397,
            "Y": 0.8511748909950256
          },
          {
            "X": 0.24188724160194397,
            "Y": 0.9200583100318909
          },
          {
            "X": 0.1420602649450302,
            "Y": 0.9200583100318909
          }
        ]
      },
      "Id": "0bb96ed6-b2e6-4da4-90b3-b85561bbd89d"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.9826431274414,
      "Text": "AnyCompany",
      "TextType": "HANDWRITING",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.18611273169517517,
          "Height": 0.08581399917602539,
          "Left": 0.2615866959095001,
          "Top": 0.869536280632019
        },
        "Polygon": [
          {
            "X": 0.2615866959095001,
            "Y": 0.869536280632019
          },
          {
            "X": 0.4476994276046753,
            "Y": 0.869536280632019
          },
          {
            "X": 0.4476994276046753,
            "Y": 0.9553502798080444
          },
          {
            "X": 0.2615866959095001,
            "Y": 0.9553502798080444
          }
        ]
      },
      "Id": "25343360-d906-440a-88b7-92eb89e95949"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.99523162841797,
      "Text": "head",
      "TextType": "HANDWRITING",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.07429949939250946,
          "Height": 0.05485520139336586,
          "Left": 0.49359121918678284,
          "Top": 0.8714361190795898
        },
        "Polygon": [
          {
            "X": 0.49359121918678284,
            "Y": 0.8714361190795898
          },
          {
            "X": 0.5678907036781311,
            "Y": 0.8714361190795898
          },
          {
            "X": 0.5678907036781311,
            "Y": 0.926291286945343
          },
          {
            "X": 0.49359121918678284,
            "Y": 0.926291286945343
          }
        ]
      },
      "Id": "0ef3c194-8322-4575-94f1-82819ee57e3a"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.99574279785156,
      "Text": "baker",
      "TextType": "HANDWRITING",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.1019822508096695,
          "Height": 0.05615599825978279,
          "Left": 0.585354208946228,
          "Top": 0.8702592849731445
        },
        "Polygon": [
          {
            "X": 0.585354208946228,
            "Y": 0.8702592849731445
          },
          {
            "X": 0.6873364448547363,
            "Y": 0.8702592849731445
          },
          {
            "X": 0.6873364448547363,
            "Y": 0.9264153242111206
          },
          {
            "X": 0.585354208946228,
            "Y": 0.9264153242111206
          }
        ]
      },
      "Id": "d296acd9-3e9a-4985-95f8-f863614f2c46"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.9880599975586,
      "Text": "N/A,",
      "TextType": "HANDWRITING",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.08230073750019073,
          "Height": 0.06588289886713028,
          "Left": 0.7411766648292542,
          "Top": 0.8722732067108154
        },
        "Polygon": [
          {
            "X": 0.7411766648292542,
            "Y": 0.8722732067108154
          },
          {
            "X": 0.8234773874282837,
            "Y": 0.8722732067108154
          },
          {
            "X": 0.8234773874282837,
            "Y": 0.9381561279296875
          },
          {
            "X": 0.7411766648292542,
            "Y": 0.9381561279296875
          }
        ]
      },
      "Id": "195cfb5b-ae06-4203-8520-4e4b0a73b5ce"
    },
    {
      "BlockType": "WORD",
      "Confidence": 99.97914123535156,
      "Text": "current",
      "TextType": "HANDWRITING",
      "Geometry": {
        "BoundingBox": {
          "Width": 0.12791454792022705,
          "Height": 0.04768490046262741,
          "Left": 0.8387037515640259,
          "Top": 0.8843405842781067
        },
        "Polygon": [
          {
            "X": 0.8387037515640259,
            "Y": 0.8843405842781067
          },
          {
            "X": 0.9666182994842529,
            "Y": 0.8843405842781067
          },
          {
            "X": 0.9666182994842529,
            "Y": 0.9320254921913147
          },
          {
            "X": 0.8387037515640259,
            "Y": 0.9320254921913147
          }
        ]
      },
      "Id": "549ef3f9-3a13-4b77-bc25-fb2e0996839a"
    }
  ],
  "DetectDocumentTextModelVersion": "1.0",
  "ResponseMetadata": {
    "RequestId": "337129e6-3af7-4014-842b-f6484e82cbf6",
    "HTTPStatusCode": 200,
    "HTTPHeaders": {
      "x-amzn-requestid": "337129e6-3af7-4014-842b-f6484e82cbf6",
      "content-type": "application/x-amz-json-1.1",
      "content-length": "45675",
      "date": "Mon, 09 Nov 2020 23:54:38 GMT"
    },
    "RetryAttempts": 0
  }
}
}
```

# Amazon Textract でドキュメントテキストの検出
<a name="detecting-document-text"></a>

文書内のテキストを検出するには、[DetectDocumentText](API_DetectDocumentText.md)操作を行い、ドキュメントファイルを入力として渡します。`DetectDocumentText`検出されたテキストの行と単語、ドキュメント内のテキストの位置、および検出されたテキスト間の関係を含む JSON 構造を返します。詳細については、「[テキストの検出](how-it-works-detecting.md)」を参照してください。

入力ドキュメントとして、イメージのバイト配列 (base64 エンコードされたイメージのバイト) を指定するか、Amazon S3 オブジェクトを指定できます。以下の手順では、イメージファイルを S3 バケットにアップロードし、そのファイル名を指定します。

**ドキュメント内のテキストを検出するには (API)**

1. まだ実行していない場合:

   1. を使用して IAM ユーザーを作成または更新する`AmazonTextractFullAccess`そして`AmazonS3ReadOnlyAccess`アクセス許可。詳細については、「[ステップ 1: AWS アカウントを設定して IAM ユーザーの作成](setting-up.md#setting-up-iam)」を参照してください。

   1. AWS CLI と AWS SDK をインストールして設定します。詳細については、「[ステップ 2: のセットアップAWS CLIそしてAWSSDK](setup-awscli-sdk.md)」を参照してください。

1. ドキュメントを S3 バケットにアップロードします。

   手順については、以下を参照してください。[Amazon S3 へのオブジェクトのアップロード](https://docs.aws.amazon.com/AmazonS3/latest/user-guide/UploadingObjectsintoAmazonS3.html)の*Amazon Simple Storage Service ユーザーガイド*。

1. 以下の例を使用して、`DetectDocumentText` オペレーションを呼び出します。

------
#### [ Java ]

   次のサンプルコードは、検出されたテキストの行を囲むドキュメントとボックスを表示します。

   関数内で`main`で、の値を置き換えます。`bucket`そして`document`は、ステップ 2 で使用した Amazon S3 バケット名とドキュメント名を使用します。

   ```
   //Calls DetectDocumentText.
   //Loads document from S3 bucket. Displays the document and bounding boxes around detected lines/words of text.
   package com.amazonaws.samples;
   
   import java.awt.*;
   import java.awt.image.BufferedImage;
   import java.util.List;
   import javax.imageio.ImageIO;
   import javax.swing.*;
   import com.amazonaws.services.s3.AmazonS3;
   import com.amazonaws.services.s3.AmazonS3ClientBuilder;
   import com.amazonaws.services.s3.model.S3ObjectInputStream;
   import com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration;
   import com.amazonaws.services.textract.AmazonTextract;
   import com.amazonaws.services.textract.AmazonTextractClientBuilder;
   import com.amazonaws.services.textract.model.Block;
   import com.amazonaws.services.textract.model.BoundingBox;
   import com.amazonaws.services.textract.model.DetectDocumentTextRequest;
   import com.amazonaws.services.textract.model.DetectDocumentTextResult;
   import com.amazonaws.services.textract.model.Document;
   import com.amazonaws.services.textract.model.S3Object;
   import com.amazonaws.services.textract.model.Point;
   import com.amazonaws.services.textract.model.Relationship;
   
   public class DocumentText extends JPanel {
   
       private static final long serialVersionUID = 1L;
   
       BufferedImage image;
       DetectDocumentTextResult result;
   
       public DocumentText(DetectDocumentTextResult documentResult, BufferedImage bufImage) throws Exception {
           super();
           
           result = documentResult; // Results of text detection.
           image = bufImage; // The image containing the document.
   
       }
   
       // Draws the image and text bounding box.
       public void paintComponent(Graphics g) {
   
           int height = image.getHeight(this);
           int width = image.getWidth(this);
   
           Graphics2D g2d = (Graphics2D) g; // Create a Java2D version of g.
   
           // Draw the image.
           g2d.drawImage(image, 0, 0, image.getWidth(this) , image.getHeight(this), this);
   
           // Iterate through blocks and display polygons around lines of detected text.
           List<Block> blocks = result.getBlocks();
           for (Block block : blocks) {
               DisplayBlockInfo(block);
               if ((block.getBlockType()).equals("LINE")) {
                   ShowPolygon(height, width, block.getGeometry().getPolygon(), g2d);
                   /*
                     ShowBoundingBox(height, width, block.getGeometry().getBoundingBox(), g2d);
                    */
               } else { // its a word, so just show vertical lines.
                   ShowPolygonVerticals(height, width, block.getGeometry().getPolygon(), g2d);
               }
           }
       }
   
       // Show bounding box at supplied location.
       private void ShowBoundingBox(int imageHeight, int imageWidth, BoundingBox box, Graphics2D g2d) {
   
           float left = imageWidth * box.getLeft();
           float top = imageHeight * box.getTop();
   
           // Display bounding box.
           g2d.setColor(new Color(0, 212, 0));
           g2d.drawRect(Math.round(left), Math.round(top),
                   Math.round(imageWidth * box.getWidth()), Math.round(imageHeight * box.getHeight()));
   
       }
   
       // Shows polygon at supplied location
       private void ShowPolygon(int imageHeight, int imageWidth, List<Point> points, Graphics2D g2d) {
   
           g2d.setColor(new Color(0, 0, 0));
           Polygon polygon = new Polygon();
   
           // Construct polygon and display
           for (Point point : points) {
               polygon.addPoint((Math.round(point.getX() * imageWidth)),
                       Math.round(point.getY() * imageHeight));
           }
           g2d.drawPolygon(polygon);
       }
   
       // Draws only the vertical lines in the supplied polygon.
       private void ShowPolygonVerticals(int imageHeight, int imageWidth, List<Point> points, Graphics2D g2d) {
   
           g2d.setColor(new Color(0, 212, 0));
           Object[] parry = points.toArray();
           g2d.setStroke(new BasicStroke(2));
   
           g2d.drawLine(Math.round(((Point) parry[0]).getX() * imageWidth),
                   Math.round(((Point) parry[0]).getY() * imageHeight), Math.round(((Point) parry[3]).getX() * imageWidth),
                   Math.round(((Point) parry[3]).getY() * imageHeight));
   
           g2d.setColor(new Color(255, 0, 0));
           g2d.drawLine(Math.round(((Point) parry[1]).getX() * imageWidth),
                   Math.round(((Point) parry[1]).getY() * imageHeight), Math.round(((Point) parry[2]).getX() * imageWidth),
                   Math.round(((Point) parry[2]).getY() * imageHeight));
   
       }
       //Displays information from a block returned by text detection and text analysis
       private void DisplayBlockInfo(Block block) {
           System.out.println("Block Id : " + block.getId());
           if (block.getText()!=null)
               System.out.println("    Detected text: " + block.getText());
           System.out.println("    Type: " + block.getBlockType());
           
           if (block.getBlockType().equals("PAGE") !=true) {
               System.out.println("    Confidence: " + block.getConfidence().toString());
           }
           if(block.getBlockType().equals("CELL"))
           {
               System.out.println("    Cell information:");
               System.out.println("        Column: " + block.getColumnIndex());
               System.out.println("        Row: " + block.getRowIndex());
               System.out.println("        Column span: " + block.getColumnSpan());
               System.out.println("        Row span: " + block.getRowSpan());
   
           }
           
           System.out.println("    Relationships");
           List<Relationship> relationships=block.getRelationships();
           if(relationships!=null) {
               for (Relationship relationship : relationships) {
                   System.out.println("        Type: " + relationship.getType());
                   System.out.println("        IDs: " + relationship.getIds().toString());
               }
           } else {
               System.out.println("        No related Blocks");
           }
   
           System.out.println("    Geometry");
           System.out.println("        Bounding Box: " + block.getGeometry().getBoundingBox().toString());
           System.out.println("        Polygon: " + block.getGeometry().getPolygon().toString());
           
           List<String> entityTypes = block.getEntityTypes();
           
           System.out.println("    Entity Types");
           if(entityTypes!=null) {
               for (String entityType : entityTypes) {
                   System.out.println("        Entity Type: " + entityType);
               }
           } else {
               System.out.println("        No entity type");
           }
           if(block.getPage()!=null)
               System.out.println("    Page: " + block.getPage());            
           System.out.println();
       }
   
       public static void main(String arg[]) throws Exception {
           
           // The S3 bucket and document
           String document = "";
           String bucket = "";
   
           
           AmazonS3 s3client = AmazonS3ClientBuilder.standard()
                   .withEndpointConfiguration( 
                           new EndpointConfiguration("https://s3.amazonaws.com","us-east-1"))
                   .build();
           
                  
           // Get the document from S3
           com.amazonaws.services.s3.model.S3Object s3object = s3client.getObject(bucket, document);
           S3ObjectInputStream inputStream = s3object.getObjectContent();
           BufferedImage image = ImageIO.read(inputStream);
   
           // Call DetectDocumentText
           EndpointConfiguration endpoint = new EndpointConfiguration(
                   "https://textract.us-east-1.amazonaws.com", "us-east-1");
           AmazonTextract client = AmazonTextractClientBuilder.standard()
                   .withEndpointConfiguration(endpoint).build();
   
   
           DetectDocumentTextRequest request = new DetectDocumentTextRequest()
               .withDocument(new Document().withS3Object(new S3Object().withName(document).withBucket(bucket)));
   
           DetectDocumentTextResult result = client.detectDocumentText(request);
           
           // Create frame and panel.
           JFrame frame = new JFrame("RotateImage");
           frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
           DocumentText panel = new DocumentText(result, image);
           panel.setPreferredSize(new Dimension(image.getWidth() , image.getHeight() ));
           frame.setContentPane(panel);
           frame.pack();
           frame.setVisible(true);
   
       }
   }
   ```

------
#### [ AWS CLI ]

   この AWS CLI コマンドでは、`detect-document-text` CLI オペレーションの JSON 出力を表示します。

   の値を置換する`Bucket`そして`Name`ステップ 2 で使用した Amazon S3 バケット名とドキュメント名を指定します。

   ```
   aws textract detect-document-text \
    --document '{"S3Object":{"Bucket":"bucket","Name":"document"}}'
   ```

------
#### [ Python ]

   次のコード例では、テキスト行周辺のドキュメントとボックスを表示します。

   関数内で`main`で、の値を置き換えます。`bucket`そして`document`ステップ 2 で使用した Amazon S3 バケット名とドキュメント名を指定します。

   ```
   #Detects text in a document stored in an S3 bucket. Display polygon box around text and angled text 
   import boto3
   import io
   from io import BytesIO
   import sys
   
   import psutil
   import time
   
   import math
   from PIL import Image, ImageDraw, ImageFont
   
   
   # Displays information about a block returned by text detection and text analysis
   def DisplayBlockInformation(block):
       print('Id: {}'.format(block['Id']))
       if 'Text' in block:
           print('    Detected: ' + block['Text'])
       print('    Type: ' + block['BlockType'])
      
       if 'Confidence' in block:
           print('    Confidence: ' + "{:.2f}".format(block['Confidence']) + "%")
   
       if block['BlockType'] == 'CELL':
           print("    Cell information")
           print("        Column: " + str(block['ColumnIndex']))
           print("        Row: " + str(block['RowIndex']))
           print("        ColumnSpan: " + str(block['ColumnSpan']))
           print("        RowSpan: " + str(block['RowSpan']))    
       
       if 'Relationships' in block:
           print('    Relationships: {}'.format(block['Relationships']))
       print('    Geometry: ')
       print('        Bounding Box: {}'.format(block['Geometry']['BoundingBox']))
       print('        Polygon: {}'.format(block['Geometry']['Polygon']))
       
       if block['BlockType'] == "KEY_VALUE_SET":
           print ('    Entity Type: ' + block['EntityTypes'][0])
       if 'Page' in block:
           print('Page: ' + block['Page'])
       print()
   
   def process_text_detection(bucket, document):
   
       
       #Get the document from S3
       s3_connection = boto3.resource('s3')
                             
       s3_object = s3_connection.Object(bucket,document)
       s3_response = s3_object.get()
   
       stream = io.BytesIO(s3_response['Body'].read())
       image=Image.open(stream)
   
      
       # Detect text in the document
       
       client = boto3.client('textract')
       #process using image bytes                      
       #image_binary = stream.getvalue()
       #response = client.detect_document_text(Document={'Bytes': image_binary})
   
       #process using S3 object
       response = client.detect_document_text(
           Document={'S3Object': {'Bucket': bucket, 'Name': document}})
   
       #Get the text blocks
       blocks=response['Blocks']
       width, height =image.size  
       draw = ImageDraw.Draw(image)  
       print ('Detected Document Text')
      
       # Create image showing bounding box/polygon the detected lines/text
       for block in blocks:
               print('Type: ' + block['BlockType'])
               if block['BlockType'] != 'PAGE':
                   print('Detected: ' + block['Text'])
                   print('Confidence: ' + "{:.2f}".format(block['Confidence']) + "%")
   
               print('Id: {}'.format(block['Id']))
               if 'Relationships' in block:
                   print('Relationships: {}'.format(block['Relationships']))
               print('Bounding Box: {}'.format(block['Geometry']['BoundingBox']))
               print('Polygon: {}'.format(block['Geometry']['Polygon']))
               print()
               draw=ImageDraw.Draw(image)
               # Draw WORD - Green -  start of word, red - end of word
               if block['BlockType'] == "WORD":
                   draw.line([(width * block['Geometry']['Polygon'][0]['X'],
                   height * block['Geometry']['Polygon'][0]['Y']),
                   (width * block['Geometry']['Polygon'][3]['X'],
                   height * block['Geometry']['Polygon'][3]['Y'])],fill='green',
                   width=2)
               
                   draw.line([(width * block['Geometry']['Polygon'][1]['X'],
                   height * block['Geometry']['Polygon'][1]['Y']),
                   (width * block['Geometry']['Polygon'][2]['X'],
                   height * block['Geometry']['Polygon'][2]['Y'])],
                   fill='red',
                   width=2)    
   
                    
               # Draw box around entire LINE  
               if block['BlockType'] == "LINE":
                   points=[]
   
                   for polygon in block['Geometry']['Polygon']:
                       points.append((width * polygon['X'], height * polygon['Y']))
   
                   draw.polygon((points), outline='black')    
     
                   # Uncomment to draw bounding box
                   #box=block['Geometry']['BoundingBox']                    
                   #left = width * box['Left']
                   #top = height * box['Top']           
                   #draw.rectangle([left,top, left + (width * box['Width']), top +(height * box['Height'])],outline='black') 
   
   
       # Display the image
       image.show()
       # display image for 10 seconds
   
       
       return len(blocks)
   
   def main():
   
       bucket = ''
       document = ''
       block_count=process_text_detection(bucket,document)
       print("Blocks detected: " + str(block_count))
       
   if __name__ == "__main__":
       main()
   ```

------
#### [ Node.js ]

   次の Node.js サンプルコードは、検出されたテキスト行の周囲のドキュメントとボックスを表示し、コードの実行元のディレクトリに結果のイメージを出力します。これは、`image-size`そして`images`パッケージ。

   関数内で`main`で、の値を置き換えます。`bucket`そして`document`ステップ 2 で使用した Amazon S3 バケット名とドキュメント名を指定します。の値を置換する`regionConfig`アカウントが属しているリージョンの名前を指定します。

   ```
   async function main(){
   
   // Import AWS
   const AWS = require("aws-sdk")
   // Use Image-Size to get 
   const sizeOf = require('image-size');
   // Image tool to draw buffers
   const images = require("images");
   
   // Create a canvas and get the context
   const { createCanvas } = require('canvas')
   const canvas = createCanvas(200, 200)
   const ctx = canvas.getContext('2d')
   
   // Set variables
   const bucket = 'bucket-name' // the s3 bucket name
   const photo  = 'image-name' // the name of file
   const regionConfig = 'region'
   
   // Set region if needed
   AWS.config.update({region:regionConfig});
   
   // Connect to Textract
   const client = new AWS.Textract();
   // Connect to S3 to display image
   const s3 = new AWS.S3();
   
   // Define paramaters
   const params = {
     Document: {
       S3Object: {
         Bucket: bucket,
         Name: photo
       },
     },
   }
   
   // Function to display image
   async function getImage(){
     const imageData =  s3.getObject(
       {
           Bucket: bucket,
           Key: photo
         }
       
     ).promise();
     return imageData;
   }
   
   // get image
   var imageData = await getImage()
   
   // Get the height, width of the image
   const dimensions = sizeOf(imageData.Body)
   const width = dimensions.width
   const height = dimensions.height
   console.log(imageData.Body)
   console.log(width, height)
   
   canvas.width = width;
   canvas.height = height;
   
   try{
     // Call API and log response
     const res = await client.detectDocumentText(params).promise();
     var image = images(imageData.Body).size(width, height)
     //console.log the type of block, text, text type, and confidence
     res.Blocks.forEach(block => {
       console.log(`Block Type: ${block.BlockType}`),
       console.log(`Text: ${block.Text}`)
       console.log(`TextType: ${block.TextType}`)
       console.log(`Confidence: ${block.Confidence}`)
   
       // Draw box around detected text using polygons
       ctx.strokeStyle = 'rgba(0,0,0,0.5)';
       ctx.beginPath();
       block.Geometry.Polygon.forEach(({X, Y}) =>
       ctx.lineTo(width * X - 10, height * Y - 10)
       );
       ctx.closePath();
       ctx.stroke();
       console.log("-----")
     }) 
   
     // render image
     var buffer = canvas.toBuffer("image/png");
     image.draw(images(buffer), 10, 10)
     image.save("output-image.jpg");
     
   } catch (err){
   console.error(err);}
   
   }
   
   main()
   ```

------

1. 例を実行します。Python および Java の例には、ドキュメントイメージが表示されます。検出されたテキストの各行をブラックボックスで囲みます。緑色の縦線は、検出された単語の先頭です。赤い縦線は、検出された単語の終わりです。-AWS CLI例では、の JSON 出力のみを表示します。`DetectDocumentText`オペレーション.

# Amazon Textract を使用したドキュメントテキストの分析
<a name="analyzing-document-text"></a>

文書内のテキストを分析するには、[AnalyzeDocument](API_AnalyzeDocument.md)操作を行い、ドキュメントファイルを入力として渡します。`AnalyzeDocument`は、分析されたテキストを含む JSON 構造を返します。詳細については、「[ドキュメントを分析する](how-it-works-analyzing.md)」を参照してください。

入力ドキュメントとして、イメージのバイト配列 (base64 エンコードされたイメージのバイト) を指定するか、Amazon S3 オブジェクトを指定できます。以下の手順では、イメージファイルを S3 バケットにアップロードし、そのファイル名を指定します。

**ドキュメント内のテキストを分析するには (API)**

1. まだ実行していない場合:

   1. を使用して IAM ユーザーを作成または更新する`AmazonTextractFullAccess`そして`AmazonS3ReadOnlyAccess`アクセス許可。詳細については、「[ステップ 1: AWS アカウントを設定して IAM ユーザーの作成](setting-up.md#setting-up-iam)」を参照してください。

   1. AWS CLI と AWS SDK をインストールして設定します。詳細については、「[ステップ 2: のセットアップAWS CLIそしてAWSSDK](setup-awscli-sdk.md)」を参照してください。

1. ドキュメントが含まれているイメージを S3 バケットにアップロードします。

   手順については、以下を参照してください。[Amazon S3 へのオブジェクトのアップロード](https://docs.aws.amazon.com/AmazonS3/latest/user-guide/UploadingObjectsintoAmazonS3.html)の*Amazon Simple Storage Service ユーザーガイド*。

1. 以下の例を使用して、`AnalyzeDocument` オペレーションを呼び出します。

------
#### [ Java ]

   次のコード例では、検出されたアイテムの周りのドキュメントとボックスを表示します。

   関数内で`main`で、の値を置き換えます。`bucket`そして`document`ステップ 2 で使用した Amazon S3 バケット名とドキュメントイメージ名を指定します。

   ```
   //Loads document from S3 bucket. Displays the document and polygon around detected lines of text.
   package com.amazonaws.samples;
   
   import java.awt.*;
   import java.awt.image.BufferedImage;
   import java.util.List;
   import javax.imageio.ImageIO;
   import javax.swing.*;
   import com.amazonaws.services.s3.AmazonS3;
   import com.amazonaws.services.s3.AmazonS3ClientBuilder;
   import com.amazonaws.services.s3.model.S3ObjectInputStream;
   import com.amazonaws.services.textract.AmazonTextract;
   import com.amazonaws.services.textract.AmazonTextractClientBuilder;
   import com.amazonaws.services.textract.model.AnalyzeDocumentRequest;
   import com.amazonaws.services.textract.model.AnalyzeDocumentResult;
   import com.amazonaws.services.textract.model.Block;
   import com.amazonaws.services.textract.model.BoundingBox;
   import com.amazonaws.services.textract.model.Document;
   import com.amazonaws.services.textract.model.S3Object;
   import com.amazonaws.services.textract.model.Point;
   import com.amazonaws.services.textract.model.Relationship;
   import com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration;
   
   public class AnalyzeDocument extends JPanel {
   
       private static final long serialVersionUID = 1L;
   
       BufferedImage image;
   
       AnalyzeDocumentResult result;
   
       public AnalyzeDocument(AnalyzeDocumentResult documentResult, BufferedImage bufImage) throws Exception {
           super();
   
           result = documentResult; // Results of text detection.
           image = bufImage; // The image containing the document.
   
       }
   
       // Draws the image and text bounding box.
       public void paintComponent(Graphics g) {
   
           int height = image.getHeight(this);
           int width = image.getWidth(this);
   
           Graphics2D g2d = (Graphics2D) g; // Create a Java2D version of g.
   
           // Draw the image.
           g2d.drawImage(image, 0, 0, image.getWidth(this), image.getHeight(this), this);
   
           // Iterate through blocks and display bounding boxes around everything.
   
           List<Block> blocks = result.getBlocks();
           for (Block block : blocks) {
               DisplayBlockInfo(block);
               switch(block.getBlockType()) {
               
               case "KEY_VALUE_SET":
                   if (block.getEntityTypes().contains("KEY")){
                       ShowBoundingBox(height, width, block.getGeometry().getBoundingBox(), g2d, new Color(255,0,0));
                   }
                   else {  //VALUE
                       ShowBoundingBox(height, width, block.getGeometry().getBoundingBox(), g2d, new Color(0,255,0));
                   }
                   break;
               case "TABLE":
                   ShowBoundingBox(height, width, block.getGeometry().getBoundingBox(), g2d, new Color(0,0,255));
                   break;
               case "CELL":
                   ShowBoundingBox(height, width, block.getGeometry().getBoundingBox(), g2d, new Color(255,255,0));
                   break;
               case "SELECTION_ELEMENT":
                   if (block.getSelectionStatus().equals("SELECTED"))
                       ShowSelectedElement(height, width, block.getGeometry().getBoundingBox(), g2d, new Color(0,0,255));
                   break;    
               default:
                   //PAGE, LINE & WORD
                   //ShowBoundingBox(height, width, block.getGeometry().getBoundingBox(), g2d, new Color(200,200,0));
               }
           }
   
            // uncomment to show polygon around all blocks
            //ShowPolygon(height,width,block.getGeometry().getPolygon(),g2d);
         
         
       }
   
       // Show bounding box at supplied location.
       private void ShowBoundingBox(int imageHeight, int imageWidth, BoundingBox box, Graphics2D g2d, Color color) {
   
           float left = imageWidth * box.getLeft();
           float top = imageHeight * box.getTop();
   
           // Display bounding box.
           g2d.setColor(color);
           g2d.drawRect(Math.round(left), Math.round(top),
                   Math.round(imageWidth * box.getWidth()), Math.round(imageHeight * box.getHeight()));
   
       }
       private void ShowSelectedElement(int imageHeight, int imageWidth, BoundingBox box, Graphics2D g2d, Color color) {
   
           float left = imageWidth * box.getLeft();
           float top = imageHeight * box.getTop();
   
           // Display bounding box.
           g2d.setColor(color);
           g2d.fillRect(Math.round(left), Math.round(top),
                   Math.round(imageWidth * box.getWidth()), Math.round(imageHeight * box.getHeight()));
   
       }
   
       // Shows polygon at supplied location
       private void ShowPolygon(int imageHeight, int imageWidth, List<Point> points, Graphics2D g2d) {
   
           g2d.setColor(new Color(0, 0, 0));
           Polygon polygon = new Polygon();
   
           // Construct polygon and display
           for (Point point : points) {
               polygon.addPoint((Math.round(point.getX() * imageWidth)),
                       Math.round(point.getY() * imageHeight));
           }
           g2d.drawPolygon(polygon);
       }
       //Displays information from a block returned by text detection and text analysis
       private void DisplayBlockInfo(Block block) {
           System.out.println("Block Id : " + block.getId());
           if (block.getText()!=null)
               System.out.println("    Detected text: " + block.getText());
           System.out.println("    Type: " + block.getBlockType());
           
           if (block.getBlockType().equals("PAGE") !=true) {
               System.out.println("    Confidence: " + block.getConfidence().toString());
           }
           if(block.getBlockType().equals("CELL"))
           {
               System.out.println("    Cell information:");
               System.out.println("        Column: " + block.getColumnIndex());
               System.out.println("        Row: " + block.getRowIndex());
               System.out.println("        Column span: " + block.getColumnSpan());
               System.out.println("        Row span: " + block.getRowSpan());
   
           }
           
           System.out.println("    Relationships");
           List<Relationship> relationships=block.getRelationships();
           if(relationships!=null) {
               for (Relationship relationship : relationships) {
                   System.out.println("        Type: " + relationship.getType());
                   System.out.println("        IDs: " + relationship.getIds().toString());
               }
           } else {
               System.out.println("        No related Blocks");
           }
   
           System.out.println("    Geometry");
           System.out.println("        Bounding Box: " + block.getGeometry().getBoundingBox().toString());
           System.out.println("        Polygon: " + block.getGeometry().getPolygon().toString());
           
           List<String> entityTypes = block.getEntityTypes();
           
           System.out.println("    Entity Types");
           if(entityTypes!=null) {
               for (String entityType : entityTypes) {
                   System.out.println("        Entity Type: " + entityType);
               }
           } else {
               System.out.println("        No entity type");
           }
           
           if(block.getBlockType().equals("SELECTION_ELEMENT")) {
               System.out.print("    Selection element detected: ");
               if (block.getSelectionStatus().equals("SELECTED")){
                   System.out.println("Selected");
               }else {
                   System.out.println(" Not selected");
               }
           }
          
           if(block.getPage()!=null)
               System.out.println("    Page: " + block.getPage());            
           System.out.println();
       }
   
       public static void main(String arg[]) throws Exception {
   
           // The S3 bucket and document
           String document = "";
           String bucket = "";
   
           AmazonS3 s3client = AmazonS3ClientBuilder.standard()
                   .withEndpointConfiguration( 
                           new EndpointConfiguration("https://s3.amazonaws.com","us-east-1"))
                   .build();
           
                  
           // Get the document from S3
           com.amazonaws.services.s3.model.S3Object s3object = s3client.getObject(bucket, document);
           S3ObjectInputStream inputStream = s3object.getObjectContent();
           BufferedImage image = ImageIO.read(inputStream);
   
           // Call AnalyzeDocument 
           EndpointConfiguration endpoint = new EndpointConfiguration(
                   "https://textract.us-east-1.amazonaws.com", "us-east-1");
           AmazonTextract client = AmazonTextractClientBuilder.standard()
                   .withEndpointConfiguration(endpoint).build();
   
                   
           AnalyzeDocumentRequest request = new AnalyzeDocumentRequest()
                   .withFeatureTypes("TABLES","FORMS")
                    .withDocument(new Document().
                           withS3Object(new S3Object().withName(document).withBucket(bucket)));
   
   
           AnalyzeDocumentResult result = client.analyzeDocument(request);
   
           // Create frame and panel.
           JFrame frame = new JFrame("RotateImage");
           frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
           AnalyzeDocument panel = new AnalyzeDocument(result, image);
           panel.setPreferredSize(new Dimension(image.getWidth(), image.getHeight()));
           frame.setContentPane(panel);
           frame.pack();
           frame.setVisible(true); 
   
       }
   }
   ```

------
#### [ AWS CLI ]

   この AWS CLI コマンドでは、`detect-document-text` CLI オペレーションの JSON 出力を表示します。

   の値を置換する`Bucket`そして`Name`ステップ 2 で使用した Amazon S3 バケット名とドキュメント名を指定します。

   ```
   aws textract analyze-document \
    --document '{"S3Object":{"Bucket":"bucket","Name":"document"}}' \
    --feature-types '["TABLES","FORMS"]'
   ```

------
#### [ Python ]

   次のコード例では、検出されたアイテムの周りのドキュメントとボックスを表示します。

   関数内で`main`で、の値を置き換えます。`bucket`そして`document`ステップ 2 で使用した Amazon S3 バケット名とドキュメント名を指定します。

   ```
   #Analyzes text in a document stored in an S3 bucket. Display polygon box around text and angled text 
   import boto3
   import io
   from io import BytesIO
   import sys
   
   import math
   from PIL import Image, ImageDraw, ImageFont
   
   def ShowBoundingBox(draw,box,width,height,boxColor):
                
       left = width * box['Left']
       top = height * box['Top'] 
       draw.rectangle([left,top, left + (width * box['Width']), top +(height * box['Height'])],outline=boxColor)   
   
   def ShowSelectedElement(draw,box,width,height,boxColor):
                
       left = width * box['Left']
       top = height * box['Top'] 
       draw.rectangle([left,top, left + (width * box['Width']), top +(height * box['Height'])],fill=boxColor)  
   
   # Displays information about a block returned by text detection and text analysis
   def DisplayBlockInformation(block):
       print('Id: {}'.format(block['Id']))
       if 'Text' in block:
           print('    Detected: ' + block['Text'])
       print('    Type: ' + block['BlockType'])
      
       if 'Confidence' in block:
           print('    Confidence: ' + "{:.2f}".format(block['Confidence']) + "%")
   
       if block['BlockType'] == 'CELL':
           print("    Cell information")
           print("        Column:" + str(block['ColumnIndex']))
           print("        Row:" + str(block['RowIndex']))
           print("        Column Span:" + str(block['ColumnSpan']))
           print("        RowSpan:" + str(block['ColumnSpan']))    
       
       if 'Relationships' in block:
           print('    Relationships: {}'.format(block['Relationships']))
       print('    Geometry: ')
       print('        Bounding Box: {}'.format(block['Geometry']['BoundingBox']))
       print('        Polygon: {}'.format(block['Geometry']['Polygon']))
       
       if block['BlockType'] == "KEY_VALUE_SET":
           print ('    Entity Type: ' + block['EntityTypes'][0])
       
       if block['BlockType'] == 'SELECTION_ELEMENT':
           print('    Selection element detected: ', end='')
   
           if block['SelectionStatus'] =='SELECTED':
               print('Selected')
           else:
               print('Not selected')    
       
       if 'Page' in block:
           print('Page: ' + block['Page'])
       print()
   
   def process_text_analysis(bucket, document):
   
       #Get the document from S3
       s3_connection = boto3.resource('s3')
                             
       s3_object = s3_connection.Object(bucket,document)
       s3_response = s3_object.get()
   
       stream = io.BytesIO(s3_response['Body'].read())
       image=Image.open(stream)
   
       # Analyze the document
       client = boto3.client('textract')
       
       image_binary = stream.getvalue()
       response = client.analyze_document(Document={'Bytes': image_binary},
           FeatureTypes=["TABLES", "FORMS"])
   
       ### Alternatively, process using S3 object ###
       #response = client.analyze_document(
       #    Document={'S3Object': {'Bucket': bucket, 'Name': document}},
       #    FeatureTypes=["TABLES", "FORMS"])
   
       ### To use a local file ###
       # with open("pathToFile", 'rb') as img_file:
           ### To display image using PIL ###
       #    image = Image.open()
           ### Read bytes ###
       #    img_bytes = img_file.read()
       #    response = client.analyze_document(Document={'Bytes': img_bytes}, FeatureTypes=["TABLES", "FORMS"])
   
       
       #Get the text blocks
       blocks=response['Blocks']
       width, height =image.size  
       draw = ImageDraw.Draw(image)  
       print ('Detected Document Text')
      
       # Create image showing bounding box/polygon the detected lines/text
       for block in blocks:
   
           DisplayBlockInformation(block)
                
           draw=ImageDraw.Draw(image)
           if block['BlockType'] == "KEY_VALUE_SET":
               if block['EntityTypes'][0] == "KEY":
                   ShowBoundingBox(draw, block['Geometry']['BoundingBox'],width,height,'red')
               else:
                   ShowBoundingBox(draw, block['Geometry']['BoundingBox'],width,height,'green')  
               
           if block['BlockType'] == 'TABLE':
               ShowBoundingBox(draw, block['Geometry']['BoundingBox'],width,height, 'blue')
   
           if block['BlockType'] == 'CELL':
               ShowBoundingBox(draw, block['Geometry']['BoundingBox'],width,height, 'yellow')
           if block['BlockType'] == 'SELECTION_ELEMENT':
               if block['SelectionStatus'] =='SELECTED':
                   ShowSelectedElement(draw, block['Geometry']['BoundingBox'],width,height, 'blue')    
      
               #uncomment to draw polygon for all Blocks
               #points=[]
               #for polygon in block['Geometry']['Polygon']:
               #    points.append((width * polygon['X'], height * polygon['Y']))
               #draw.polygon((points), outline='blue')
               
       # Display the image
       image.show()
       return len(blocks)
   
   
   def main():
   
       bucket = ''
       document = ''
       block_count=process_text_analysis(bucket,document)
       print("Blocks detected: " + str(block_count))
       
   if __name__ == "__main__":
       main()
   ```

------
#### [ Node.js ]

   次のコード例では、検出されたアイテムの周りのドキュメントとボックスを表示します。

   以下のコードで、の値を置き換えます。`bucket`そして`photo`ステップ 2 で使用した Amazon S3 バケット名とドキュメント名を指定します。の値を置換する`region`アカウントに関連付けられているリージョンをアカウントに関連付けます。

   ```
   // Import required AWS SDK clients and commands for Node.js
   import { AnalyzeDocumentCommand } from  "@aws-sdk/client-textract";
   import  { TextractClient } from "@aws-sdk/client-textract";
   
   // Set the AWS Region.
   const REGION = "region"; //e.g. "us-east-1"
   // Create SNS service object.
   const textractClient = new TextractClient({ region: REGION });
   
   const bucket = 'buckets'
   const photo = 'photo'
   
   // Set params
   const params = {
       Document: {
         S3Object: {
           Bucket: bucket,
           Name: photo
         },
       },
       FeatureTypes: ['TABLES', 'FORMS'],
     }
   
   const displayBlockInfo = async (response) => {
       try {
           response.Blocks.forEach(block => {
               console.log(`ID: ${block.Id}`)
               console.log(`Block Type: ${block.BlockType}`)
               if ("Text" in block && block.Text !== undefined){
                   console.log(`Text: ${block.Text}`)
               }
               else{}
               if ("Confidence" in block && block.Confidence !== undefined){
                   console.log(`Confidence: ${block.Confidence}`)
               }
               else{}
               if (block.BlockType == 'CELL'){
                   console.log("Cell info:")
                   console.log(`   Column Index - ${block.ColumnIndex}`)
                   console.log(`   Row - ${block.RowIndex}`)
                   console.log(`   Column Span - ${block.ColumnSpan}`)
                   console.log(`   Row Span - ${block.RowSpan}`)
               }
               if ("Relationships" in block && block.Relationships !== undefined){
                   console.log(block.Relationships)
                   console.log("Geometry:")
                   console.log(`   Bounding Box - ${JSON.stringify(block.Geometry.BoundingBox)}`)
                   console.log(`   Polygon - ${JSON.stringify(block.Geometry.Polygon)}`)
               }
               console.log("-----")
           });
         } catch (err) {
           console.log("Error", err);
         }
   }
   
   const analyze_document_text = async () => {
       try {
           const analyzeDoc = new AnalyzeDocumentCommand(params);
           const response = await textractClient.send(analyzeDoc);
           //console.log(response)
           displayBlockInfo(response)
           return response; // For unit tests.
         } catch (err) {
           console.log("Error", err);
         }
   }
   
   analyze_document_text()
   ```

------

1. 例を実行します。Python および Java の例では、次のカラーのバウンディングボックスでドキュメントイメージを表示します。
   + 赤 — キーブロックオブジェクト 
   + 緑 — VALUE ブロックオブジェクト
   + 青 — TABLE ブロックオブジェクト
   + 黄色 — CELL ブロックオブジェクト

   選択された選択エレメントは青で塗りつぶされます。

   -AWS CLI例では、の JSON 出力のみを表示します。`AnalyzeDocument`オペレーション.

# Amazon Textract を使用した請求書と領収書の分析
<a name="analyzing-document-expense"></a>

請求書および領収書文書を分析するには、AnalyzeExpense API を使用し、ドキュメントファイルを入力として渡します。`AnalyzeExpense`は、分析されたテキストを含む JSON 構造体を返す同期操作です。詳細については、「[請求書と領収書の分析](invoices-receipts.md)」を参照してください。

請求書と領収書を非同期に分析するには、`StartExpenseAnalysis`入力ドキュメントファイルの処理を開始し、`GetExpenseAnalysis`結果を取得します。

入力ドキュメントとして、イメージのバイト配列 (base64 エンコードされたイメージのバイト) を指定するか、Amazon S3 オブジェクトを指定できます。以下の手順では、イメージファイルを S3 バケットにアップロードし、そのファイル名を指定します。

**請求書または領収書を分析するには (API)**

1. まだ実行していない場合:

   1. を使用して IAM ユーザーを作成または更新する`AmazonTextractFullAccess`そして`AmazonS3ReadOnlyAccess`アクセス許可。詳細については、「[ステップ 1: AWS アカウントを設定して IAM ユーザーの作成](setting-up.md#setting-up-iam)」を参照してください。

   1. AWS CLI と AWS SDK をインストールして設定します。詳細については、「[ステップ 2: のセットアップAWS CLIそしてAWSSDK](setup-awscli-sdk.md)」を参照してください。

1. ドキュメントが含まれているイメージを S3 バケットにアップロードします。

   手順については、以下を参照してください。[Amazon S3 へのオブジェクトのアップロード](https://docs.aws.amazon.com/AmazonS3/latest/user-guide/UploadingObjectsintoAmazonS3.html)の*Amazon Simple Storage Service ユーザーガイド*。

1. 以下の例を使用して、`AnalyzeExpense` オペレーションを呼び出します。

------
#### [ CLI ]

   ```
     aws textract analyze-expense --document '{"S3Object": {"Bucket": "bucket name","Name":
   "object name"}}'
   ```

------
#### [ Python ]

   ```
   import boto3
   import io
   from PIL import Image, ImageDraw
   
   def draw_bounding_box(key, val, width, height, draw):
       # If a key is Geometry, draw the bounding box info in it
       if "Geometry" in key:
           # Draw bounding box information
           box = val["BoundingBox"]
           left = width * box['Left']
           top = height * box['Top']
           draw.rectangle([left, top, left + (width * box['Width']), top + (height * box['Height'])],
                          outline='black')
   
   # Takes a field as an argument and prints out the detected labels and values
   def print_labels_and_values(field):
       # Only if labels are detected and returned
       if "LabelDetection" in field:
           print("Summary Label Detection - Confidence: {}".format(
               str(field.get("LabelDetection")["Confidence"])) + ", "
                 + "Summary Values: {}".format(str(field.get("LabelDetection")["Text"])))
           print(field.get("LabelDetection")["Geometry"])
       else:
           print("Label Detection - No labels returned.")
       if "ValueDetection" in field:
           print("Summary Value Detection - Confidence: {}".format(
               str(field.get("ValueDetection")["Confidence"])) + ", "
                 + "Summary Values: {}".format(str(field.get("ValueDetection")["Text"])))
           print(field.get("ValueDetection")["Geometry"])
       else:
           print("Value Detection - No values returned")
   
   def process_text_detection(bucket, document):
       # Get the document from S3
       s3_connection = boto3.resource('s3')
       s3_object = s3_connection.Object(bucket, document)
       s3_response = s3_object.get()
   
       # opening binary stream using an in-memory bytes buffer
       stream = io.BytesIO(s3_response['Body'].read())
   
       # loading stream into image
       image = Image.open(stream)
   
       # Detect text in the document
       client = boto3.client('textract', region_name="us-east-1")
   
       # process using S3 object
       response = client.analyze_expense(
           Document={'S3Object': {'Bucket': bucket, 'Name': document}})
   
       # Set width and height to display image and draw bounding boxes
       # Create drawing object
       width, height = image.size
       draw = ImageDraw.Draw(image)
   
       for expense_doc in response["ExpenseDocuments"]:
           for line_item_group in expense_doc["LineItemGroups"]:
               for line_items in line_item_group["LineItems"]:
                   for expense_fields in line_items["LineItemExpenseFields"]:
                       print_labels_and_values(expense_fields)
                       print()
   
           print("Summary:")
           for summary_field in expense_doc["SummaryFields"]:
               print_labels_and_values(summary_field)
               print()
   
           #For draw bounding boxes
           for line_item_group in expense_doc["LineItemGroups"]:
               for line_items in line_item_group["LineItems"]:
                   for expense_fields in line_items["LineItemExpenseFields"]:
                       for key, val in expense_fields["ValueDetection"].items():
                           if "Geometry" in key:
                               draw_bounding_box(key, val, width, height, draw)
   
           for label in expense_doc["SummaryFields"]:
               if "LabelDetection" in label:
                   for key, val in label["LabelDetection"].items():
                       draw_bounding_box(key, val, width, height, draw)
   
       # Display the image
       image.show()
   
   def main():
       bucket = 'Bucket-Name'
       document = 'Document-Name'
       process_text_detection(bucket, document)
   
   if __name__ == "__main__":
       main()
   ```

------
#### [ Java ]

   ```
                       
   package com.amazonaws.samples;
   
   import java.awt.*;
   import java.awt.image.BufferedImage;
   import java.io.ByteArrayInputStream;
   import java.io.IOException;
   import java.util.List;
   import java.util.concurrent.CompletableFuture;
   import javax.imageio.ImageIO;
   import javax.swing.*;
   import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
   import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
   import software.amazon.awssdk.core.ResponseBytes;
   import software.amazon.awssdk.core.async.AsyncResponseTransformer;
   import software.amazon.awssdk.regions.Region;
   import software.amazon.awssdk.services.s3.*;
   import software.amazon.awssdk.services.s3.model.GetObjectRequest;
   import software.amazon.awssdk.services.s3.model.GetObjectResponse;
   import software.amazon.awssdk.services.textract.TextractClient;
   import software.amazon.awssdk.services.textract.model.AnalyzeExpenseRequest;
   import software.amazon.awssdk.services.textract.model.AnalyzeExpenseResponse;
   import software.amazon.awssdk.services.textract.model.BoundingBox;
   import software.amazon.awssdk.services.textract.model.Document;
   import software.amazon.awssdk.services.textract.model.ExpenseDocument;
   import software.amazon.awssdk.services.textract.model.ExpenseField;
   import software.amazon.awssdk.services.textract.model.LineItemFields;
   import software.amazon.awssdk.services.textract.model.LineItemGroup;
   import software.amazon.awssdk.services.textract.model.S3Object;
   import software.amazon.awssdk.services.textract.model.Point;
   
   /**
    * 
    * Demo code to parse Textract AnalyzeExpense API
    *
    */
   public class TextractAnalyzeExpenseSample extends JPanel {
   
   	private static final long serialVersionUID = 1L;
   
   	BufferedImage image;
   	static AnalyzeExpenseResponse result;
   
   	public TextractAnalyzeExpenseSample(AnalyzeExpenseResponse documentResult, BufferedImage bufImage) throws Exception {
   		super();
   
   		result = documentResult; // Results of analyzeexpense summaryfields and lineitemgroups detection.
   		image = bufImage; // The image containing the document.
   
   	}
   
   	// Draws the image and text bounding box.
   	public void paintComponent(Graphics g) {
   
   		Graphics2D g2d = (Graphics2D) g; // Create a Java2D version of g.
   
   		// Draw the image.
   		g2d.drawImage(image, 0, 0, image.getWidth(this), image.getHeight(this), this);
   
   		// Iterate through summaryfields and lineitemgroups and display boundedboxes around lines of detected label and value.
   		List<ExpenseDocument> expenseDocuments = result.expenseDocuments();
   		for (ExpenseDocument expenseDocument : expenseDocuments) {
   
   			if (expenseDocument.hasSummaryFields()) {
   				DisplayAnalyzeExpenseSummaryInfo(expenseDocument);
   				List<ExpenseField> summaryfields = expenseDocument.summaryFields();
   				for (ExpenseField summaryfield : summaryfields) {
   
   					if (summaryfield.valueDetection() != null) {
   						ShowBoundingBox(image.getHeight(this), image.getWidth(this),
   								summaryfield.valueDetection().geometry().boundingBox(), g2d, new Color(0, 0, 0));
   					}
   
   					if (summaryfield.labelDetection() != null) {
   
   						ShowBoundingBox(image.getHeight(this), image.getWidth(this),
   								summaryfield.labelDetection().geometry().boundingBox(), g2d, new Color(0, 0, 0));
   
   					}
   
   				}
   
   			}
   
   			if (expenseDocument.hasLineItemGroups()) {
   				DisplayAnalyzeExpenseLineItemGroupsInfo(expenseDocument);
   
   				List<LineItemGroup> lineitemgroups = expenseDocument.lineItemGroups();
   
   				for (LineItemGroup lineitemgroup : lineitemgroups) {
   
   					if (lineitemgroup.hasLineItems()) {
   
   						List<LineItemFields> lineItems = lineitemgroup.lineItems();
   						for (LineItemFields lineitemfield : lineItems) {
   
   							if (lineitemfield.hasLineItemExpenseFields()) {
   
   								List<ExpenseField> expensefields = lineitemfield.lineItemExpenseFields();
   								for (ExpenseField expensefield : expensefields) {
   
   									if (expensefield.valueDetection() != null) {
   										ShowBoundingBox(image.getHeight(this), image.getWidth(this),
   												expensefield.valueDetection().geometry().boundingBox(), g2d,
   												new Color(0, 0, 0));
   									}
   
   									if (expensefield.labelDetection() != null) {
   										ShowBoundingBox(image.getHeight(this), image.getWidth(this),
   												expensefield.labelDetection().geometry().boundingBox(), g2d,
   												new Color(0, 0, 0));
   									}
   
   								}
   							}
   
   						}
   
   					}
   
   				}
   
   			}
   		}
   
   	}
   
   	// Show bounding box at supplied location.
   	private void ShowBoundingBox(float imageHeight, float imageWidth, BoundingBox box, Graphics2D g2d, Color color) {
   
   		float left = imageWidth * box.left();
   		float top = imageHeight * box.top();
   
   		// Display bounding box.
   		g2d.setColor(color);
   		g2d.drawRect(Math.round(left), Math.round(top), Math.round(imageWidth * box.width()),
   				Math.round(imageHeight * box.height()));
   
   	}
   
   	private void ShowSelectedElement(float imageHeight, float imageWidth, BoundingBox box, Graphics2D g2d,
   			Color color) {
   
   		float left = (float) imageWidth * (float) box.left();
   		float top = (float) imageHeight * (float) box.top();
   		System.out.println(left);
   		System.out.println(top);
   
   		// Display bounding box.
   		g2d.setColor(color);
   		g2d.fillRect(Math.round(left), Math.round(top), Math.round(imageWidth * box.width()),
   				Math.round(imageHeight * box.height()));
   
   	}
   
   	// Shows polygon at supplied location
   	private void ShowPolygon(int imageHeight, int imageWidth, List<Point> points, Graphics2D g2d) {
   
   		g2d.setColor(new Color(0, 0, 0));
   		Polygon polygon = new Polygon();
   
   		// Construct polygon and display
   		for (Point point : points) {
   			polygon.addPoint((Math.round(point.x() * imageWidth)), Math.round(point.y() * imageHeight));
   		}
   		g2d.drawPolygon(polygon);
   	}
   
   	private void DisplayAnalyzeExpenseSummaryInfo(ExpenseDocument expensedocument) {
   		System.out.println("	ExpenseId : " + expensedocument.expenseIndex());
   		System.out.println("    Expense Summary information:");
   		if (expensedocument.hasSummaryFields()) {
   
   			List<ExpenseField> summaryfields = expensedocument.summaryFields();
   
   			for (ExpenseField summaryfield : summaryfields) {
   
   				System.out.println("    Page: " + summaryfield.pageNumber());
   				if (summaryfield.type() != null) {
   
   					System.out.println("    Expense Summary Field Type:" + summaryfield.type().text());
   
   				}
   				if (summaryfield.labelDetection() != null) {
   
   					System.out.println("    Expense Summary Field Label:" + summaryfield.labelDetection().text());
   					System.out.println("    Geometry");
   					System.out.println("        Bounding Box: "
   							+ summaryfield.labelDetection().geometry().boundingBox().toString());
   					System.out.println(
   							"        Polygon: " + summaryfield.labelDetection().geometry().polygon().toString());
   
   				}
   				if (summaryfield.valueDetection() != null) {
   					System.out.println("    Expense Summary Field Value:" + summaryfield.valueDetection().text());
   					System.out.println("    Geometry");
   					System.out.println("        Bounding Box: "
   							+ summaryfield.valueDetection().geometry().boundingBox().toString());
   					System.out.println(
   							"        Polygon: " + summaryfield.valueDetection().geometry().polygon().toString());
   
   				}
   
   			}
   
   		}
   
   	}
   
   	private void DisplayAnalyzeExpenseLineItemGroupsInfo(ExpenseDocument expensedocument) {
   
   		System.out.println("	ExpenseId : " + expensedocument.expenseIndex());
   		System.out.println("    Expense LineItemGroups information:");
   
   		if (expensedocument.hasLineItemGroups()) {
   
   			List<LineItemGroup> lineitemgroups = expensedocument.lineItemGroups();
   
   			for (LineItemGroup lineitemgroup : lineitemgroups) {
   
   				System.out.println("    Expense LineItemGroupsIndexID :" + lineitemgroup.lineItemGroupIndex());
   
   				if (lineitemgroup.hasLineItems()) {
   
   					List<LineItemFields> lineItems = lineitemgroup.lineItems();
   
   					for (LineItemFields lineitemfield : lineItems) {
   
   						if (lineitemfield.hasLineItemExpenseFields()) {
   
   							List<ExpenseField> expensefields = lineitemfield.lineItemExpenseFields();
   							for (ExpenseField expensefield : expensefields) {
   
   								if (expensefield.type() != null) {
   									System.out.println("    Expense LineItem Field Type:" + expensefield.type().text());
   
   								}
   
   								if (expensefield.valueDetection() != null) {
   									System.out.println(
   											"    Expense Summary Field Value:" + expensefield.valueDetection().text());
   									System.out.println("    Geometry");
   									System.out.println("        Bounding Box: "
   											+ expensefield.valueDetection().geometry().boundingBox().toString());
   									System.out.println("        Polygon: "
   											+ expensefield.valueDetection().geometry().polygon().toString());
   
   								}
   
   								if (expensefield.labelDetection() != null) {
   									System.out.println(
   											"    Expense LineItem Field Label:" + expensefield.labelDetection().text());
   									System.out.println("    Geometry");
   									System.out.println("        Bounding Box: "
   											+ expensefield.labelDetection().geometry().boundingBox().toString());
   									System.out.println("        Polygon: "
   											+ expensefield.labelDetection().geometry().polygon().toString());
   								}
   
   							}
   						}
   
   					}
   
   				}
   			}
   		}
   
   	}
   
   	public static void main(String arg[]) throws Exception {
   
   		// Creates a default async client with credentials and AWS Region loaded from
   		// the
   		// environment
   
   		
   		S3AsyncClient client = S3AsyncClient.builder().region(Region.US_EAST_1).build();
   
   		System.out.println("Creating the S3 Client");
   
   		// Start the call to Amazon S3, not blocking to wait for the result
   		CompletableFuture<ResponseBytes<GetObjectResponse>> responseFuture = client.getObject(
   				GetObjectRequest.builder().bucket("textractanalyzeexpense").key("input/sample-receipt.jpg").build(),
   				AsyncResponseTransformer.toBytes());
   
   		System.out.println("Successfully read the object");
   
   		// When future is complete (either successfully or in error), handle the
   		// response
   		CompletableFuture<ResponseBytes<GetObjectResponse>> operationCompleteFuture = responseFuture
   				.whenComplete((getObjectResponse, exception) -> {
   					if (getObjectResponse != null) {
   						// At this point, the file my-file.out has been created with the data
   						// from S3; let's just print the object version
   						// Convert this into Async call and remove the below block from here and put it
   						// outside
   
   						
   						TextractClient textractclient = TextractClient.builder().region(Region.US_EAST_1).build();
   
   						AnalyzeExpenseRequest request = AnalyzeExpenseRequest.builder()
   								.document(
   										Document.builder().s3Object(S3Object.builder().name("YOURObjectName")
   												.bucket("YOURBucket").build()).build())
   								.build();
   
   						AnalyzeExpenseResponse result = textractclient.analyzeExpense(request);
   
   						System.out.print(result.toString());
   
   						ByteArrayInputStream bais = new ByteArrayInputStream(getObjectResponse.asByteArray());
   						try {
   							BufferedImage image = ImageIO.read(bais);
   							System.out.println("Successfully read the image");
   							JFrame frame = new JFrame("Expense Image");
   							frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   							TextractAnalyzeExpense panel = new TextractAnalyzeExpense(result, image);
   							panel.setPreferredSize(new Dimension(image.getWidth(), image.getHeight()));
   							frame.setContentPane(panel);
   							frame.pack();
   							frame.setVisible(true);
   						} catch (IOException e) {
   							throw new RuntimeException(e);
   						} catch (Exception e) {
   							// TODO Auto-generated catch block
   							e.printStackTrace();
   						}
   					} else {
   						// Handle the error
   						exception.printStackTrace();
   					}
   				});
   
   		// We could do other work while waiting for the AWS call to complete in
   		// the background, but we'll just wait for "whenComplete" to finish instead
   		operationCompleteFuture.join();
   
   	}
   }
   ```

------
#### [ Node.Js ]

   ```
                       // Import required AWS SDK clients and commands for Node.js
   import { AnalyzeExpenseCommand } from  "@aws-sdk/client-textract";
   import  { TextractClient } from "@aws-sdk/client-textract";
   
   // Set the AWS Region.
   const REGION = "region"; //e.g. "us-east-1"
   // Create SNS service object.
   const textractClient = new TextractClient({ region: REGION });
   
   const bucket = 'bucket'
   const photo = 'photo'
   
   // Set params
   const params = {
       Document: {
         S3Object: {
           Bucket: bucket,
           Name: photo
         },
       },
     }
     
   const process_text_detection = async () => {
       try {
           const aExpense = new AnalyzeExpenseCommand(params);
           const response = await textractClient.send(aExpense);
           //console.log(response)
           response.ExpenseDocuments.forEach(doc => {
               doc.LineItemGroups.forEach(items => {
                   items.LineItems.forEach(fields => {
                       fields.LineItemExpenseFields.forEach(expenseFields =>{
                           console.log(expenseFields)
                       })
                   }
                   )}
                   )      
               }
           )
           return response; // For unit tests.
         } catch (err) {
           console.log("Error", err);
         }
   }
   
   process_text_detection()
   ```

------

1. これにより、の JSON 出力が提供されます。`AnalyzeExpense`オペレーション.

# Amazon Textract を使用したアイデンティティドキュメントの分析
<a name="analyzing-document-identity"></a>

アイデンティティドキュメントを分析するには、AnalyzeID API を使用し、ドキュメントファイルを入力として渡します。`AnalyzeID`は、分析されたテキストを含む JSON 構造を返します。詳細については、「[アイデンティティドキュメントの分析](how-it-works-identity.md)」を参照してください。

入力ドキュメントとして、イメージのバイト配列 (base64 エンコードされたイメージのバイト) を指定するか、Amazon S3 オブジェクトを指定できます。以下の手順では、イメージファイルを S3 バケットにアップロードし、そのファイル名を指定します。

**アイデンティティドキュメント (API) を分析するには**

1. まだ実行していない場合:

   1. を使用して IAM ユーザーを作成または更新する`AmazonTextractFullAccess`そして`AmazonS3ReadOnlyAccess`アクセス許可。詳細については、「[ステップ 1: AWS アカウントを設定して IAM ユーザーの作成](setting-up.md#setting-up-iam)」を参照してください。

   1. AWS CLI と AWS SDK をインストールして設定します。詳細については、「[ステップ 2: のセットアップAWS CLIそしてAWSSDK](setup-awscli-sdk.md)」を参照してください。

1. ドキュメントが含まれているイメージを S3 バケットにアップロードします。

   手順については、以下を参照してください。[Amazon S3 へのオブジェクトのアップロード](https://docs.aws.amazon.com/AmazonS3/latest/user-guide/UploadingObjectsintoAmazonS3.html)の*Amazon Simple Storage Service ユーザーガイド*。

1. 以下の例を使用して、`AnalyzeID` オペレーションを呼び出します。

------
#### [ CLI ]

   

   次の例では、S3 バケットから入力ファイルを取り込み、`AnalyzeID`それに対する操作。以下のコードで、の値を置き換えます。*バケット*の S3 バケットの名前で、*ファイル*は、バケット内のファイル名と*領域*の名前で`region`アカウントに関連付けられます。

   

   ```
   aws textract analyze-id --document-pages '[{"S3Object":{"Bucket":"bucket","Name":"name"}}]' --region region
   ```

   入力に別の S3 オブジェクトを追加することで、運転免許証の前面と背面で API を呼び出すこともできます。

   ```
   aws textract analyze-id --document-pages '[{"S3Object":{"Bucket":"bucket","Name":"name front"}}, {"S3Object":{"Bucket":"bucket","Name":"name back"}}]' --region us-east-1
   ```

   Windows デバイスで CLI にアクセスする場合は、一重引用符ではなく二重引用符を使用し、内部の二重引用符をバックスラッシュ（つまり\$1）でエスケープして、発生する可能性のあるパーサーエラーに対処します。例については、以下を参照してください。

   ```
   aws textract analyze-id --document-pages "[{\"S3Object\":{\"Bucket\":\"bucket\",\"Name\":\"name\"}}]" --region region
   ```

------
#### [ Python ]

   次の例では、S3 バケットから入力ファイルを取り込み、`AnalyzeID`それを操作し、検出されたキーと値のペアを返します。以下のコードで、の値を置き換えます。*bucket\$1name*の S3 バケットの名前で、*file\$1name*は、バケット内のファイル名と*領域*の名前で`region`アカウントに関連付けられます。

   ```
   import boto3
   
   bucket_name = "bucket-name"
   file_name = "file-name"
   region = "region-name"
   
   def analyze_id(region, bucket_name, file_name):
   
       textract_client = boto3.client('textract', region_name=region)
       response = textract_client.analyze_id(DocumentPages=[{"S3Object":{"Bucket":bucket_name,"Name":file_name}}])
   
       for doc_fields in response['IdentityDocuments']:
           for id_field in doc_fields['IdentityDocumentFields']:
               for key, val in id_field.items():
                   if "Type" in str(key):
                       print("Type: " + str(val['Text']))
               for key, val in id_field.items():
                   if "ValueDetection" in str(key):
                       print("Value Detection: " + str(val['Text']))
               print()
   
   analyze_id(region, bucket_name, file_name)
   ```

------
#### [ Java ]

   次の例では、S3 バケットから入力ファイルを取り込み、`AnalyzeID`それを操作し、検出されたデータを返します。関数 main で、次の値を置き換えます。`s3bucket`そして`sourceDoc`ステップ 2 で使用した Amazon S3 バケット名とドキュメントイメージ名を指定します。

   ```
   /*
      Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
      SPDX-License-Identifier: Apache-2.0
   */
   
   package com.amazonaws.samples;
   
   import com.amazonaws.regions.Regions;
   import com.amazonaws.services.textract.AmazonTextractClient;
   import com.amazonaws.services.textract.AmazonTextractClientBuilder;
   import com.amazonaws.services.textract.model.*;
   import java.util.ArrayList;
   import java.util.List;
   
   public class AnalyzeIdentityDocument {
   
       public static void main(String[] args) {
   
           final String USAGE = "\n" +
                   "Usage:\n" +
                   "    <s3bucket><sourceDoc> \n\n" +
                   "Where:\n" +
                   "    s3bucket - the Amazon S3 bucket where the document is located. \n" +
                   "    sourceDoc - the name of the document. \n";
   
           if (args.length != 1) {
               System.out.println(USAGE);
               System.exit(1);
           }
   
           String s3bucket = "bucket-name"; //args[0];
           String sourceDoc = "sourcedoc-name";  //args[1];
           AmazonTextractClient textractClient = (AmazonTextractClient) AmazonTextractClientBuilder.standard()
                   .withRegion(Regions.US_EAST_1)
                   .build();
   
           getDocDetails(textractClient, s3bucket, sourceDoc);
       }
   
       public static void getDocDetails(AmazonTextractClient textractClient, String s3bucket, String sourceDoc ) {
   
          try {
   
               S3Object s3 = new S3Object();
               s3.setBucket(s3bucket);
               s3.setName(sourceDoc);
   
               com.amazonaws.services.textract.model.Document myDoc = new com.amazonaws.services.textract.model.Document();
               myDoc.setS3Object(s3);
   
               List<Document> list1 = new ArrayList();
               list1.add(myDoc);
   
               AnalyzeIDRequest idRequest = new AnalyzeIDRequest();
               idRequest.setDocumentPages(list1);
   
               AnalyzeIDResult result = textractClient.analyzeID(idRequest);
               List<IdentityDocument> docs =  result.getIdentityDocuments();
               for (IdentityDocument doc: docs) {
   
                   List<IdentityDocumentField>idFields = doc.getIdentityDocumentFields();
                   for (IdentityDocumentField field: idFields) {
                       System.out.println("Field type is "+ field.getType().getText());
                       System.out.println("Field value is "+ field.getValueDetection().getText());
                   }
               }
   
          } catch (Exception e) {
               e.printStackTrace();
          }
       }
   }
   ```

------

1. これにより、の JSON 出力が提供されます。`AnalyzeID`オペレーション.