FormRecognizerAsyncClient クラス

  • java.lang.Object
    • com.azure.ai.formrecognizer.FormRecognizerAsyncClient

public final class FormRecognizerAsyncClient

このクラスは、Form Recognizer Azure Cognitive Service に接続するための非同期クライアントを提供します。

このクライアントは、以下を実行する非同期メソッドを提供します。

  1. カスタム フォーム分析: 個別のビジネス データとユース ケースに固有のフォームやドキュメントからのデータの抽出と分析。 modelId を メソッドに渡して、カスタムトレーニング済みモデルを beginRecognizeCustomForms 使用します。
  2. 事前構築済みモデル分析: サポートされている事前構築済みモデル を使用して、領収書、名刺、請求書、その他のドキュメントを分析する 方法を beginRecognizeReceipts 使用して、領収書情報を認識します。
  3. レイアウト分析: フォームとドキュメントからのテキスト、選択マーク、テーブル、境界ボックス座標の抽出と分析。 tpo メソッドを使用して beginRecognizeContent レイアウト分析を実行します。
  4. ポーリングとコールバック: サービスをポーリングして分析操作の状態をチェックしたり、分析が完了したときに通知を受信するためのコールバックを登録したりするメカニズムが含まれています。

メモ: このクライアントでは、 以下のみがサポートされます V2_1 。 新しいサービス バージョン DocumentAnalysisClientDocumentModelAdministrationClientを使用することをお勧めします。

API バージョン 2022-08-31 以降を使用するには、 移行ガイド を参照してください。

サービス クライアントは、開発者が Azure Form Recognizerを使用するための対話のポイントです。 FormRecognizerClient は同期サービス クライアントであり、 FormRecognizerAsyncClient 非同期サービス クライアントです。 このドキュメントに示す例では、認証に DefaultAzureCredential という名前の資格情報オブジェクトを使用します。これは、ローカルの開発環境や運用環境など、ほとんどのシナリオに適しています。 さらに、運用環境での認証には マネージド ID を 使用することをお勧めします。 さまざまな認証方法と、それに対応する資格情報の種類の詳細については、 Azure Identity のドキュメントを参照してください

サンプル: DefaultAzureCredential を使用して FormRecognizerClient を構築する

次のコード サンプルは、'DefaultAzureCredentialBuilder' を使用して を構成する の作成 FormRecognizerAsyncClientを示しています。

FormRecognizerAsyncClient formRecognizerAsyncClient = new FormRecognizerClientBuilder()
     .endpoint("{endpoint}")
     .credential(new DefaultAzureCredentialBuilder().build())
     .buildAsyncClient();

さらに、クライアントの作成に使用 AzureKeyCredential する次のコード サンプルを参照してください。

FormRecognizerAsyncClient formRecognizerAsyncClient = new FormRecognizerClientBuilder()
     .credential(new AzureKeyCredential("{key}"))
     .endpoint("{endpoint}")
     .buildAsyncClient();

メソッドの概要

修飾子と型 メソッドと説明
PollerFlux<FormRecognizerOperationResult,List<RecognizedForm>> beginRecognizeBusinessCards(Flux<ByteBuffer> businessCard, long length)

光学式文字認識 (OCR) と事前構築済みのビジネス カードトレーニング済みモデルを使用して、ビジネス カード データを認識します。

PollerFlux<FormRecognizerOperationResult,List<RecognizedForm>> beginRecognizeBusinessCards(Flux<ByteBuffer> businessCard, long length, RecognizeBusinessCardsOptions recognizeBusinessCardsOptions)

光学式文字認識 (OCR) と事前構築済みのビジネス カードトレーニング済みモデルを使用して、ドキュメントからビジネス カード データを認識します。

PollerFlux<FormRecognizerOperationResult,List<RecognizedForm>> beginRecognizeBusinessCardsFromUrl(String businessCardUrl)

光学式文字認識 (OCR) と事前構築済みのビジネス カードトレーニング済みモデルを使用して、ビジネス カード データを認識します。

PollerFlux<FormRecognizerOperationResult,List<RecognizedForm>> beginRecognizeBusinessCardsFromUrl(String businessCardUrl, RecognizeBusinessCardsOptions recognizeBusinessCardsOptions)

光学式文字認識 (OCR) と事前構築済みのビジネス カードトレーニング済みモデルを使用して、ビジネス カード データを認識します。

PollerFlux<FormRecognizerOperationResult,List<FormPage>> beginRecognizeContent(Flux<ByteBuffer> form, long length)

光学式文字認識 (OCR) を使用してコンテンツ/レイアウト データを認識します。

PollerFlux<FormRecognizerOperationResult,List<FormPage>> beginRecognizeContent(Flux<ByteBuffer> form, long length, RecognizeContentOptions recognizeContentOptions)

光学式文字認識 (OCR) を使用してコンテンツ/レイアウト データを認識します。

PollerFlux<FormRecognizerOperationResult,List<FormPage>> beginRecognizeContentFromUrl(String formUrl)

光学式文字認識 (OCR) を使用して、ドキュメントのコンテンツ/レイアウト データを認識します。

PollerFlux<FormRecognizerOperationResult,List<FormPage>> beginRecognizeContentFromUrl(String formUrl, RecognizeContentOptions recognizeContentOptions)

光学式文字認識 (OCR) とカスタムトレーニング済みモデルを使用して、ドキュメントからレイアウト データを認識します。

PollerFlux<FormRecognizerOperationResult,List<RecognizedForm>> beginRecognizeCustomForms(String modelId, Flux<ByteBuffer> form, long length)

光学式文字認識 (OCR) と、ラベル付きまたはラベルなしのカスタムトレーニング済みモデルを使用して、ドキュメントからフォーム データを認識します。

PollerFlux<FormRecognizerOperationResult,List<RecognizedForm>> beginRecognizeCustomForms(String modelId, Flux<ByteBuffer> form, long length, RecognizeCustomFormsOptions recognizeCustomFormsOptions)

光学式文字認識 (OCR) と、ラベル付きまたはラベルなしのカスタムトレーニング済みモデルを使用して、ドキュメントからフォーム データを認識します。

PollerFlux<FormRecognizerOperationResult,List<RecognizedForm>> beginRecognizeCustomFormsFromUrl(String modelId, String formUrl)

光学式文字認識 (OCR) と、ラベル付きまたはラベルなしのカスタムトレーニング済みモデルを使用して、ドキュメントからフォーム データを認識します。

PollerFlux<FormRecognizerOperationResult,List<RecognizedForm>> beginRecognizeCustomFormsFromUrl(String modelId, String formUrl, RecognizeCustomFormsOptions recognizeCustomFormsOptions)

光学式文字認識 (OCR) とカスタムトレーニング済みモデルを使用して、ドキュメントからフォーム データを認識します。

PollerFlux<FormRecognizerOperationResult,List<RecognizedForm>> beginRecognizeIdentityDocuments(Flux<ByteBuffer> identityDocument, long length)

光学式文字認識 (OCR) と ID ドキュメント モデルでトレーニングされた事前構築済みモデルを使用して ID ドキュメントを分析し、パスポートと米国の運転免許証から重要な情報を抽出します。

PollerFlux<FormRecognizerOperationResult,List<RecognizedForm>> beginRecognizeIdentityDocuments(Flux<ByteBuffer> identityDocument, long length, RecognizeIdentityDocumentOptions recognizeIdentityDocumentOptions)

光学式文字認識 (OCR) と ID ドキュメント モデルでトレーニングされた事前構築済みモデルを使用して ID ドキュメントを分析し、パスポートと米国の運転免許証から重要な情報を抽出します。

PollerFlux<FormRecognizerOperationResult,List<RecognizedForm>> beginRecognizeIdentityDocumentsFromUrl(String identityDocumentUrl)

光学式文字認識 (OCR) と ID ドキュメント モデルでトレーニングされた事前構築済みモデルを使用して ID ドキュメントを分析し、パスポートと米国の運転免許証から重要な情報を抽出します。

PollerFlux<FormRecognizerOperationResult,List<RecognizedForm>> beginRecognizeIdentityDocumentsFromUrl(String identityDocumentUrl, RecognizeIdentityDocumentOptions recognizeIdentityDocumentOptions)

光学式文字認識 (OCR) と ID ドキュメント モデルでトレーニングされた事前構築済みモデルを使用して ID ドキュメントを分析し、パスポートと米国の運転免許証から重要な情報を抽出します。

PollerFlux<FormRecognizerOperationResult,List<RecognizedForm>> beginRecognizeInvoices(Flux<ByteBuffer> invoice, long length)

光学式文字認識 (OCR) と事前構築済みの請求書トレーニング済みモデルを使用して、請求書データを認識します。

PollerFlux<FormRecognizerOperationResult,List<RecognizedForm>> beginRecognizeInvoices(Flux<ByteBuffer> invoice, long length, RecognizeInvoicesOptions recognizeInvoicesOptions)

光学式文字認識 (OCR) と事前構築済みの請求書トレーニング済みモデルを使用して、ドキュメントからの請求書データを認識します。

PollerFlux<FormRecognizerOperationResult,List<RecognizedForm>> beginRecognizeInvoicesFromUrl(String invoiceUrl)

光学式文字認識 (OCR) と事前構築済みの請求書トレーニング済みモデルを使用して、請求書データを認識します。

PollerFlux<FormRecognizerOperationResult,List<RecognizedForm>> beginRecognizeInvoicesFromUrl(String invoiceUrl, RecognizeInvoicesOptions recognizeInvoicesOptions)

光学式文字認識 (OCR) と事前構築済みの請求書トレーニング済みモデルを使用して、請求書データを認識します。

PollerFlux<FormRecognizerOperationResult,List<RecognizedForm>> beginRecognizeReceipts(Flux<ByteBuffer> receipt, long length)

光学式文字認識 (OCR) と事前構築済みのレシートトレーニング済みモデルを使用して、レシート データを認識します。

PollerFlux<FormRecognizerOperationResult,List<RecognizedForm>> beginRecognizeReceipts(Flux<ByteBuffer> receipt, long length, RecognizeReceiptsOptions recognizeReceiptsOptions)

光学式文字認識 (OCR) と事前構築済みのレシートトレーニング済みモデルを使用して、ドキュメントからのレシート データを認識します。

PollerFlux<FormRecognizerOperationResult,List<RecognizedForm>> beginRecognizeReceiptsFromUrl(String receiptUrl)

光学式文字認識 (OCR) と事前構築済みのレシートトレーニング済みモデルを使用して、レシート データを認識します。

PollerFlux<FormRecognizerOperationResult,List<RecognizedForm>> beginRecognizeReceiptsFromUrl(String receiptUrl, RecognizeReceiptsOptions recognizeReceiptsOptions)

光学式文字認識 (OCR) と事前構築済みのレシートトレーニング済みモデルを使用してレシート データを認識します。

メソッドの継承元: java.lang.Object

メソッドの詳細

beginRecognizeBusinessCards

public PollerFlux<>> beginRecognizeBusinessCards(Flux businessCard, long length)

光学式文字認識 (OCR) と事前構築済みのビジネス カードトレーニング済みモデルを使用して、ビジネス カード データを認識します。

サービスは実行時間の長い操作の取り消しをサポートせず、取り消しサポートがないことを示すエラー メッセージを返します。

ビジネス カードのフィールドについては、こちらを参照してください。 再試行が businessCard 有効になっている場合は、渡された を再生可能にする必要があることに注意してください (既定値)。 つまり、 Flux はサブスクライブされるたびに同じデータを生成する必要があります。

Code sample

File businessCard = new File("{local/file_path/fileName.jpg}");
 Flux<ByteBuffer> buffer = toFluxByteBuffer(new ByteArrayInputStream(Files.readAllBytes(businessCard.toPath())));
 // if training polling operation completed, retrieve the final result.
 formRecognizerAsyncClient.beginRecognizeBusinessCards(buffer, businessCard.length())
     .flatMap(AsyncPollResponse::getFinalResult)
     .subscribe(recognizedBusinessCards -> {
         for (int i = 0; i < recognizedBusinessCards.size(); i++) {
             RecognizedForm recognizedForm = recognizedBusinessCards.get(i);
             Map<String, FormField> recognizedFields = recognizedForm.getFields();
             System.out.printf("----------- Recognized Business Card page %d -----------%n", i);
             FormField contactNamesFormField = recognizedFields.get("ContactNames");
             if (contactNamesFormField != null) {
                 if (FieldValueType.LIST == contactNamesFormField.getValue().getValueType()) {
                     List<FormField> contactNamesList = contactNamesFormField.getValue().asList();
                     contactNamesList.stream()
                         .filter(contactName -> FieldValueType.MAP == contactName.getValue().getValueType())
                         .map(contactName -> {
                             System.out.printf("Contact name: %s%n", contactName.getValueData().getText());
                             return contactName.getValue().asMap();
                         })
                         .forEach(contactNamesMap -> contactNamesMap.forEach((key, contactName) -> {
                             if ("FirstName".equals(key)) {
                                 if (FieldValueType.STRING == contactName.getValue().getValueType()) {
                                     String firstName = contactName.getValue().asString();
                                     System.out.printf("\tFirst Name: %s, confidence: %.2f%n",
                                         firstName, contactName.getConfidence());
                                 }
                             }
                             if ("LastName".equals(key)) {
                                 if (FieldValueType.STRING == contactName.getValue().getValueType()) {
                                     String lastName = contactName.getValue().asString();
                                     System.out.printf("\tLast Name: %s, confidence: %.2f%n",
                                         lastName, contactName.getConfidence());
                                 }
                             }
                         }));
                 }
             }
             FormField jobTitles = recognizedFields.get("JobTitles");
             if (jobTitles != null) {
                 if (FieldValueType.LIST == jobTitles.getValue().getValueType()) {
                     List<FormField> jobTitlesItems = jobTitles.getValue().asList();
                     jobTitlesItems.forEach(jobTitlesItem -> {
                         if (FieldValueType.STRING == jobTitlesItem.getValue().getValueType()) {
                             String jobTitle = jobTitlesItem.getValue().asString();
                             System.out.printf("Job Title: %s, confidence: %.2f%n",
                                 jobTitle, jobTitlesItem.getConfidence());
                         }
                     });
                 }
             }
         }
     });

Parameters:

businessCard - ビジネスカード情報を認識するドキュメントのデータ。
length - データの正確な長さ。

Returns:

PollerFlux<T,U>完了、失敗、または取り消されるまで、ビジネス カード認識操作をポーリングする 。 完了した操作は、 の RecognizedForm一覧を返します。

beginRecognizeBusinessCards

public PollerFlux<>> beginRecognizeBusinessCards(Flux businessCard, long length, RecognizeBusinessCardsOptions recognizeBusinessCardsOptions)

光学式文字認識 (OCR) と事前構築済みのビジネス カードトレーニング済みモデルを使用して、ドキュメントからビジネス カード データを認識します。

サービスは実行時間の長い操作の取り消しをサポートせず、取り消しサポートがないことを示すエラー メッセージを返します。

ビジネス カードのフィールドについては、こちらを参照してください。 再試行が businessCard 有効になっている場合は、渡された を再生可能にする必要があることに注意してください (既定値)。 つまり、 Flux はサブスクライブされるたびに同じデータを生成する必要があります。

Code sample

File businessCard = new File("{local/file_path/fileName.jpg}");
 boolean includeFieldElements = true;
 // Utility method to convert input stream to Byte buffer
 Flux<ByteBuffer> buffer = toFluxByteBuffer(new ByteArrayInputStream(Files.readAllBytes(businessCard.toPath())));
 // if training polling operation completed, retrieve the final result.
 formRecognizerAsyncClient.beginRecognizeBusinessCards(buffer, businessCard.length(),
     new RecognizeBusinessCardsOptions()
         .setContentType(FormContentType.IMAGE_JPEG)
         .setFieldElementsIncluded(includeFieldElements))
     .setPollInterval(Duration.ofSeconds(5))
     .flatMap(AsyncPollResponse::getFinalResult)
     .subscribe(recognizedBusinessCards -> {
         for (int i = 0; i < recognizedBusinessCards.size(); i++) {
             RecognizedForm recognizedForm = recognizedBusinessCards.get(i);
             Map<String, FormField> recognizedFields = recognizedForm.getFields();
             System.out.printf("----------- Recognized Business Card page %d -----------%n", i);
             FormField contactNamesFormField = recognizedFields.get("ContactNames");
             if (contactNamesFormField != null) {
                 if (FieldValueType.LIST == contactNamesFormField.getValue().getValueType()) {
                     List<FormField> contactNamesList = contactNamesFormField.getValue().asList();
                     contactNamesList.stream()
                         .filter(contactName -> FieldValueType.MAP == contactName.getValue().getValueType())
                         .map(contactName -> {
                             System.out.printf("Contact name: %s%n", contactName.getValueData().getText());
                             return contactName.getValue().asMap();
                         })
                         .forEach(contactNamesMap -> contactNamesMap.forEach((key, contactName) -> {
                             if ("FirstName".equals(key)) {
                                 if (FieldValueType.STRING == contactName.getValue().getValueType()) {
                                     String firstName = contactName.getValue().asString();
                                     System.out.printf("\tFirst Name: %s, confidence: %.2f%n",
                                         firstName, contactName.getConfidence());
                                 }
                             }
                             if ("LastName".equals(key)) {
                                 if (FieldValueType.STRING == contactName.getValue().getValueType()) {
                                     String lastName = contactName.getValue().asString();
                                     System.out.printf("\tLast Name: %s, confidence: %.2f%n",
                                         lastName, contactName.getConfidence());
                                 }
                             }
                         }));
                 }
             }
             FormField jobTitles = recognizedFields.get("JobTitles");
             if (jobTitles != null) {
                 if (FieldValueType.LIST == jobTitles.getValue().getValueType()) {
                     List<FormField> jobTitlesItems = jobTitles.getValue().asList();
                     jobTitlesItems.forEach(jobTitlesItem -> {
                         if (FieldValueType.STRING == jobTitlesItem.getValue().getValueType()) {
                             String jobTitle = jobTitlesItem.getValue().asString();
                             System.out.printf("Job Title: %s, confidence: %.2f%n",
                                 jobTitle, jobTitlesItem.getConfidence());
                         }
                     });
                 }
             }
         }
     });

Parameters:

businessCard - ビジネスカード情報を認識するドキュメントのデータ。
length - データの正確な長さ。
recognizeBusinessCardsOptions - ビジネス カードを分析するときに渡される可能性がある追加の構成可能RecognizeBusinessCardsOptions

Returns:

PollerFlux<T,U>完了、失敗、または取り消されるまで、ビジネス カード認識操作をポーリングする 。 完了した操作は、 の RecognizedForm一覧を返します。

beginRecognizeBusinessCardsFromUrl

public PollerFlux<>> beginRecognizeBusinessCardsFromUrl(String businessCardUrl)

光学式文字認識 (OCR) と事前構築済みのビジネス カードトレーニング済みモデルを使用して、ビジネス カード データを認識します。

サービスは実行時間の長い操作の取り消しをサポートせず、取り消しサポートがないことを示すエラー メッセージを返します。

ビジネス カードのフィールドについては、こちらを参照してください。

Code sample

String formUrl = "{form_url}";
 String modelId = "{custom_trained_model_id}";

 // if training polling operation completed, retrieve the final result.
 formRecognizerAsyncClient.beginRecognizeCustomFormsFromUrl(modelId, formUrl)
     // if training polling operation completed, retrieve the final result.
     .flatMap(AsyncPollResponse::getFinalResult)
     .flatMap(Flux::fromIterable)
     .subscribe(recognizedForm -> recognizedForm.getFields()
         .forEach((fieldText, formField) -> {
             System.out.printf("Field text: %s%n", fieldText);
             System.out.printf("Field value data text: %s%n", formField.getValueData().getText());
             System.out.printf("Confidence score: %.2f%n", formField.getConfidence());
         }));

Parameters:

businessCardUrl - 入力ビジネス カードのソース URL。

Returns:

PollerFlux<T,U>完了、失敗、または取り消されるまで、ビジネス カード認識操作をポーリングする 。 完了した操作は、 の RecognizedForm一覧を返します。

beginRecognizeBusinessCardsFromUrl

public PollerFlux<>> beginRecognizeBusinessCardsFromUrl(String businessCardUrl, RecognizeBusinessCardsOptions recognizeBusinessCardsOptions)

光学式文字認識 (OCR) と事前構築済みのビジネス カードトレーニング済みモデルを使用して、ビジネス カード データを認識します。

サービスは実行時間の長い操作の取り消しをサポートせず、取り消しサポートがないことを示すエラー メッセージを返します。

ビジネス カードのフィールドについては、こちらを参照してください。

Code sample

String businessCardUrl = "{business_card_url}";
 boolean includeFieldElements = true;
 // if training polling operation completed, retrieve the final result.
 formRecognizerAsyncClient.beginRecognizeBusinessCardsFromUrl(businessCardUrl,
     new RecognizeBusinessCardsOptions()
         .setFieldElementsIncluded(includeFieldElements))
     .setPollInterval(Duration.ofSeconds(5))
     .flatMap(AsyncPollResponse::getFinalResult)
     .subscribe(recognizedBusinessCards -> {
         for (int i = 0; i < recognizedBusinessCards.size(); i++) {
             RecognizedForm recognizedBusinessCard = recognizedBusinessCards.get(i);
             Map<String, FormField> recognizedFields = recognizedBusinessCard.getFields();
             System.out.printf("----------- Recognized Business Card page %d -----------%n", i);
             FormField contactNamesFormField = recognizedFields.get("ContactNames");
             if (contactNamesFormField != null) {
                 if (FieldValueType.LIST == contactNamesFormField.getValue().getValueType()) {
                     List<FormField> contactNamesList = contactNamesFormField.getValue().asList();
                     contactNamesList.stream()
                         .filter(contactName -> FieldValueType.MAP == contactName.getValue().getValueType())
                         .map(contactName -> {
                             System.out.printf("Contact name: %s%n", contactName.getValueData().getText());
                             return contactName.getValue().asMap();
                         })
                         .forEach(contactNamesMap -> contactNamesMap.forEach((key, contactName) -> {
                             if ("FirstName".equals(key)) {
                                 if (FieldValueType.STRING == contactName.getValue().getValueType()) {
                                     String firstName = contactName.getValue().asString();
                                     System.out.printf("\tFirst Name: %s, confidence: %.2f%n",
                                         firstName, contactName.getConfidence());
                                 }
                             }
                             if ("LastName".equals(key)) {
                                 if (FieldValueType.STRING == contactName.getValue().getValueType()) {
                                     String lastName = contactName.getValue().asString();
                                     System.out.printf("\tLast Name: %s, confidence: %.2f%n",
                                         lastName, contactName.getConfidence());
                                 }
                             }
                         }));
                 }
             }
             FormField jobTitles = recognizedFields.get("JobTitles");
             if (jobTitles != null) {
                 if (FieldValueType.LIST == jobTitles.getValue().getValueType()) {
                     List<FormField> jobTitlesItems = jobTitles.getValue().asList();
                     jobTitlesItems.forEach(jobTitlesItem -> {
                         if (FieldValueType.STRING == jobTitlesItem.getValue().getValueType()) {
                             String jobTitle = jobTitlesItem.getValue().asString();
                             System.out.printf("Job Title: %s, confidence: %.2f%n",
                                 jobTitle, jobTitlesItem.getConfidence());
                         }
                     });
                 }
             }
         }
     });

Parameters:

businessCardUrl - 入力ビジネス カードのソース URL。
recognizeBusinessCardsOptions - ビジネス カードを分析するときに渡される可能性がある追加の構成可能RecognizeBusinessCardsOptions

Returns:

PollerFlux<T,U>完了、失敗、または取り消されるまで、ビジネス カード認識操作をポーリングする 。 完了した操作は、 の RecognizedForm一覧を返します。

beginRecognizeContent

public PollerFlux<>> beginRecognizeContent(Flux form, long length)

光学式文字認識 (OCR) を使用してコンテンツ/レイアウト データを認識します。

サービスは実行時間の長い操作の取り消しをサポートせず、取り消しサポートがないことを示すエラー メッセージを返します。

再試行が data 有効になっている場合は、渡された を再生可能にする必要があることに注意してください (既定値)。 つまり、 Flux はサブスクライブされるたびに同じデータを生成する必要があります。

Code sample

File form = new File("{local/file_path/fileName.jpg}");
 // Utility method to convert input stream to Byte buffer
 Flux<ByteBuffer> buffer = toFluxByteBuffer(new ByteArrayInputStream(Files.readAllBytes(form.toPath())));

 // if training polling operation completed, retrieve the final result.
 formRecognizerAsyncClient.beginRecognizeContent(buffer, form.length())
     .flatMap(AsyncPollResponse::getFinalResult)
     .flatMap(Flux::fromIterable)
     .subscribe(formPage -> {
         System.out.printf("Page Angle: %s%n", formPage.getTextAngle());
         System.out.printf("Page Dimension unit: %s%n", formPage.getUnit());
         // Table information
         System.out.println("Recognized Tables: ");
         formPage.getTables().forEach(formTable ->
             formTable.getCells().forEach(recognizedTableCell ->
                 System.out.printf("%s ", recognizedTableCell.getText())));
     });

Parameters:

form - コンテンツ情報を認識するフォームのデータ。
length - データの正確な長さ。

Returns:

PollerFlux<T,U> 、完了、失敗、または取り消されるまで、コンテンツ認識操作をポーリングします。 完了した操作は、 の FormPage一覧を返します。

beginRecognizeContent

public PollerFlux<>> beginRecognizeContent(Flux form, long length, RecognizeContentOptions recognizeContentOptions)

光学式文字認識 (OCR) を使用してコンテンツ/レイアウト データを認識します。

サービスは実行時間の長い操作の取り消しをサポートせず、取り消しサポートがないことを示すエラー メッセージを返します。

再試行が data 有効になっている場合は、渡された を再生可能にする必要があることに注意してください (既定値)。 つまり、 Flux はサブスクライブされるたびに同じデータを生成する必要があります。

コンテンツ認識では、自動言語識別と多言語ドキュメントがサポートされているため、 でドキュメントをその特定の言語として強制的に処理する場合にのみ言語コードを RecognizeContentOptions提供します。

Code sample

File form = new File("{local/file_path/fileName.jpg}");
 // Utility method to convert input stream to Byte buffer
 Flux<ByteBuffer> buffer = toFluxByteBuffer(new ByteArrayInputStream(Files.readAllBytes(form.toPath())));
 // if training polling operation completed, retrieve the final result.
 formRecognizerAsyncClient.beginRecognizeContent(buffer, form.length(),
     new RecognizeContentOptions()
         .setContentType(FormContentType.IMAGE_JPEG)
         .setPollInterval(Duration.ofSeconds(5)))
     .flatMap(AsyncPollResponse::getFinalResult)
     .flatMap(Flux::fromIterable)
     .subscribe(formPage -> {
         System.out.printf("Page Angle: %s%n", formPage.getTextAngle());
         System.out.printf("Page Dimension unit: %s%n", formPage.getUnit());
         // Table information
         System.out.println("Recognized Tables: ");
         formPage.getTables().forEach(formTable -> formTable.getCells().forEach(recognizedTableCell ->
             System.out.printf("%s ", recognizedTableCell.getText())));
     });

Parameters:

form - コンテンツ情報を認識するフォームのデータ。
length - データの正確な長さ。
recognizeContentOptions - フォーム上のコンテンツ/レイアウトを認識するときに渡される可能性がある追加の構成可能 RecognizeContentOptions

Returns:

PollerFlux<T,U> 、完了、失敗、または取り消されるまで、コンテンツ認識操作をポーリングします。 完了した操作は、 の FormPage一覧を返します。

beginRecognizeContentFromUrl

public PollerFlux<>> beginRecognizeContentFromUrl(String formUrl)

光学式文字認識 (OCR) を使用して、ドキュメントのコンテンツ/レイアウト データを認識します。

サービスは実行時間の長い操作の取り消しをサポートせず、取り消しサポートがないことを示すエラー メッセージを返します。

Code sample

String formUrl = "{formUrl}";
 formRecognizerAsyncClient.beginRecognizeContentFromUrl(formUrl)
     // if training polling operation completed, retrieve the final result.
     .flatMap(AsyncPollResponse::getFinalResult)
     .flatMap(Flux::fromIterable)
     .subscribe(formPage -> {
         System.out.printf("Page Angle: %s%n", formPage.getTextAngle());
         System.out.printf("Page Dimension unit: %s%n", formPage.getUnit());
         // Table information
         System.out.println("Recognized Tables: ");
         formPage.getTables().forEach(formTable ->
             formTable.getCells().forEach(recognizedTableCell ->
                 System.out.printf("%s ", recognizedTableCell.getText())));
     });

Parameters:

formUrl - 分析するフォームの URL。

Returns:

PollerFlux<T,U>コンテンツ認識操作が完了、失敗、または取り消されるまでポーリングする 。 完了した操作は、 の FormPage一覧を返します。

beginRecognizeContentFromUrl

public PollerFlux<>> beginRecognizeContentFromUrl(String formUrl, RecognizeContentOptions recognizeContentOptions)

光学式文字認識 (OCR) とカスタムトレーニング済みモデルを使用して、ドキュメントからレイアウト データを認識します。

サービスは実行時間の長い操作の取り消しをサポートせず、取り消しサポートがないことを示すエラー メッセージを返します。

コンテンツ認識では、自動言語識別と多言語ドキュメントがサポートされているため、 でドキュメントをその特定の言語として強制的に処理する場合にのみ言語コードを RecognizeContentOptions提供します。

Code sample

String formUrl = "{formUrl}";
 // if training polling operation completed, retrieve the final result.
 formRecognizerAsyncClient.beginRecognizeContentFromUrl(formUrl,
     new RecognizeContentOptions().setPollInterval(Duration.ofSeconds(5)))
     .flatMap(AsyncPollResponse::getFinalResult)
     .flatMap(Flux::fromIterable)
     .subscribe(formPage -> {
         System.out.printf("Page Angle: %s%n", formPage.getTextAngle());
         System.out.printf("Page Dimension unit: %s%n", formPage.getUnit());
         // Table information
         System.out.println("Recognized Tables: ");
         formPage.getTables().forEach(formTable ->
             formTable.getCells().forEach(recognizedTableCell ->
                 System.out.printf("%s ", recognizedTableCell.getText())));
     });

Parameters:

formUrl - 入力フォームへのソース URL。
recognizeContentOptions - フォーム上のコンテンツ/レイアウトを認識するときに渡される可能性がある追加の構成可能 RecognizeContentOptions

Returns:

PollerFlux<T,U>認識されたコンテンツ/レイアウト操作が完了、失敗、または取り消されるまでポーリングする 。 完了した操作は、 の FormPage一覧を返します。

beginRecognizeCustomForms

public PollerFlux<>> beginRecognizeCustomForms(String modelId, Flux form, long length)

光学式文字認識 (OCR) と、ラベル付きまたはラベルなしのカスタムトレーニング済みモデルを使用して、ドキュメントからフォーム データを認識します。

サービスは実行時間の長い操作の取り消しをサポートせず、取り消しサポートがないことを示すエラー メッセージを返します。

再試行が data 有効になっている場合は、渡された を再生可能にする必要があることに注意してください (既定値)。 つまり、 Flux はサブスクライブされるたびに同じデータを生成する必要があります。

Code sample

File form = new File("{local/file_path/fileName.jpg}");
 String modelId = "{custom_trained_model_id}";
 // Utility method to convert input stream to Byte buffer
 Flux<ByteBuffer> buffer = toFluxByteBuffer(new ByteArrayInputStream(Files.readAllBytes(form.toPath())));

 // if training polling operation completed, retrieve the final result.
 formRecognizerAsyncClient.beginRecognizeCustomForms(modelId, buffer, form.length())
     // if training polling operation completed, retrieve the final result.
     .flatMap(AsyncPollResponse::getFinalResult)
     .flatMap(Flux::fromIterable)
     .subscribe(recognizedForm -> recognizedForm.getFields()
         .forEach((fieldText, formField) -> {
             System.out.printf("Field text: %s%n", fieldText);
             System.out.printf("Field value data text: %s%n", formField.getValueData().getText());
             System.out.printf("Confidence score: %.2f%n", formField.getConfidence());
         }));

Parameters:

modelId - 使用する UUID 文字列形式のカスタムトレーニング済みモデル ID。
form - フォーム情報を認識するフォームのデータ。
length - データの正確な長さ。

Returns:

PollerFlux<T,U>完了、失敗、または取り消されるまで、カスタム フォーム認識操作をポーリングする 。 完了した操作は、 の RecognizedForm一覧を返します。

beginRecognizeCustomForms

public PollerFlux<>> beginRecognizeCustomForms(String modelId, Flux form, long length, RecognizeCustomFormsOptions recognizeCustomFormsOptions)

光学式文字認識 (OCR) と、ラベル付きまたはラベルなしのカスタムトレーニング済みモデルを使用して、ドキュメントからフォーム データを認識します。

サービスは実行時間の長い操作の取り消しをサポートせず、取り消しサポートがないことを示すエラー メッセージを返します。

再試行が data 有効になっている場合は、渡された を再生可能にする必要があることに注意してください (既定値)。 つまり、 Flux はサブスクライブされるたびに同じデータを生成する必要があります。

Code sample

File form = new File("{local/file_path/fileName.jpg}");
 String modelId = "{custom_trained_model_id}";
 boolean includeFieldElements = true;
 // Utility method to convert input stream to Byte buffer
 Flux<ByteBuffer> buffer = toFluxByteBuffer(new ByteArrayInputStream(Files.readAllBytes(form.toPath())));

 // if training polling operation completed, retrieve the final result.
 formRecognizerAsyncClient.beginRecognizeCustomForms(modelId, buffer, form.length(),
     new RecognizeCustomFormsOptions()
         .setContentType(FormContentType.IMAGE_JPEG)
         .setFieldElementsIncluded(includeFieldElements)
         .setPollInterval(Duration.ofSeconds(5)))
     // if training polling operation completed, retrieve the final result.
     .flatMap(AsyncPollResponse::getFinalResult)
     .flatMap(Flux::fromIterable)
     .subscribe(recognizedForm -> recognizedForm.getFields()
         .forEach((fieldName, formField) -> {
             System.out.printf("Field text: %s%n", fieldName);
             System.out.printf("Field value data text: %s%n", formField.getValueData().getText());
             System.out.printf("Confidence score: %.2f%n", formField.getConfidence());
         }));

Parameters:

modelId - 使用する UUID 文字列形式のカスタムトレーニング済みモデル ID。
form - フォーム情報を認識するフォームのデータ。
length - データの正確な長さ。
recognizeCustomFormsOptions - カスタム フォームを認識するときに渡される可能性がある追加の構成可能 RecognizeCustomFormsOptions

Returns:

PollerFlux<T,U>完了、失敗、または取り消されるまで、カスタム フォーム認識操作をポーリングする 。 完了した操作は、 の RecognizedForm一覧を返します。

beginRecognizeCustomFormsFromUrl

public PollerFlux<>> beginRecognizeCustomFormsFromUrl(String modelId, String formUrl)

光学式文字認識 (OCR) と、ラベル付きまたはラベルなしのカスタムトレーニング済みモデルを使用して、ドキュメントからフォーム データを認識します。

サービスは実行時間の長い操作の取り消しをサポートせず、取り消しサポートがないことを示すエラー メッセージを返します。

Code sample

String formUrl = "{form_url}";
 String modelId = "{custom_trained_model_id}";

 // if training polling operation completed, retrieve the final result.
 formRecognizerAsyncClient.beginRecognizeCustomFormsFromUrl(modelId, formUrl)
     // if training polling operation completed, retrieve the final result.
     .flatMap(AsyncPollResponse::getFinalResult)
     .flatMap(Flux::fromIterable)
     .subscribe(recognizedForm -> recognizedForm.getFields()
         .forEach((fieldText, formField) -> {
             System.out.printf("Field text: %s%n", fieldText);
             System.out.printf("Field value data text: %s%n", formField.getValueData().getText());
             System.out.printf("Confidence score: %.2f%n", formField.getConfidence());
         }));

Parameters:

modelId - 使用する UUID 文字列形式のカスタムトレーニング済みモデル ID。
formUrl - 分析するフォームの URL。

Returns:

PollerFlux<T,U>完了、失敗、または取り消されるまで、カスタム フォーム認識操作をポーリングする 。 完了した操作は、 の RecognizedForm一覧を返します。

beginRecognizeCustomFormsFromUrl

public PollerFlux<>> beginRecognizeCustomFormsFromUrl(String modelId, String formUrl, RecognizeCustomFormsOptions recognizeCustomFormsOptions)

光学式文字認識 (OCR) とカスタムトレーニング済みモデルを使用して、ドキュメントからフォーム データを認識します。

サービスは実行時間の長い操作の取り消しをサポートせず、取り消しサポートがないことを示すエラー メッセージを返します。

Code sample

String formUrl = "{formUrl}";
 String modelId = "{model_id}";
 boolean includeFieldElements = true;

 formRecognizerAsyncClient.beginRecognizeCustomFormsFromUrl(modelId, formUrl,
     new RecognizeCustomFormsOptions()
         .setFieldElementsIncluded(includeFieldElements)
         .setPollInterval(Duration.ofSeconds(10)))
     // if training polling operation completed, retrieve the final result.
     .flatMap(AsyncPollResponse::getFinalResult)
     .flatMap(Flux::fromIterable)
     .subscribe(recognizedForm -> recognizedForm.getFields()
         .forEach((fieldText, formField) -> {
             System.out.printf("Field text: %s%n", fieldText);
             System.out.printf("Field value data text: %s%n", formField.getValueData().getText());
             System.out.printf("Confidence score: %.2f%n", formField.getConfidence());
         }));

Parameters:

modelId - 使用する UUID 文字列形式のカスタムトレーニング済みモデル ID。
formUrl - 入力フォームへのソース URL。
recognizeCustomFormsOptions - カスタム フォームを認識するときに渡される可能性がある追加の構成可能 RecognizeCustomFormsOptions

Returns:

PollerFlux<T,U>完了、失敗、または取り消されるまで、カスタム フォーム認識操作をポーリングする 。 完了した操作は、 の RecognizedForm一覧を返します。

beginRecognizeIdentityDocuments

public PollerFlux<>> beginRecognizeIdentityDocuments(Flux identityDocument, long length)

光学式文字認識 (OCR) と ID ドキュメント モデルでトレーニングされた事前構築済みモデルを使用して ID ドキュメントを分析し、パスポートと米国の運転免許証から重要な情報を抽出します。 ID ドキュメントで見つかったフィールドについては、 こちらを 参照してください。

サービスは実行時間の長い操作の取り消しをサポートせず、取り消しサポートがないことを示すエラー メッセージを返します。

再試行が identityDocument 有効になっている場合は、渡された を再生可能にする必要があることに注意してください (既定値)。 つまり、 Flux はサブスクライブされるたびに同じデータを生成する必要があります。

Code sample

File license = new File("local/file_path/license.jpg");
 Flux<ByteBuffer> buffer =
     toFluxByteBuffer(new ByteArrayInputStream(Files.readAllBytes(license.toPath())));
 // if training polling operation completed, retrieve the final result.
 formRecognizerAsyncClient.beginRecognizeIdentityDocuments(buffer, license.length())
     .flatMap(AsyncPollResponse::getFinalResult)
     .subscribe(recognizedIDDocumentResult -> {
         for (int i = 0; i < recognizedIDDocumentResult.size(); i++) {
             RecognizedForm recognizedForm = recognizedIDDocumentResult.get(i);
             Map<String, FormField> recognizedFields = recognizedForm.getFields();
             System.out.printf("----------- Recognized license info for page %d -----------%n", i);

             FormField firstNameField = recognizedFields.get("FirstName");
             if (firstNameField != null) {
                 if (FieldValueType.STRING == firstNameField.getValue().getValueType()) {
                     String firstName = firstNameField.getValue().asString();
                     System.out.printf("First Name: %s, confidence: %.2f%n",
                         firstName, firstNameField.getConfidence());
                 }
             }

             FormField lastNameField = recognizedFields.get("LastName");
             if (lastNameField != null) {
                 if (FieldValueType.STRING == lastNameField.getValue().getValueType()) {
                     String lastName = lastNameField.getValue().asString();
                     System.out.printf("Last name: %s, confidence: %.2f%n",
                         lastName, lastNameField.getConfidence());
                 }
             }

             FormField countryRegionFormField = recognizedFields.get("CountryRegion");
             if (countryRegionFormField != null) {
                 if (FieldValueType.STRING == countryRegionFormField.getValue().getValueType()) {
                     String countryRegion = countryRegionFormField.getValue().asCountryRegion();
                     System.out.printf("Country or region: %s, confidence: %.2f%n",
                         countryRegion, countryRegionFormField.getConfidence());
                 }
             }

             FormField dateOfExpirationField = recognizedFields.get("DateOfExpiration");
             if (dateOfExpirationField != null) {
                 if (FieldValueType.DATE == dateOfExpirationField.getValue().getValueType()) {
                     LocalDate expirationDate = dateOfExpirationField.getValue().asDate();
                     System.out.printf("Document date of expiration: %s, confidence: %.2f%n",
                         expirationDate, dateOfExpirationField.getConfidence());
                 }
             }

             FormField documentNumberField = recognizedFields.get("DocumentNumber");
             if (documentNumberField != null) {
                 if (FieldValueType.STRING == documentNumberField.getValue().getValueType()) {
                     String documentNumber = documentNumberField.getValue().asString();
                     System.out.printf("Document number: %s, confidence: %.2f%n",
                         documentNumber, documentNumberField.getConfidence());
                 }
             }
         }
     });

Parameters:

identityDocument - ID ドキュメント情報を認識するドキュメントのデータ。
length - データの正確な長さ。

Returns:

PollerFlux<T,U>完了、失敗、または取り消されるまで、識別 ID ドキュメント操作をポーリングする 。 完了した操作は、 の RecognizedForm一覧を返します。

beginRecognizeIdentityDocuments

public PollerFlux<>> beginRecognizeIdentityDocuments(Flux identityDocument, long length, RecognizeIdentityDocumentOptions recognizeIdentityDocumentOptions)

光学式文字認識 (OCR) と ID ドキュメント モデルでトレーニングされた事前構築済みモデルを使用して ID ドキュメントを分析し、パスポートと米国の運転免許証から重要な情報を抽出します。 ID ドキュメントで見つかったフィールドについては、 こちらを 参照してください。

このサービスは、実行時間の長い操作の取り消しをサポートせず、取り消しサポートがないことを示すエラー メッセージを返します。

再試行が identityDocument 有効になっている場合は、渡された を再生可能にする必要があることに注意してください (既定値)。 つまり、 は Flux サブスクライブされるたびに同じデータを生成する必要があります。

Code sample

File licenseDocument = new File("local/file_path/license.jpg");
 boolean includeFieldElements = true;
 // Utility method to convert input stream to Byte buffer
 Flux<ByteBuffer> buffer =
     toFluxByteBuffer(new ByteArrayInputStream(Files.readAllBytes(licenseDocument.toPath())));
 // if training polling operation completed, retrieve the final result.
 formRecognizerAsyncClient.beginRecognizeIdentityDocuments(buffer,
     licenseDocument.length(),
     new RecognizeIdentityDocumentOptions()
         .setContentType(FormContentType.IMAGE_JPEG)
         .setFieldElementsIncluded(includeFieldElements))
     .setPollInterval(Duration.ofSeconds(5))
     .flatMap(AsyncPollResponse::getFinalResult)
     .subscribe(recognizedIDDocumentResult -> {
         for (int i = 0; i < recognizedIDDocumentResult.size(); i++) {
             RecognizedForm recognizedForm = recognizedIDDocumentResult.get(i);
             Map<String, FormField> recognizedFields = recognizedForm.getFields();
             System.out.printf("----------- Recognized license info for page %d -----------%n", i);

             FormField firstNameField = recognizedFields.get("FirstName");
             if (firstNameField != null) {
                 if (FieldValueType.STRING == firstNameField.getValue().getValueType()) {
                     String firstName = firstNameField.getValue().asString();
                     System.out.printf("First Name: %s, confidence: %.2f%n",
                         firstName, firstNameField.getConfidence());
                 }
             }

             FormField lastNameField = recognizedFields.get("LastName");
             if (lastNameField != null) {
                 if (FieldValueType.STRING == lastNameField.getValue().getValueType()) {
                     String lastName = lastNameField.getValue().asString();
                     System.out.printf("Last name: %s, confidence: %.2f%n",
                         lastName, lastNameField.getConfidence());
                 }
             }

             FormField countryRegionFormField = recognizedFields.get("CountryRegion");
             if (countryRegionFormField != null) {
                 if (FieldValueType.STRING == countryRegionFormField.getValue().getValueType()) {
                     String countryRegion = countryRegionFormField.getValue().asCountryRegion();
                     System.out.printf("Country or region: %s, confidence: %.2f%n",
                         countryRegion, countryRegionFormField.getConfidence());
                 }
             }

             FormField dateOfExpirationField = recognizedFields.get("DateOfExpiration");
             if (dateOfExpirationField != null) {
                 if (FieldValueType.DATE == dateOfExpirationField.getValue().getValueType()) {
                     LocalDate expirationDate = dateOfExpirationField.getValue().asDate();
                     System.out.printf("Document date of expiration: %s, confidence: %.2f%n",
                         expirationDate, dateOfExpirationField.getConfidence());
                 }
             }

             FormField documentNumberField = recognizedFields.get("DocumentNumber");
             if (documentNumberField != null) {
                 if (FieldValueType.STRING == documentNumberField.getValue().getValueType()) {
                     String documentNumber = documentNumberField.getValue().asString();
                     System.out.printf("Document number: %s, confidence: %.2f%n",
                         documentNumber, documentNumberField.getConfidence());
                 }
             }
         }
     });

Parameters:

identityDocument - ID ドキュメント情報を認識するドキュメントのデータ。
length - データの正確な長さ。
recognizeIdentityDocumentOptions - ID ドキュメントを分析するときに渡される可能性がある追加の構成可能 RecognizeIdentityDocumentOptions

Returns:

PollerFlux<T,U>完了、失敗、または取り消されるまで、認識 ID ドキュメント操作をポーリングする 。 完了した操作は、 の一覧 RecognizedFormを返します。

beginRecognizeIdentityDocumentsFromUrl

public PollerFlux<>> beginRecognizeIdentityDocumentsFromUrl(String identityDocumentUrl)

光学式文字認識 (OCR) と ID ドキュメント モデルでトレーニングされた事前構築済みモデルを使用して ID ドキュメントを分析し、パスポートと米国の運転免許証から重要な情報を抽出します。 ID ドキュメントで見つかったフィールドについては、 こちらを 参照してください。

このサービスは、実行時間の長い操作の取り消しをサポートせず、取り消しサポートがないことを示すエラー メッセージを返します。

Code sample

String idDocumentUrl = "idDocumentUrl";
 // if training polling operation completed, retrieve the final result.
 formRecognizerAsyncClient.beginRecognizeIdentityDocumentsFromUrl(idDocumentUrl)
     .flatMap(AsyncPollResponse::getFinalResult)
     .subscribe(recognizedIDDocumentResult -> {
         for (int i = 0; i < recognizedIDDocumentResult.size(); i++) {
             RecognizedForm recognizedForm = recognizedIDDocumentResult.get(i);
             Map<String, FormField> recognizedFields = recognizedForm.getFields();
             System.out.printf("----------- Recognized license info for page %d -----------%n", i);

             FormField firstNameField = recognizedFields.get("FirstName");
             if (firstNameField != null) {
                 if (FieldValueType.STRING == firstNameField.getValue().getValueType()) {
                     String firstName = firstNameField.getValue().asString();
                     System.out.printf("First Name: %s, confidence: %.2f%n",
                         firstName, firstNameField.getConfidence());
                 }
             }

             FormField lastNameField = recognizedFields.get("LastName");
             if (lastNameField != null) {
                 if (FieldValueType.STRING == lastNameField.getValue().getValueType()) {
                     String lastName = lastNameField.getValue().asString();
                     System.out.printf("Last name: %s, confidence: %.2f%n",
                         lastName, lastNameField.getConfidence());
                 }
             }

             FormField countryRegionFormField = recognizedFields.get("CountryRegion");
             if (countryRegionFormField != null) {
                 if (FieldValueType.STRING == countryRegionFormField.getValue().getValueType()) {
                     String countryRegion = countryRegionFormField.getValue().asCountryRegion();
                     System.out.printf("Country or region: %s, confidence: %.2f%n",
                         countryRegion, countryRegionFormField.getConfidence());
                 }
             }

             FormField dateOfExpirationField = recognizedFields.get("DateOfExpiration");
             if (dateOfExpirationField != null) {
                 if (FieldValueType.DATE == dateOfExpirationField.getValue().getValueType()) {
                     LocalDate expirationDate = dateOfExpirationField.getValue().asDate();
                     System.out.printf("Document date of expiration: %s, confidence: %.2f%n",
                         expirationDate, dateOfExpirationField.getConfidence());
                 }
             }

             FormField documentNumberField = recognizedFields.get("DocumentNumber");
             if (documentNumberField != null) {
                 if (FieldValueType.STRING == documentNumberField.getValue().getValueType()) {
                     String documentNumber = documentNumberField.getValue().asString();
                     System.out.printf("Document number: %s, confidence: %.2f%n",
                         documentNumber, documentNumberField.getConfidence());
                 }
             }
         }
     });

Parameters:

identityDocumentUrl - 入力 ID ドキュメントのソース URL。

Returns:

PollerFlux<T,U>完了、失敗、または取り消されるまで、認識 ID ドキュメント操作をポーリングする 。 完了した操作は、 の一覧 RecognizedFormを返します。

beginRecognizeIdentityDocumentsFromUrl

public PollerFlux<>> beginRecognizeIdentityDocumentsFromUrl(String identityDocumentUrl, RecognizeIdentityDocumentOptions recognizeIdentityDocumentOptions)

光学式文字認識 (OCR) と ID ドキュメント モデルでトレーニングされた事前構築済みモデルを使用して ID ドキュメントを分析し、パスポートと米国の運転免許証から重要な情報を抽出します。 ID ドキュメントで見つかったフィールドについては、 こちらを 参照してください。

このサービスは、実行時間の長い操作の取り消しをサポートせず、取り消しサポートがないことを示すエラー メッセージを返します。

Code sample

String licenseDocumentUrl = "licenseDocumentUrl";
 boolean includeFieldElements = true;
 // if training polling operation completed, retrieve the final result.
 formRecognizerAsyncClient.beginRecognizeIdentityDocumentsFromUrl(licenseDocumentUrl,
     new RecognizeIdentityDocumentOptions()
         .setFieldElementsIncluded(includeFieldElements))
     .setPollInterval(Duration.ofSeconds(5))
     .flatMap(AsyncPollResponse::getFinalResult)
     .subscribe(recognizedIDDocumentResult -> {
         for (int i = 0; i < recognizedIDDocumentResult.size(); i++) {
             RecognizedForm recognizedForm = recognizedIDDocumentResult.get(i);
             Map<String, FormField> recognizedFields = recognizedForm.getFields();
             System.out.printf("----------- Recognized license info for page %d -----------%n", i);

             FormField firstNameField = recognizedFields.get("FirstName");
             if (firstNameField != null) {
                 if (FieldValueType.STRING == firstNameField.getValue().getValueType()) {
                     String firstName = firstNameField.getValue().asString();
                     System.out.printf("First Name: %s, confidence: %.2f%n",
                         firstName, firstNameField.getConfidence());
                 }
             }

             FormField lastNameField = recognizedFields.get("LastName");
             if (lastNameField != null) {
                 if (FieldValueType.STRING == lastNameField.getValue().getValueType()) {
                     String lastName = lastNameField.getValue().asString();
                     System.out.printf("Last name: %s, confidence: %.2f%n",
                         lastName, lastNameField.getConfidence());
                 }
             }

             FormField countryRegionFormField = recognizedFields.get("CountryRegion");
             if (countryRegionFormField != null) {
                 if (FieldValueType.STRING == countryRegionFormField.getValue().getValueType()) {
                     String countryRegion = countryRegionFormField.getValue().asCountryRegion();
                     System.out.printf("Country or region: %s, confidence: %.2f%n",
                         countryRegion, countryRegionFormField.getConfidence());
                 }
             }

             FormField dateOfExpirationField = recognizedFields.get("DateOfExpiration");
             if (dateOfExpirationField != null) {
                 if (FieldValueType.DATE == dateOfExpirationField.getValue().getValueType()) {
                     LocalDate expirationDate = dateOfExpirationField.getValue().asDate();
                     System.out.printf("Document date of expiration: %s, confidence: %.2f%n",
                         expirationDate, dateOfExpirationField.getConfidence());
                 }
             }

             FormField documentNumberField = recognizedFields.get("DocumentNumber");
             if (documentNumberField != null) {
                 if (FieldValueType.STRING == documentNumberField.getValue().getValueType()) {
                     String documentNumber = documentNumberField.getValue().asString();
                     System.out.printf("Document number: %s, confidence: %.2f%n",
                         documentNumber, documentNumberField.getConfidence());
                 }
             }
         }
     });

Parameters:

identityDocumentUrl - 入力 ID ドキュメントのソース URL。
recognizeIdentityDocumentOptions - ID ドキュメントを分析するときに渡される可能性がある追加の構成可能 RecognizeIdentityDocumentOptions

Returns:

PollerFlux<T,U>完了、失敗、または取り消されるまで、分析 ID ドキュメント操作をポーリングする 。 完了した操作は、 の一覧 RecognizedFormを返します。

beginRecognizeInvoices

public PollerFlux<>> beginRecognizeInvoices(Flux invoice, long length)

光学式文字認識 (OCR) と事前構築済みの請求書トレーニング済みモデルを使用して、請求書データを認識します。

このサービスは、実行時間の長い操作の取り消しをサポートせず、取り消しサポートがないことを示すエラー メッセージを返します。

請求書で見つかったフィールドについては、 こちらを 参照してください。 再試行が invoice 有効になっている場合は、渡された を再生可能にする必要があることに注意してください (既定値)。 つまり、 は Flux サブスクライブされるたびに同じデータを生成する必要があります。

Code sample

File invoice = new File("local/file_path/invoice.jpg");
 Flux<ByteBuffer> buffer =
     toFluxByteBuffer(new ByteArrayInputStream(Files.readAllBytes(invoice.toPath())));
 // if training polling operation completed, retrieve the final result.
 formRecognizerAsyncClient.beginRecognizeInvoices(buffer, invoice.length())
     .flatMap(AsyncPollResponse::getFinalResult)
     .subscribe(recognizedInvoices -> {
         for (int i = 0; i < recognizedInvoices.size(); i++) {
             RecognizedForm recognizedForm = recognizedInvoices.get(i);
             Map<String, FormField> recognizedFields = recognizedForm.getFields();
             FormField customAddrFormField = recognizedFields.get("CustomerAddress");
             if (customAddrFormField != null) {
                 if (FieldValueType.STRING == customAddrFormField.getValue().getValueType()) {
                     System.out.printf("Customer Address: %s%n", customAddrFormField.getValue().asString());
                 }
             }
             FormField invoiceDateFormField = recognizedFields.get("InvoiceDate");
             if (invoiceDateFormField != null) {
                 if (FieldValueType.DATE == invoiceDateFormField.getValue().getValueType()) {
                     LocalDate invoiceDate = invoiceDateFormField.getValue().asDate();
                     System.out.printf("Invoice Date: %s, confidence: %.2f%n",
                         invoiceDate, invoiceDateFormField.getConfidence());
                 }
             }
         }
     });

Parameters:

invoice - 請求書情報を認識するドキュメントのデータ。
length - データの正確な長さ。

Returns:

PollerFlux<T,U>完了、失敗、または取り消されるまで、認識請求書操作をポーリングする 。 完了した操作は、 の一覧 RecognizedFormを返します。

beginRecognizeInvoices

public PollerFlux<>> beginRecognizeInvoices(Flux invoice, long length, RecognizeInvoicesOptions recognizeInvoicesOptions)

光学式文字認識 (OCR) と事前構築済みの請求書トレーニング済みモデルを使用して、ドキュメントからの請求書データを認識します。

このサービスは、実行時間の長い操作の取り消しをサポートせず、取り消しサポートがないことを示すエラー メッセージを返します。

請求書で見つかったフィールドについては、 こちらを 参照してください。 再試行が invoice 有効になっている場合は、渡された を再生可能にする必要があることに注意してください (既定値)。 つまり、 は Flux サブスクライブされるたびに同じデータを生成する必要があります。

Code sample

File invoice = new File("local/file_path/invoice.jpg");
 boolean includeFieldElements = true;
 // Utility method to convert input stream to Byte buffer
 Flux<ByteBuffer> buffer =
     toFluxByteBuffer(new ByteArrayInputStream(Files.readAllBytes(invoice.toPath())));
 // if training polling operation completed, retrieve the final result.
 formRecognizerAsyncClient.beginRecognizeInvoices(buffer,
     invoice.length(),
     new RecognizeInvoicesOptions()
         .setContentType(FormContentType.IMAGE_JPEG)
         .setFieldElementsIncluded(includeFieldElements))
     .setPollInterval(Duration.ofSeconds(5))
     .flatMap(AsyncPollResponse::getFinalResult)
     .subscribe(recognizedInvoices -> {
         for (int i = 0; i < recognizedInvoices.size(); i++) {
             RecognizedForm recognizedForm = recognizedInvoices.get(i);
             Map<String, FormField> recognizedFields = recognizedForm.getFields();
             FormField customAddrFormField = recognizedFields.get("CustomerAddress");
             if (customAddrFormField != null) {
                 if (FieldValueType.STRING == customAddrFormField.getValue().getValueType()) {
                     System.out.printf("Customer Address: %s%n", customAddrFormField.getValue().asString());
                 }
             }
             FormField invoiceDateFormField = recognizedFields.get("InvoiceDate");
             if (invoiceDateFormField != null) {
                 if (FieldValueType.DATE == invoiceDateFormField.getValue().getValueType()) {
                     LocalDate invoiceDate = invoiceDateFormField.getValue().asDate();
                     System.out.printf("Invoice Date: %s, confidence: %.2f%n",
                         invoiceDate, invoiceDateFormField.getConfidence());
                 }
             }
         }
     });

Parameters:

invoice - 請求書情報を認識するドキュメントのデータ。
length - データの正確な長さ。
recognizeInvoicesOptions - 請求書を分析するときに渡される可能性がある追加の構成可能 RecognizeInvoicesOptions

Returns:

PollerFlux<T,U>完了、失敗、または取り消されるまで、認識請求書操作をポーリングする 。 完了した操作は、 の一覧 RecognizedFormを返します。

beginRecognizeInvoicesFromUrl

public PollerFlux<>> beginRecognizeInvoicesFromUrl(String invoiceUrl)

光学式文字認識 (OCR) と事前構築済みの請求書トレーニング済みモデルを使用して、請求書データを認識します。

このサービスは、実行時間の長い操作の取り消しをサポートせず、取り消しサポートがないことを示すエラー メッセージを返します。

請求書で見つかったフィールドについては、 こちらを 参照してください。

Code sample

String invoiceUrl = "invoice_url";
 // if training polling operation completed, retrieve the final result.
 formRecognizerAsyncClient.beginRecognizeInvoicesFromUrl(invoiceUrl)
     .flatMap(AsyncPollResponse::getFinalResult)
     .subscribe(recognizedInvoices -> {
         for (int i = 0; i < recognizedInvoices.size(); i++) {
             RecognizedForm recognizedForm = recognizedInvoices.get(i);
             Map<String, FormField> recognizedFields = recognizedForm.getFields();
             FormField customAddrFormField = recognizedFields.get("CustomerAddress");
             if (customAddrFormField != null) {
                 if (FieldValueType.STRING == customAddrFormField.getValue().getValueType()) {
                     System.out.printf("Customer Address: %s%n", customAddrFormField.getValue().asString());
                 }
             }
             FormField invoiceDateFormField = recognizedFields.get("InvoiceDate");
             if (invoiceDateFormField != null) {
                 if (FieldValueType.DATE == invoiceDateFormField.getValue().getValueType()) {
                     LocalDate invoiceDate = invoiceDateFormField.getValue().asDate();
                     System.out.printf("Invoice Date: %s, confidence: %.2f%n",
                         invoiceDate, invoiceDateFormField.getConfidence());
                 }
             }
         }
     });

Parameters:

invoiceUrl - 分析する請求書の URL。

Returns:

PollerFlux<T,U>完了、失敗、または取り消されるまで、認識請求書操作をポーリングする 。 完了した操作は、 の一覧 RecognizedFormを返します。

beginRecognizeInvoicesFromUrl

public PollerFlux<>> beginRecognizeInvoicesFromUrl(String invoiceUrl, RecognizeInvoicesOptions recognizeInvoicesOptions)

光学式文字認識 (OCR) と事前構築済みの請求書トレーニング済みモデルを使用して、請求書データを認識します。

このサービスは、実行時間の長い操作の取り消しをサポートせず、取り消しサポートがないことを示すエラー メッセージを返します。

Code sample

String invoiceUrl = "invoice_url";
 boolean includeFieldElements = true;
 // if training polling operation completed, retrieve the final result.
 formRecognizerAsyncClient.beginRecognizeInvoicesFromUrl(invoiceUrl,
     new RecognizeInvoicesOptions()
         .setFieldElementsIncluded(includeFieldElements))
     .setPollInterval(Duration.ofSeconds(5))
     .flatMap(AsyncPollResponse::getFinalResult)
     .subscribe(recognizedInvoices -> {
         for (int i = 0; i < recognizedInvoices.size(); i++) {
             RecognizedForm recognizedForm = recognizedInvoices.get(i);
             Map<String, FormField> recognizedFields = recognizedForm.getFields();
             FormField customAddrFormField = recognizedFields.get("CustomerAddress");
             if (customAddrFormField != null) {
                 if (FieldValueType.STRING == customAddrFormField.getValue().getValueType()) {
                     System.out.printf("Customer Address: %s%n", customAddrFormField.getValue().asString());
                 }
             }
             FormField invoiceDateFormField = recognizedFields.get("InvoiceDate");
             if (invoiceDateFormField != null) {
                 if (FieldValueType.DATE == invoiceDateFormField.getValue().getValueType()) {
                     LocalDate invoiceDate = invoiceDateFormField.getValue().asDate();
                     System.out.printf("Invoice Date: %s, confidence: %.2f%n",
                         invoiceDate, invoiceDateFormField.getConfidence());
                 }
             }
         }
     });

Parameters:

invoiceUrl - 入力請求書のソース URL。
recognizeInvoicesOptions - 請求書を分析するときに渡される可能性がある追加の構成可能 RecognizeInvoicesOptions

Returns:

PollerFlux<T,U>完了、失敗、または取り消されるまで、認識請求書操作をポーリングする 。 完了した操作は、 の一覧 RecognizedFormを返します。

beginRecognizeReceipts

public PollerFlux<>> beginRecognizeReceipts(Flux receipt, long length)

光学式文字認識 (OCR) と事前構築済みのレシートトレーニング済みモデルを使用して、レシート データを認識します。

このサービスは、実行時間の長い操作の取り消しをサポートせず、取り消しサポートがないことを示すエラー メッセージを返します。

領収書で見つかったフィールドについては、 こちらを 参照してください。 再試行が receipt 有効になっている場合は、渡された を再生可能にする必要があることに注意してください (既定値)。 つまり、 は Flux サブスクライブされるたびに同じデータを生成する必要があります。

Code sample

String formUrl = "{form_url}";
 String modelId = "{custom_trained_model_id}";

 // if training polling operation completed, retrieve the final result.
 formRecognizerAsyncClient.beginRecognizeCustomFormsFromUrl(modelId, formUrl)
     // if training polling operation completed, retrieve the final result.
     .flatMap(AsyncPollResponse::getFinalResult)
     .flatMap(Flux::fromIterable)
     .subscribe(recognizedForm -> recognizedForm.getFields()
         .forEach((fieldText, formField) -> {
             System.out.printf("Field text: %s%n", fieldText);
             System.out.printf("Field value data text: %s%n", formField.getValueData().getText());
             System.out.printf("Confidence score: %.2f%n", formField.getConfidence());
         }));

Parameters:

receipt - 領収書情報を認識するドキュメントのデータ。
length - データの正確な長さ。

Returns:

PollerFlux<T,U>完了、失敗、または取り消されるまで、受信確認操作をポーリングする 。 完了した操作は、 の一覧 RecognizedFormを返します。

beginRecognizeReceipts

public PollerFlux<>> beginRecognizeReceipts(Flux receipt, long length, RecognizeReceiptsOptions recognizeReceiptsOptions)

光学式文字認識 (OCR) と事前構築済みのレシートトレーニング済みモデルを使用して、ドキュメントからのレシート データを認識します。

このサービスは、実行時間の長い操作の取り消しをサポートせず、取り消しサポートがないことを示すエラー メッセージを返します。

領収書で見つかったフィールドについては、 こちらを 参照してください。 再試行が receipt 有効になっている場合は、渡された を再生可能にする必要があることに注意してください (既定値)。 つまり、 は Flux サブスクライブされるたびに同じデータを生成する必要があります。

Code sample

String formUrl = "{form_url}";
 String modelId = "{custom_trained_model_id}";

 // if training polling operation completed, retrieve the final result.
 formRecognizerAsyncClient.beginRecognizeCustomFormsFromUrl(modelId, formUrl)
     // if training polling operation completed, retrieve the final result.
     .flatMap(AsyncPollResponse::getFinalResult)
     .flatMap(Flux::fromIterable)
     .subscribe(recognizedForm -> recognizedForm.getFields()
         .forEach((fieldText, formField) -> {
             System.out.printf("Field text: %s%n", fieldText);
             System.out.printf("Field value data text: %s%n", formField.getValueData().getText());
             System.out.printf("Confidence score: %.2f%n", formField.getConfidence());
         }));

Parameters:

receipt - 領収書情報を認識するドキュメントのデータ。
length - データの正確な長さ。
recognizeReceiptsOptions - 領収書を分析するときに渡される可能性がある追加の構成可能 RecognizeReceiptsOptions

Returns:

PollerFlux<T,U>完了、失敗、または取り消されるまで、受信確認操作をポーリングする 。 完了した操作は、 の一覧 RecognizedFormを返します。

beginRecognizeReceiptsFromUrl

public PollerFlux<>> beginRecognizeReceiptsFromUrl(String receiptUrl)

光学式文字認識 (OCR) と事前構築済みのレシートトレーニング済みモデルを使用して、レシート データを認識します。

このサービスは、実行時間の長い操作の取り消しをサポートせず、取り消しサポートがないことを示すエラー メッセージを返します。

領収書で見つかったフィールドについては、 こちらを 参照してください。

Code sample

String formUrl = "{form_url}";
 String modelId = "{custom_trained_model_id}";

 // if training polling operation completed, retrieve the final result.
 formRecognizerAsyncClient.beginRecognizeCustomFormsFromUrl(modelId, formUrl)
     // if training polling operation completed, retrieve the final result.
     .flatMap(AsyncPollResponse::getFinalResult)
     .flatMap(Flux::fromIterable)
     .subscribe(recognizedForm -> recognizedForm.getFields()
         .forEach((fieldText, formField) -> {
             System.out.printf("Field text: %s%n", fieldText);
             System.out.printf("Field value data text: %s%n", formField.getValueData().getText());
             System.out.printf("Confidence score: %.2f%n", formField.getConfidence());
         }));

Parameters:

receiptUrl - 分析する領収書の URL。

Returns:

PollerFlux<T,U>完了、失敗、または取り消されるまで、受信確認操作をポーリングする 。 完了した操作は、 の一覧 RecognizedFormを返します。

beginRecognizeReceiptsFromUrl

public PollerFlux<>> beginRecognizeReceiptsFromUrl(String receiptUrl, RecognizeReceiptsOptions recognizeReceiptsOptions)

光学式文字認識 (OCR) と事前構築済みのレシートトレーニング済みモデルを使用して、レシート データを認識します。

このサービスは、実行時間の長い操作の取り消しをサポートせず、取り消しサポートがないことを示すエラー メッセージを返します。

Code sample

String formUrl = "{form_url}";
 String modelId = "{custom_trained_model_id}";

 // if training polling operation completed, retrieve the final result.
 formRecognizerAsyncClient.beginRecognizeCustomFormsFromUrl(modelId, formUrl)
     // if training polling operation completed, retrieve the final result.
     .flatMap(AsyncPollResponse::getFinalResult)
     .flatMap(Flux::fromIterable)
     .subscribe(recognizedForm -> recognizedForm.getFields()
         .forEach((fieldText, formField) -> {
             System.out.printf("Field text: %s%n", fieldText);
             System.out.printf("Field value data text: %s%n", formField.getValueData().getText());
             System.out.printf("Confidence score: %.2f%n", formField.getConfidence());
         }));

Parameters:

receiptUrl - 入力レシートのソース URL。
recognizeReceiptsOptions - 領収書を分析するときに渡される可能性がある追加の構成可能 RecognizeReceiptsOptions

Returns:

PollerFlux<T,U>完了、失敗、または取り消されるまで、受信確認操作をポーリングする 。 完了した操作は、 の RecognizedForm一覧を返します。

適用対象