FormRecognizerClient クラス

FormRecognizerClient は、フォームとイメージから構造化データに情報を抽出します。 これは、事前構築済みモデル (領収書、名刺、請求書、ID ドキュメント) での分析、フォームからのコンテンツ/レイアウトの認識、トレーニング済みモデルからのカスタム フォームの分析に使用するインターフェイスです。 URL からの入力とストリームからの入力に基づいて、さまざまなメソッドが提供されます。

注意

FormRecognizerClient は、API バージョン =v2.1 で使用する <必要があります。

API バージョン 2022-08-31 以降を使用するには、DocumentAnalysisClient をインスタンス化します。

継承
azure.ai.formrecognizer._form_base_client.FormRecognizerClientBase
FormRecognizerClient

コンストラクター

FormRecognizerClient(endpoint: str, credential: AzureKeyCredential | TokenCredential, **kwargs: Any)

パラメーター

endpoint
str
必須

サポートされている Cognitive Services エンドポイント (プロトコルとホスト名など)。 https://westus2.api.cognitive.microsoft.com

credential
AzureKeyCredential または TokenCredential
必須

クライアントが Azure に接続するために必要な資格情報。 API キーまたは からの identityトークン資格情報を使用している場合、これは AzureKeyCredential のインスタンスです。

api_version
str または FormRecognizerApiVersion

要求に使用するサービスの API バージョン。 既定値は API バージョン v2.1 です。 古いバージョンに設定すると、機能の互換性が低下する可能性があります。 サポートされている最新の API バージョンと機能を使用するには、代わりに DocumentAnalysisClient をインスタンス化します。

エンドポイントと API キーを使用した FormRecognizerClient の作成。


   from azure.core.credentials import AzureKeyCredential
   from azure.ai.formrecognizer import FormRecognizerClient
   endpoint = os.environ["AZURE_FORM_RECOGNIZER_ENDPOINT"]
   key = os.environ["AZURE_FORM_RECOGNIZER_KEY"]

   form_recognizer_client = FormRecognizerClient(endpoint, AzureKeyCredential(key))

トークン資格情報を使用して FormRecognizerClient を作成する。


   """DefaultAzureCredential will use the values from these environment
   variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET
   """
   from azure.ai.formrecognizer import FormRecognizerClient
   from azure.identity import DefaultAzureCredential

   endpoint = os.environ["AZURE_FORM_RECOGNIZER_ENDPOINT"]
   credential = DefaultAzureCredential()

   form_recognizer_client = FormRecognizerClient(endpoint, credential)

メソッド

begin_recognize_business_cards

特定のビジネス カードからフィールド テキストとセマンティック値を抽出します。 入力ドキュメントは、サポートされているコンテンツ タイプ ('application/pdf'、'image/jpeg'、'image/png'、'image/tiff' または 'image/bmp' のいずれか) である必要があります。

ビジネス カードで見つかったフィールドについては、こちらを参照してください。https://aka.ms/formrecognizer/businesscardfields

バージョン v2.1 の新機能: begin_recognize_business_cards クライアント メソッド

begin_recognize_business_cards_from_url

特定のビジネス カードからフィールド テキストとセマンティック値を抽出します。 入力ドキュメントは、分析するカードの場所 (URL) である必要があります。

ビジネス カードで見つかったフィールドについては、こちらを参照してください。https://aka.ms/formrecognizer/businesscardfields

バージョン v2.1 の新機能: begin_recognize_business_cards_from_url クライアント メソッド

begin_recognize_content

特定のドキュメントからテキストとコンテンツ/レイアウト情報を抽出します。 入力ドキュメントは、サポートされているコンテンツ タイプ ('application/pdf'、'image/jpeg'、'image/png'、'image/tiff' または 'image/bmp' のいずれか) である必要があります。

バージョン v2.1 の新機能: ページ言語およびreading_orderキーワード (keyword)引数と image/bmp コンテンツのサポート

begin_recognize_content_from_url

指定したドキュメントからテキストとレイアウトの情報を抽出します。 入力ドキュメントは、分析するドキュメントの場所 (URL) である必要があります。

バージョン v2.1 の新機能: ページ言語およびreading_orderキーワード (keyword)引数と image/bmp コンテンツのサポート

begin_recognize_custom_forms

ラベルの有無にかかわらずトレーニングされたモデルを使用して、カスタム フォームを分析します。 分析するフォームは、モデルのトレーニングに使用されたフォームと同じ型である必要があります。 入力ドキュメントは、サポートされているコンテンツ タイプ ('application/pdf'、'image/jpeg'、'image/png'、'image/tiff'、または 'image/bmp' のいずれか) である必要があります。

begin_recognize_custom_forms_from_url

ラベルの有無にかかわらずトレーニングされたモデルを使用して、カスタム フォームを分析します。 分析するフォームは、モデルのトレーニングに使用されたフォームと同じ型である必要があります。 入力ドキュメントは、分析するドキュメントの場所 (URL) である必要があります。

begin_recognize_identity_documents

特定の ID ドキュメントからフィールド テキストとセマンティック値を抽出します。 入力ドキュメントは、サポートされているコンテンツ タイプ ('application/pdf'、'image/jpeg'、'image/png'、'image/tiff' または 'image/bmp' のいずれか) である必要があります。

ID ドキュメントで見つかったフィールドについては、こちらを参照してください。 https://aka.ms/formrecognizer/iddocumentfields

バージョン v2.1 の新機能: begin_recognize_identity_documents クライアント メソッド

begin_recognize_identity_documents_from_url

特定の ID ドキュメントからフィールド テキストとセマンティック値を抽出します。 入力ドキュメントは、分析する ID ドキュメントの場所 (URL) である必要があります。

ID ドキュメントで見つかったフィールドについては、こちらを参照してください。 https://aka.ms/formrecognizer/iddocumentfields

バージョン v2.1 の新機能: begin_recognize_identity_documents_from_url クライアント メソッド

begin_recognize_invoices

特定の請求書からフィールド テキストとセマンティック値を抽出します。 入力ドキュメントは、サポートされているコンテンツ タイプ ('application/pdf'、'image/jpeg'、'image/png'、'image/tiff' または 'image/bmp' のいずれか) である必要があります。

請求書で見つかったフィールドについては、こちらを参照してください。 https://aka.ms/formrecognizer/invoicefields

バージョン v2.1 の新機能: begin_recognize_invoices クライアント メソッド

begin_recognize_invoices_from_url

特定の請求書からフィールド テキストとセマンティック値を抽出します。 入力ドキュメントは、分析する請求書の場所 (URL) である必要があります。

請求書カードで見つかったフィールドについては、こちらを参照してください。https://aka.ms/formrecognizer/invoicefields

バージョン v2.1 の新機能: begin_recognize_invoices_from_url クライアント メソッド

begin_recognize_receipts

特定の売上領収書からフィールド テキストとセマンティック値を抽出します。 入力ドキュメントは、サポートされているコンテンツ タイプ ('application/pdf'、'image/jpeg'、'image/png'、'image/tiff' または 'image/bmp' のいずれか) である必要があります。

レシートで見つかったフィールドについては、こちらを参照してください。 https://aka.ms/formrecognizer/receiptfields

バージョン v2.1 の新機能: 引数と image/bmp コンテンツのサポートキーワード (keyword)ロケールページ

begin_recognize_receipts_from_url

特定の売上領収書からフィールド テキストとセマンティック値を抽出します。 入力ドキュメントは、分析する領収書の場所 (URL) である必要があります。

レシートで見つかったフィールドについては、こちらを参照してください。 https://aka.ms/formrecognizer/receiptfields

バージョン v2.1 の新機能: 引数と image/bmp コンテンツのサポートキーワード (keyword)ロケールページ

close

セッションを FormRecognizerClient 閉じます。

send_request

クライアントの既存のパイプラインを使用してネットワーク要求を実行します。

要求 URL は、ベース URL を基準にして指定できます。 要求に使用されるサービス API のバージョンは、特に指定がない限り、クライアントと同じです。 クライアントの構成済み API バージョンを相対 URL でオーバーライドすることは、API バージョン 2022-08-31 以降のクライアントでサポートされています。 任意の API バージョンでクライアントでサポートされている絶対 URL でのオーバーライド。 応答がエラーの場合、このメソッドは発生しません。例外を発生させる場合は、返された応答オブジェクト に対して raise_for_status() を呼び出します。 このメソッドを使用してカスタム要求を送信する方法の詳細については、「」を参照してください https://aka.ms/azsdk/dpcodegen/python/send_request

begin_recognize_business_cards

特定のビジネス カードからフィールド テキストとセマンティック値を抽出します。 入力ドキュメントは、サポートされているコンテンツ タイプ ('application/pdf'、'image/jpeg'、'image/png'、'image/tiff' または 'image/bmp' のいずれか) である必要があります。

ビジネス カードで見つかったフィールドについては、こちらを参照してください。https://aka.ms/formrecognizer/businesscardfields

バージョン v2.1 の新機能: begin_recognize_business_cards クライアント メソッド

begin_recognize_business_cards(business_card: bytes | IO[bytes], **kwargs: Any) -> LROPoller[List[RecognizedForm]]

パラメーター

business_card
bytes または IO[bytes]
必須

JPEG、PNG、PDF、TIFF、または BMP タイプのファイル ストリームまたはバイト。

locale
str

ビジネス カードのロケール。 サポートされているロケールには、en-US、en-AU、en-CA、en-GB、en-IN が含まれます。

include_field_elements
bool

各フォーム フィールドの行、単語、選択マークなど、ページごとのすべての行とフィールド要素を含めるかどうかを指定します。

pages
list[str]

複数ページのドキュメントのカスタム ページ番号 (PDF/TIFF)。 結果で取得するページ番号やページ範囲を入力します。 ページの範囲には、 pages=["1-3", "5-6"] などのハイフンを使用します。 各ページ番号または範囲をコンマで区切ります。

content_type
str または FormContentType

API に送信される本文のコンテンツ タイプ。 コンテンツ タイプは自動検出されますが、このキーワード (keyword)引数を渡すことでオーバーライドできます。 オプションについては、「」を参照してください FormContentType

continuation_token
str

保存された状態からポーリングを再開するための継続トークン。

戻り値

LROPoller のインスタンス。 poller オブジェクトの result() を呼び出して list[RecognizedForm]を返します。

の戻り値の型 :

例外

ファイルから名刺を認識します。


   from azure.core.credentials import AzureKeyCredential
   from azure.ai.formrecognizer import FormRecognizerClient

   endpoint = os.environ["AZURE_FORM_RECOGNIZER_ENDPOINT"]
   key = os.environ["AZURE_FORM_RECOGNIZER_KEY"]

   form_recognizer_client = FormRecognizerClient(
       endpoint=endpoint, credential=AzureKeyCredential(key)
   )
   with open(path_to_sample_forms, "rb") as f:
       poller = form_recognizer_client.begin_recognize_business_cards(business_card=f, locale="en-US")
   business_cards = poller.result()

   for idx, business_card in enumerate(business_cards):
       print("--------Recognizing business card #{}--------".format(idx+1))
       contact_names = business_card.fields.get("ContactNames")
       if contact_names:
           for contact_name in contact_names.value:
               print("Contact First Name: {} has confidence: {}".format(
                   contact_name.value["FirstName"].value, contact_name.value["FirstName"].confidence
               ))
               print("Contact Last Name: {} has confidence: {}".format(
                   contact_name.value["LastName"].value, contact_name.value["LastName"].confidence
               ))
       company_names = business_card.fields.get("CompanyNames")
       if company_names:
           for company_name in company_names.value:
               print("Company Name: {} has confidence: {}".format(company_name.value, company_name.confidence))
       departments = business_card.fields.get("Departments")
       if departments:
           for department in departments.value:
               print("Department: {} has confidence: {}".format(department.value, department.confidence))
       job_titles = business_card.fields.get("JobTitles")
       if job_titles:
           for job_title in job_titles.value:
               print("Job Title: {} has confidence: {}".format(job_title.value, job_title.confidence))
       emails = business_card.fields.get("Emails")
       if emails:
           for email in emails.value:
               print("Email: {} has confidence: {}".format(email.value, email.confidence))
       websites = business_card.fields.get("Websites")
       if websites:
           for website in websites.value:
               print("Website: {} has confidence: {}".format(website.value, website.confidence))
       addresses = business_card.fields.get("Addresses")
       if addresses:
           for address in addresses.value:
               print("Address: {} has confidence: {}".format(address.value, address.confidence))
       mobile_phones = business_card.fields.get("MobilePhones")
       if mobile_phones:
           for phone in mobile_phones.value:
               print("Mobile phone number: {} has confidence: {}".format(phone.value, phone.confidence))
       faxes = business_card.fields.get("Faxes")
       if faxes:
           for fax in faxes.value:
               print("Fax number: {} has confidence: {}".format(fax.value, fax.confidence))
       work_phones = business_card.fields.get("WorkPhones")
       if work_phones:
           for work_phone in work_phones.value:
               print("Work phone number: {} has confidence: {}".format(work_phone.value, work_phone.confidence))
       other_phones = business_card.fields.get("OtherPhones")
       if other_phones:
           for other_phone in other_phones.value:
               print("Other phone number: {} has confidence: {}".format(other_phone.value, other_phone.confidence))

begin_recognize_business_cards_from_url

特定のビジネス カードからフィールド テキストとセマンティック値を抽出します。 入力ドキュメントは、分析するカードの場所 (URL) である必要があります。

ビジネス カードで見つかったフィールドについては、こちらを参照してください。https://aka.ms/formrecognizer/businesscardfields

バージョン v2.1 の新機能: begin_recognize_business_cards_from_url クライアント メソッド

begin_recognize_business_cards_from_url(business_card_url: str, **kwargs: Any) -> LROPoller[List[RecognizedForm]]

パラメーター

business_card_url
str
必須

分析するビジネス カードの URL。 入力は、JPEG、PNG、PDF、TIFF、BMP のいずれかの有効なエンコードされた URL である必要があります。

locale
str

ビジネス カードのロケール。 サポートされているロケールには、en-US、en-AU、en-CA、en-GB、en-IN が含まれます。

include_field_elements
bool

各フォーム フィールドの行、単語、選択マークなど、ページごとのすべての行とフィールド要素を含めるかどうかを指定します。

pages
list[str]

複数ページのドキュメントのカスタム ページ番号 (PDF/TIFF)。 結果で取得するページ番号やページ範囲を入力します。 ページの範囲には、 pages=["1-3", "5-6"] などのハイフンを使用します。 各ページ番号または範囲をコンマで区切ります。

continuation_token
str

保存された状態からポーリングを再開するための継続トークン。

戻り値

LROPoller のインスタンス。 poller オブジェクトの result() を呼び出して list[RecognizedForm]を返します。

の戻り値の型 :

例外

begin_recognize_content

特定のドキュメントからテキストとコンテンツ/レイアウト情報を抽出します。 入力ドキュメントは、サポートされているコンテンツ タイプ ('application/pdf'、'image/jpeg'、'image/png'、'image/tiff' または 'image/bmp' のいずれか) である必要があります。

バージョン v2.1 の新機能: ページ言語およびreading_orderキーワード (keyword)引数と image/bmp コンテンツのサポート

begin_recognize_content(form: bytes | IO[bytes], **kwargs: Any) -> LROPoller[List[FormPage]]

パラメーター

form
bytes または IO[bytes]
必須

JPEG、PNG、PDF、TIFF、または BMP タイプのファイル ストリームまたはバイト。

pages
list[str]

複数ページのドキュメントのカスタム ページ番号 (PDF/TIFF)。 結果で取得するページ番号やページ範囲を入力します。 ページの範囲には、 pages=["1-3", "5-6"] などのハイフンを使用します。 各ページ番号または範囲をコンマで区切ります。

language
str

ドキュメント内のテキストの BCP-47 言語コード。 サポートされている言語コードについては、こちらを参照してください。 https://docs.microsoft.com/azure/cognitive-services/form-recognizer/language-support コンテンツは自動言語識別と多言語ドキュメントをサポートしているため、ドキュメントをその特定の言語として強制的に処理する場合にのみ言語コードを提供します。

reading_order
str

返されたテキスト行を並べ替える読み取り順序アルゴリズム。 サポートされている読み取り順序には、basic (既定値)、natural が含まれます。 'basic' を設定して行を左から右、上から下に並べ替えますが、場合によっては近接性が高い優先順位で処理されます。 位置情報を使用して行を並べ替えて近くの行を一緒に維持するには、"natural" を設定します。

content_type
str または FormContentType

API に送信される本文のコンテンツ タイプ。 コンテンツ タイプは自動検出されますが、このキーワード (keyword)引数を渡すことでオーバーライドできます。 オプションについては、「」を参照してください FormContentType

continuation_token
str

保存された状態からポーリングを再開するための継続トークン。

戻り値

LROPoller のインスタンス。 poller オブジェクトの result() を呼び出して list[FormPage]を返します。

の戻り値の型 :

例外

フォームからテキストとコンテンツ/レイアウト情報を認識します。


   from azure.core.credentials import AzureKeyCredential
   from azure.ai.formrecognizer import FormRecognizerClient

   endpoint = os.environ["AZURE_FORM_RECOGNIZER_ENDPOINT"]
   key = os.environ["AZURE_FORM_RECOGNIZER_KEY"]

   form_recognizer_client = FormRecognizerClient(endpoint=endpoint, credential=AzureKeyCredential(key))
   with open(path_to_sample_forms, "rb") as f:
       poller = form_recognizer_client.begin_recognize_content(form=f)
   form_pages = poller.result()

   for idx, content in enumerate(form_pages):
       print("----Recognizing content from page #{}----".format(idx+1))
       print("Page has width: {} and height: {}, measured with unit: {}".format(
           content.width,
           content.height,
           content.unit
       ))
       for table_idx, table in enumerate(content.tables):
           print("Table # {} has {} rows and {} columns".format(table_idx, table.row_count, table.column_count))
           print("Table # {} location on page: {}".format(table_idx, format_bounding_box(table.bounding_box)))
           for cell in table.cells:
               print("...Cell[{}][{}] has text '{}' within bounding box '{}'".format(
                   cell.row_index,
                   cell.column_index,
                   cell.text,
                   format_bounding_box(cell.bounding_box)
               ))

       for line_idx, line in enumerate(content.lines):
           print("Line # {} has word count '{}' and text '{}' within bounding box '{}'".format(
               line_idx,
               len(line.words),
               line.text,
               format_bounding_box(line.bounding_box)
           ))
           if line.appearance:
               if line.appearance.style_name == "handwriting" and line.appearance.style_confidence > 0.8:
                   print("Text line '{}' is handwritten and might be a signature.".format(line.text))
           for word in line.words:
               print("...Word '{}' has a confidence of {}".format(word.text, word.confidence))

       for selection_mark in content.selection_marks:
           print("Selection mark is '{}' within bounding box '{}' and has a confidence of {}".format(
               selection_mark.state,
               format_bounding_box(selection_mark.bounding_box),
               selection_mark.confidence
           ))
       print("----------------------------------------")


begin_recognize_content_from_url

指定したドキュメントからテキストとレイアウトの情報を抽出します。 入力ドキュメントは、分析するドキュメントの場所 (URL) である必要があります。

バージョン v2.1 の新機能: ページ言語およびreading_orderキーワード (keyword)引数と image/bmp コンテンツのサポート

begin_recognize_content_from_url(form_url: str, **kwargs: Any) -> LROPoller[List[FormPage]]

パラメーター

form_url
str
必須

分析するフォームの URL。 入力は、JPEG、PNG、PDF、TIFF、BMP のいずれかの有効なエンコードされた URL である必要があります。

pages
list[str]

複数ページのドキュメントのカスタム ページ番号 (PDF/TIFF)。 結果で取得するページ番号やページ範囲を入力します。 ページの範囲には、 pages=["1-3", "5-6"] などのハイフンを使用します。 各ページ番号または範囲をコンマで区切ります。

language
str

ドキュメント内のテキストの BCP-47 言語コード。 サポートされている言語コードについては、こちらを参照してください。 https://docs.microsoft.com/azure/cognitive-services/form-recognizer/language-support コンテンツは自動言語識別と多言語ドキュメントをサポートしているため、ドキュメントをその特定の言語として強制的に処理する場合にのみ言語コードを提供します。

reading_order
str

返されたテキスト行を並べ替える読み取り順序アルゴリズム。 サポートされている読み取り順序には、basic (既定値)、natural が含まれます。 'basic' を設定して行を左から右、上から下に並べ替えますが、場合によっては近接性が高い優先順位で処理されます。 位置情報を使用して行を並べ替えて近くの行を一緒に維持するには、"natural" を設定します。

continuation_token
str

保存された状態からポーリングを再開するための継続トークン。

戻り値

LROPoller のインスタンス。 poller オブジェクトの result() を呼び出して list[FormPage]を返します。

の戻り値の型 :

例外

begin_recognize_custom_forms

ラベルの有無にかかわらずトレーニングされたモデルを使用して、カスタム フォームを分析します。 分析するフォームは、モデルのトレーニングに使用されたフォームと同じ型である必要があります。 入力ドキュメントは、サポートされているコンテンツ タイプ ('application/pdf'、'image/jpeg'、'image/png'、'image/tiff'、または 'image/bmp' のいずれか) である必要があります。

begin_recognize_custom_forms(model_id: str, form: bytes | IO[bytes], **kwargs: Any) -> LROPoller[List[RecognizedForm]]

パラメーター

model_id
str
必須

カスタム モデル識別子。

form
bytes または IO[bytes]
必須

JPEG、PNG、PDF、TIFF、または BMP の種類のファイル ストリームまたはバイト。

include_field_elements
bool

ページごとのすべての行と、各フォーム フィールドの行、単語、選択マークなどのフィールド要素を含めるかどうか。

content_type
str または FormContentType

API に送信される本文のコンテンツ タイプ。 コンテンツ タイプは自動検出されますが、このキーワード (keyword)引数を渡すことでオーバーライドできます。 オプションについては、「」を参照してください FormContentType

pages
list[str]

複数ページのドキュメントのカスタム ページ番号 (PDF/TIFF)。 結果として取得するページ番号やページ範囲を入力します。 ページの範囲には、 pages=["1-3", "5-6"] などのハイフンを使用します。 各ページ番号または範囲をコンマで区切ります。

continuation_token
str

保存された状態からポーリングを再開するための継続トークン。

戻り値

LROPoller のインスタンス。 list[RecognizedForm]を返すには、poller オブジェクトで result() を呼び出します。

の戻り値の型 :

例外

ユーザー設定フォームからフィールドと値を認識します。


   from azure.core.credentials import AzureKeyCredential
   from azure.ai.formrecognizer import FormRecognizerClient

   endpoint = os.environ["AZURE_FORM_RECOGNIZER_ENDPOINT"]
   key = os.environ["AZURE_FORM_RECOGNIZER_KEY"]
   model_id = os.getenv("CUSTOM_TRAINED_MODEL_ID", custom_model_id)

   form_recognizer_client = FormRecognizerClient(
       endpoint=endpoint, credential=AzureKeyCredential(key)
   )

   # Make sure your form's type is included in the list of form types the custom model can recognize
   with open(path_to_sample_forms, "rb") as f:
       poller = form_recognizer_client.begin_recognize_custom_forms(
           model_id=model_id, form=f, include_field_elements=True
       )
   forms = poller.result()

   for idx, form in enumerate(forms):
       print("--------Recognizing Form #{}--------".format(idx+1))
       print("Form has type {}".format(form.form_type))
       print("Form has form type confidence {}".format(form.form_type_confidence))
       print("Form was analyzed with model with ID {}".format(form.model_id))
       for name, field in form.fields.items():
           # each field is of type FormField
           # label_data is populated if you are using a model trained without labels,
           # since the service needs to make predictions for labels if not explicitly given to it.
           if field.label_data:
               print("...Field '{}' has label '{}' with a confidence score of {}".format(
                   name,
                   field.label_data.text,
                   field.confidence
               ))

           print("...Label '{}' has value '{}' with a confidence score of {}".format(
               field.label_data.text if field.label_data else name, field.value, field.confidence
           ))

       # iterate over tables, lines, and selection marks on each page
       for page in form.pages:
           for i, table in enumerate(page.tables):
               print("\nTable {} on page {}".format(i+1, table.page_number))
               for cell in table.cells:
                   print("...Cell[{}][{}] has text '{}' with confidence {}".format(
                       cell.row_index, cell.column_index, cell.text, cell.confidence
                   ))
           print("\nLines found on page {}".format(page.page_number))
           for line in page.lines:
               print("...Line '{}' is made up of the following words: ".format(line.text))
               for word in line.words:
                   print("......Word '{}' has a confidence of {}".format(
                       word.text,
                       word.confidence
                   ))
           if page.selection_marks:
               print("\nSelection marks found on page {}".format(page.page_number))
               for selection_mark in page.selection_marks:
                   print("......Selection mark is '{}' and has a confidence of {}".format(
                       selection_mark.state,
                       selection_mark.confidence
                   ))

       print("-----------------------------------")

begin_recognize_custom_forms_from_url

ラベルの有無にかかわらずトレーニングされたモデルを使用して、カスタム フォームを分析します。 分析するフォームは、モデルのトレーニングに使用されたフォームと同じ型である必要があります。 入力ドキュメントは、分析するドキュメントの場所 (URL) である必要があります。

begin_recognize_custom_forms_from_url(model_id: str, form_url: str, **kwargs: Any) -> LROPoller[List[RecognizedForm]]

パラメーター

model_id
str
必須

カスタム モデル識別子。

form_url
str
必須

分析するフォームの URL。 入力は、JPEG、PNG、PDF、TIFF、BMP のいずれかの有効なエンコードされた URL である必要があります。

include_field_elements
bool

ページごとのすべての行と、各フォーム フィールドの行、単語、選択マークなどのフィールド要素を含めるかどうか。

pages
list[str]

複数ページのドキュメントのカスタム ページ番号 (PDF/TIFF)。 結果として取得するページ番号やページ範囲を入力します。 ページの範囲には、 pages=["1-3", "5-6"] などのハイフンを使用します。 各ページ番号または範囲をコンマで区切ります。

continuation_token
str

保存された状態からポーリングを再開するための継続トークン。

戻り値

LROPoller のインスタンス。 list[RecognizedForm]を返すには、poller オブジェクトで result() を呼び出します。

の戻り値の型 :

例外

begin_recognize_identity_documents

特定の ID ドキュメントからフィールド テキストとセマンティック値を抽出します。 入力ドキュメントは、サポートされているコンテンツ タイプ ('application/pdf'、'image/jpeg'、'image/png'、'image/tiff' または 'image/bmp' のいずれか) である必要があります。

ID ドキュメントで見つかったフィールドについては、こちらを参照してください。 https://aka.ms/formrecognizer/iddocumentfields

バージョン v2.1 の新機能: begin_recognize_identity_documents クライアント メソッド

begin_recognize_identity_documents(identity_document: bytes | IO[bytes], **kwargs: Any) -> LROPoller[List[RecognizedForm]]

パラメーター

identity_document
bytes または IO[bytes]
必須

JPEG、PNG、PDF、TIFF、または BMP の種類のファイル ストリームまたはバイト。

include_field_elements
bool

ページごとのすべての行と、各フォーム フィールドの行、単語、選択マークなどのフィールド要素を含めるかどうか。

content_type
str または FormContentType

API に送信される本文のコンテンツ タイプ。 コンテンツ タイプは自動検出されますが、このキーワード (keyword)引数を渡すことでオーバーライドできます。 オプションについては、「」を参照してください FormContentType

continuation_token
str

保存された状態からポーリングを再開するための継続トークン。

pages
list[str]

複数ページのドキュメントのカスタム ページ番号 (PDF/TIFF)。 結果として取得するページ番号やページ範囲を入力します。 ページの範囲には、 pages=["1-3", "5-6"] などのハイフンを使用します。 各ページ番号または範囲をコンマで区切ります。

戻り値

LROPoller のインスタンス。 list[RecognizedForm]を返すには、poller オブジェクトで result() を呼び出します。

の戻り値の型 :

例外

ID ドキュメント フィールドを認識します。


   from azure.core.credentials import AzureKeyCredential
   from azure.ai.formrecognizer import FormRecognizerClient

   endpoint = os.environ["AZURE_FORM_RECOGNIZER_ENDPOINT"]
   key = os.environ["AZURE_FORM_RECOGNIZER_KEY"]

   form_recognizer_client = FormRecognizerClient(
       endpoint=endpoint, credential=AzureKeyCredential(key)
   )
   with open(path_to_sample_forms, "rb") as f:
       poller = form_recognizer_client.begin_recognize_identity_documents(identity_document=f)
   id_documents = poller.result()

   for idx, id_document in enumerate(id_documents):
       print("--------Recognizing ID document #{}--------".format(idx+1))
       first_name = id_document.fields.get("FirstName")
       if first_name:
           print("First Name: {} has confidence: {}".format(first_name.value, first_name.confidence))
       last_name = id_document.fields.get("LastName")
       if last_name:
           print("Last Name: {} has confidence: {}".format(last_name.value, last_name.confidence))
       document_number = id_document.fields.get("DocumentNumber")
       if document_number:
           print("Document Number: {} has confidence: {}".format(document_number.value, document_number.confidence))
       dob = id_document.fields.get("DateOfBirth")
       if dob:
           print("Date of Birth: {} has confidence: {}".format(dob.value, dob.confidence))
       doe = id_document.fields.get("DateOfExpiration")
       if doe:
           print("Date of Expiration: {} has confidence: {}".format(doe.value, doe.confidence))
       sex = id_document.fields.get("Sex")
       if sex:
           print("Sex: {} has confidence: {}".format(sex.value, sex.confidence))
       address = id_document.fields.get("Address")
       if address:
           print("Address: {} has confidence: {}".format(address.value, address.confidence))
       country_region = id_document.fields.get("CountryRegion")
       if country_region:
           print("Country/Region: {} has confidence: {}".format(country_region.value, country_region.confidence))
       region = id_document.fields.get("Region")
       if region:
           print("Region: {} has confidence: {}".format(region.value, region.confidence))

begin_recognize_identity_documents_from_url

特定の ID ドキュメントからフィールド テキストとセマンティック値を抽出します。 入力ドキュメントは、分析する ID ドキュメントの場所 (URL) である必要があります。

ID ドキュメントで見つかったフィールドについては、こちらを参照してください。 https://aka.ms/formrecognizer/iddocumentfields

バージョン v2.1 の新機能: begin_recognize_identity_documents_from_url クライアント メソッド

begin_recognize_identity_documents_from_url(identity_document_url: str, **kwargs: Any) -> LROPoller[List[RecognizedForm]]

パラメーター

identity_document_url
str
必須

分析する ID ドキュメントの URL。 入力は、JPEG、PNG、PDF、TIFF、BMP のいずれかの有効なエンコードされた URL である必要があります。

include_field_elements
bool

ページごとのすべての行と、各フォーム フィールドの行、単語、選択マークなどのフィールド要素を含めるかどうか。

continuation_token
str

保存された状態からポーリングを再開するための継続トークン。

pages
list[str]

複数ページのドキュメントのカスタム ページ番号 (PDF/TIFF)。 結果として取得するページ番号やページ範囲を入力します。 ページの範囲には、 pages=["1-3", "5-6"] などのハイフンを使用します。 各ページ番号または範囲をコンマで区切ります。

戻り値

LROPoller のインスタンス。 list[RecognizedForm]を返すには、poller オブジェクトで result() を呼び出します。

の戻り値の型 :

例外

begin_recognize_invoices

特定の請求書からフィールド テキストとセマンティック値を抽出します。 入力ドキュメントは、サポートされているコンテンツ タイプ ('application/pdf'、'image/jpeg'、'image/png'、'image/tiff' または 'image/bmp' のいずれか) である必要があります。

請求書で見つかったフィールドについては、こちらを参照してください。 https://aka.ms/formrecognizer/invoicefields

バージョン v2.1 の新機能: begin_recognize_invoices クライアント メソッド

begin_recognize_invoices(invoice: bytes | IO[bytes], **kwargs: Any) -> LROPoller[List[RecognizedForm]]

パラメーター

invoice
bytes または IO[bytes]
必須

JPEG、PNG、PDF、TIFF、または BMP の種類のファイル ストリームまたはバイト。

locale
str

請求書のロケール。 サポートされているロケールは次のとおりです: en-US

include_field_elements
bool

ページごとのすべての行と、各フォーム フィールドの行、単語、選択マークなどのフィールド要素を含めるかどうか。

pages
list[str]

複数ページのドキュメントのカスタム ページ番号 (PDF/TIFF)。 結果として取得するページ番号やページ範囲を入力します。 ページの範囲には、 pages=["1-3", "5-6"] などのハイフンを使用します。 各ページ番号または範囲をコンマで区切ります。

content_type
str または FormContentType

API に送信される本文のコンテンツ タイプ。 コンテンツ タイプは自動検出されますが、このキーワード (keyword)引数を渡すことでオーバーライドできます。 オプションについては、「」を参照してください FormContentType

continuation_token
str

保存された状態からポーリングを再開するための継続トークン。

戻り値

LROPoller のインスタンス。 list[RecognizedForm]を返すには、poller オブジェクトで result() を呼び出します。

の戻り値の型 :

例外

ファイルから請求書を認識します。


   from azure.core.credentials import AzureKeyCredential
   from azure.ai.formrecognizer import FormRecognizerClient

   endpoint = os.environ["AZURE_FORM_RECOGNIZER_ENDPOINT"]
   key = os.environ["AZURE_FORM_RECOGNIZER_KEY"]

   form_recognizer_client = FormRecognizerClient(
       endpoint=endpoint, credential=AzureKeyCredential(key)
   )
   with open(path_to_sample_forms, "rb") as f:
       poller = form_recognizer_client.begin_recognize_invoices(invoice=f, locale="en-US")
   invoices = poller.result()

   for idx, invoice in enumerate(invoices):
       print("--------Recognizing invoice #{}--------".format(idx+1))
       vendor_name = invoice.fields.get("VendorName")
       if vendor_name:
           print("Vendor Name: {} has confidence: {}".format(vendor_name.value, vendor_name.confidence))
       vendor_address = invoice.fields.get("VendorAddress")
       if vendor_address:
           print("Vendor Address: {} has confidence: {}".format(vendor_address.value, vendor_address.confidence))
       vendor_address_recipient = invoice.fields.get("VendorAddressRecipient")
       if vendor_address_recipient:
           print("Vendor Address Recipient: {} has confidence: {}".format(vendor_address_recipient.value, vendor_address_recipient.confidence))
       customer_name = invoice.fields.get("CustomerName")
       if customer_name:
           print("Customer Name: {} has confidence: {}".format(customer_name.value, customer_name.confidence))
       customer_id = invoice.fields.get("CustomerId")
       if customer_id:
           print("Customer Id: {} has confidence: {}".format(customer_id.value, customer_id.confidence))
       customer_address = invoice.fields.get("CustomerAddress")
       if customer_address:
           print("Customer Address: {} has confidence: {}".format(customer_address.value, customer_address.confidence))
       customer_address_recipient = invoice.fields.get("CustomerAddressRecipient")
       if customer_address_recipient:
           print("Customer Address Recipient: {} has confidence: {}".format(customer_address_recipient.value, customer_address_recipient.confidence))
       invoice_id = invoice.fields.get("InvoiceId")
       if invoice_id:
           print("Invoice Id: {} has confidence: {}".format(invoice_id.value, invoice_id.confidence))
       invoice_date = invoice.fields.get("InvoiceDate")
       if invoice_date:
           print("Invoice Date: {} has confidence: {}".format(invoice_date.value, invoice_date.confidence))
       invoice_total = invoice.fields.get("InvoiceTotal")
       if invoice_total:
           print("Invoice Total: {} has confidence: {}".format(invoice_total.value, invoice_total.confidence))
       due_date = invoice.fields.get("DueDate")
       if due_date:
           print("Due Date: {} has confidence: {}".format(due_date.value, due_date.confidence))
       purchase_order = invoice.fields.get("PurchaseOrder")
       if purchase_order:
           print("Purchase Order: {} has confidence: {}".format(purchase_order.value, purchase_order.confidence))
       billing_address = invoice.fields.get("BillingAddress")
       if billing_address:
           print("Billing Address: {} has confidence: {}".format(billing_address.value, billing_address.confidence))
       billing_address_recipient = invoice.fields.get("BillingAddressRecipient")
       if billing_address_recipient:
           print("Billing Address Recipient: {} has confidence: {}".format(billing_address_recipient.value, billing_address_recipient.confidence))
       shipping_address = invoice.fields.get("ShippingAddress")
       if shipping_address:
           print("Shipping Address: {} has confidence: {}".format(shipping_address.value, shipping_address.confidence))
       shipping_address_recipient = invoice.fields.get("ShippingAddressRecipient")
       if shipping_address_recipient:
           print("Shipping Address Recipient: {} has confidence: {}".format(shipping_address_recipient.value, shipping_address_recipient.confidence))
       print("Invoice items:")
       for idx, item in enumerate(invoice.fields.get("Items").value):
           print("...Item #{}".format(idx+1))
           item_description = item.value.get("Description")
           if item_description:
               print("......Description: {} has confidence: {}".format(item_description.value, item_description.confidence))
           item_quantity = item.value.get("Quantity")
           if item_quantity:
               print("......Quantity: {} has confidence: {}".format(item_quantity.value, item_quantity.confidence))
           unit = item.value.get("Unit")
           if unit:
               print("......Unit: {} has confidence: {}".format(unit.value, unit.confidence))
           unit_price = item.value.get("UnitPrice")
           if unit_price:
               print("......Unit Price: {} has confidence: {}".format(unit_price.value, unit_price.confidence))
           product_code = item.value.get("ProductCode")
           if product_code:
               print("......Product Code: {} has confidence: {}".format(product_code.value, product_code.confidence))
           item_date = item.value.get("Date")
           if item_date:
               print("......Date: {} has confidence: {}".format(item_date.value, item_date.confidence))
           tax = item.value.get("Tax")
           if tax:
               print("......Tax: {} has confidence: {}".format(tax.value, tax.confidence))
           amount = item.value.get("Amount")
           if amount:
               print("......Amount: {} has confidence: {}".format(amount.value, amount.confidence))
       subtotal = invoice.fields.get("SubTotal")
       if subtotal:
           print("Subtotal: {} has confidence: {}".format(subtotal.value, subtotal.confidence))
       total_tax = invoice.fields.get("TotalTax")
       if total_tax:
           print("Total Tax: {} has confidence: {}".format(total_tax.value, total_tax.confidence))
       previous_unpaid_balance = invoice.fields.get("PreviousUnpaidBalance")
       if previous_unpaid_balance:
           print("Previous Unpaid Balance: {} has confidence: {}".format(previous_unpaid_balance.value, previous_unpaid_balance.confidence))
       amount_due = invoice.fields.get("AmountDue")
       if amount_due:
           print("Amount Due: {} has confidence: {}".format(amount_due.value, amount_due.confidence))
       service_start_date = invoice.fields.get("ServiceStartDate")
       if service_start_date:
           print("Service Start Date: {} has confidence: {}".format(service_start_date.value, service_start_date.confidence))
       service_end_date = invoice.fields.get("ServiceEndDate")
       if service_end_date:
           print("Service End Date: {} has confidence: {}".format(service_end_date.value, service_end_date.confidence))
       service_address = invoice.fields.get("ServiceAddress")
       if service_address:
           print("Service Address: {} has confidence: {}".format(service_address.value, service_address.confidence))
       service_address_recipient = invoice.fields.get("ServiceAddressRecipient")
       if service_address_recipient:
           print("Service Address Recipient: {} has confidence: {}".format(service_address_recipient.value, service_address_recipient.confidence))
       remittance_address = invoice.fields.get("RemittanceAddress")
       if remittance_address:
           print("Remittance Address: {} has confidence: {}".format(remittance_address.value, remittance_address.confidence))
       remittance_address_recipient = invoice.fields.get("RemittanceAddressRecipient")
       if remittance_address_recipient:
           print("Remittance Address Recipient: {} has confidence: {}".format(remittance_address_recipient.value, remittance_address_recipient.confidence))

begin_recognize_invoices_from_url

特定の請求書からフィールド テキストとセマンティック値を抽出します。 入力ドキュメントは、分析する請求書の場所 (URL) である必要があります。

請求書カードで見つかったフィールドについては、こちらを参照してください。https://aka.ms/formrecognizer/invoicefields

バージョン v2.1 の新機能: begin_recognize_invoices_from_url クライアント メソッド

begin_recognize_invoices_from_url(invoice_url: str, **kwargs: Any) -> LROPoller[List[RecognizedForm]]

パラメーター

invoice_url
str
必須

分析する請求書の URL。 入力は、JPEG、PNG、PDF、TIFF、BMP のいずれかの有効なエンコードされた URL である必要があります。

locale
str

請求書のロケール。 サポートされているロケールは次のとおりです: en-US

include_field_elements
bool

ページごとのすべての行と、各フォーム フィールドの行、単語、選択マークなどのフィールド要素を含めるかどうか。

pages
list[str]

複数ページのドキュメントのカスタム ページ番号 (PDF/TIFF)。 結果として取得するページ番号やページ範囲を入力します。 ページの範囲には、 pages=["1-3", "5-6"] などのハイフンを使用します。 各ページ番号または範囲をコンマで区切ります。

continuation_token
str

保存された状態からポーリングを再開するための継続トークン。

戻り値

LROPoller のインスタンス。 list[RecognizedForm]を返すには、poller オブジェクトで result() を呼び出します。

の戻り値の型 :

例外

begin_recognize_receipts

特定の売上領収書からフィールド テキストとセマンティック値を抽出します。 入力ドキュメントは、サポートされているコンテンツ タイプ ('application/pdf'、'image/jpeg'、'image/png'、'image/tiff' または 'image/bmp' のいずれか) である必要があります。

レシートで見つかったフィールドについては、こちらを参照してください。 https://aka.ms/formrecognizer/receiptfields

バージョン v2.1 の新機能: 引数と image/bmp コンテンツのサポートキーワード (keyword)ロケールページ

begin_recognize_receipts(receipt: bytes | IO[bytes], **kwargs: Any) -> LROPoller[List[RecognizedForm]]

パラメーター

receipt
bytes または IO[bytes]
必須

JPEG、PNG、PDF、TIFF、または BMP の種類のファイル ストリームまたはバイト。

include_field_elements
bool

ページごとのすべての行と、各フォーム フィールドの行、単語、選択マークなどのフィールド要素を含めるかどうか。

content_type
str または FormContentType

API に送信される本文のコンテンツ タイプ。 コンテンツ タイプは自動検出されますが、このキーワード (keyword)引数を渡すことでオーバーライドできます。 オプションについては、「」を参照してください FormContentType

continuation_token
str

保存された状態からポーリングを再開するための継続トークン。

locale
str

レシートのロケール。 サポートされているロケールには、en-US、en-AU、en-CA、en-GB、en-IN が含まれます。

pages
list[str]

複数ページのドキュメントのカスタム ページ番号 (PDF/TIFF)。 結果で取得するページ番号やページ範囲を入力します。 ページの範囲には、 pages=["1-3", "5-6"] などのハイフンを使用します。 各ページ番号または範囲をコンマで区切ります。

戻り値

LROPoller のインスタンス。 poller オブジェクトの result() を呼び出して list[RecognizedForm]を返します。

の戻り値の型 :

例外

売上受領書フィールドを認識します。


   from azure.core.credentials import AzureKeyCredential
   from azure.ai.formrecognizer import FormRecognizerClient

   endpoint = os.environ["AZURE_FORM_RECOGNIZER_ENDPOINT"]
   key = os.environ["AZURE_FORM_RECOGNIZER_KEY"]

   form_recognizer_client = FormRecognizerClient(
       endpoint=endpoint, credential=AzureKeyCredential(key)
   )
   with open(path_to_sample_forms, "rb") as f:
       poller = form_recognizer_client.begin_recognize_receipts(receipt=f, locale="en-US")
   receipts = poller.result()

   for idx, receipt in enumerate(receipts):
       print("--------Recognizing receipt #{}--------".format(idx+1))
       receipt_type = receipt.fields.get("ReceiptType")
       if receipt_type:
           print("Receipt Type: {} has confidence: {}".format(receipt_type.value, receipt_type.confidence))
       merchant_name = receipt.fields.get("MerchantName")
       if merchant_name:
           print("Merchant Name: {} has confidence: {}".format(merchant_name.value, merchant_name.confidence))
       transaction_date = receipt.fields.get("TransactionDate")
       if transaction_date:
           print("Transaction Date: {} has confidence: {}".format(transaction_date.value, transaction_date.confidence))
       if receipt.fields.get("Items"):
           print("Receipt items:")
           for idx, item in enumerate(receipt.fields.get("Items").value):
               print("...Item #{}".format(idx+1))
               item_name = item.value.get("Name")
               if item_name:
                   print("......Item Name: {} has confidence: {}".format(item_name.value, item_name.confidence))
               item_quantity = item.value.get("Quantity")
               if item_quantity:
                   print("......Item Quantity: {} has confidence: {}".format(item_quantity.value, item_quantity.confidence))
               item_price = item.value.get("Price")
               if item_price:
                   print("......Individual Item Price: {} has confidence: {}".format(item_price.value, item_price.confidence))
               item_total_price = item.value.get("TotalPrice")
               if item_total_price:
                   print("......Total Item Price: {} has confidence: {}".format(item_total_price.value, item_total_price.confidence))
       subtotal = receipt.fields.get("Subtotal")
       if subtotal:
           print("Subtotal: {} has confidence: {}".format(subtotal.value, subtotal.confidence))
       tax = receipt.fields.get("Tax")
       if tax:
           print("Tax: {} has confidence: {}".format(tax.value, tax.confidence))
       tip = receipt.fields.get("Tip")
       if tip:
           print("Tip: {} has confidence: {}".format(tip.value, tip.confidence))
       total = receipt.fields.get("Total")
       if total:
           print("Total: {} has confidence: {}".format(total.value, total.confidence))
       print("--------------------------------------")

begin_recognize_receipts_from_url

特定の売上領収書からフィールド テキストとセマンティック値を抽出します。 入力ドキュメントは、分析する領収書の場所 (URL) である必要があります。

レシートで見つかったフィールドについては、こちらを参照してください。 https://aka.ms/formrecognizer/receiptfields

バージョン v2.1 の新機能: 引数と image/bmp コンテンツのサポートキーワード (keyword)ロケールページ

begin_recognize_receipts_from_url(receipt_url: str, **kwargs: Any) -> LROPoller[List[RecognizedForm]]

パラメーター

receipt_url
str
必須

分析する領収書の URL。 入力は、JPEG、PNG、PDF、TIFF、BMP のいずれかの有効なエンコードされた URL である必要があります。

include_field_elements
bool

各フォーム フィールドの行、単語、選択マークなど、ページごとのすべての行とフィールド要素を含めるかどうかを指定します。

continuation_token
str

保存された状態からポーリングを再開するための継続トークン。

locale
str

レシートのロケール。 サポートされているロケールには、en-US、en-AU、en-CA、en-GB、en-IN が含まれます。

pages
list[str]

複数ページのドキュメントのカスタム ページ番号 (PDF/TIFF)。 結果で取得するページ番号やページ範囲を入力します。 ページの範囲には、 pages=["1-3", "5-6"] などのハイフンを使用します。 各ページ番号または範囲をコンマで区切ります。

戻り値

LROPoller のインスタンス。 poller オブジェクトの result() を呼び出して list[RecognizedForm]を返します。

の戻り値の型 :

例外

URL から販売確認フィールドを認識します。


   from azure.core.credentials import AzureKeyCredential
   from azure.ai.formrecognizer import FormRecognizerClient

   endpoint = os.environ["AZURE_FORM_RECOGNIZER_ENDPOINT"]
   key = os.environ["AZURE_FORM_RECOGNIZER_KEY"]

   form_recognizer_client = FormRecognizerClient(
       endpoint=endpoint, credential=AzureKeyCredential(key)
   )
   url = "https://raw.githubusercontent.com/Azure/azure-sdk-for-python/main/sdk/formrecognizer/azure-ai-formrecognizer/tests/sample_forms/receipt/contoso-receipt.png"
   poller = form_recognizer_client.begin_recognize_receipts_from_url(receipt_url=url)
   receipts = poller.result()

   for idx, receipt in enumerate(receipts):
       print("--------Recognizing receipt #{}--------".format(idx+1))
       receipt_type = receipt.fields.get("ReceiptType")
       if receipt_type:
           print("Receipt Type: {} has confidence: {}".format(receipt_type.value, receipt_type.confidence))
       merchant_name = receipt.fields.get("MerchantName")
       if merchant_name:
           print("Merchant Name: {} has confidence: {}".format(merchant_name.value, merchant_name.confidence))
       transaction_date = receipt.fields.get("TransactionDate")
       if transaction_date:
           print("Transaction Date: {} has confidence: {}".format(transaction_date.value, transaction_date.confidence))
       if receipt.fields.get("Items"):
           print("Receipt items:")
           for idx, item in enumerate(receipt.fields.get("Items").value):
               print("...Item #{}".format(idx+1))
               item_name = item.value.get("Name")
               if item_name:
                   print("......Item Name: {} has confidence: {}".format(item_name.value, item_name.confidence))
               item_quantity = item.value.get("Quantity")
               if item_quantity:
                   print("......Item Quantity: {} has confidence: {}".format(item_quantity.value, item_quantity.confidence))
               item_price = item.value.get("Price")
               if item_price:
                   print("......Individual Item Price: {} has confidence: {}".format(item_price.value, item_price.confidence))
               item_total_price = item.value.get("TotalPrice")
               if item_total_price:
                   print("......Total Item Price: {} has confidence: {}".format(item_total_price.value, item_total_price.confidence))
       subtotal = receipt.fields.get("Subtotal")
       if subtotal:
           print("Subtotal: {} has confidence: {}".format(subtotal.value, subtotal.confidence))
       tax = receipt.fields.get("Tax")
       if tax:
           print("Tax: {} has confidence: {}".format(tax.value, tax.confidence))
       tip = receipt.fields.get("Tip")
       if tip:
           print("Tip: {} has confidence: {}".format(tip.value, tip.confidence))
       total = receipt.fields.get("Total")
       if total:
           print("Total: {} has confidence: {}".format(total.value, total.confidence))
       print("--------------------------------------")

close

セッションを FormRecognizerClient 閉じます。

close() -> None

例外

send_request

クライアントの既存のパイプラインを使用してネットワーク要求を実行します。

要求 URL は、ベース URL を基準にして指定できます。 要求に使用されるサービス API のバージョンは、特に指定がない限り、クライアントと同じです。 クライアントの構成済み API バージョンを相対 URL でオーバーライドすることは、API バージョン 2022-08-31 以降のクライアントでサポートされています。 任意の API バージョンでクライアントでサポートされている絶対 URL でのオーバーライド。 応答がエラーの場合、このメソッドは発生しません。例外を発生させる場合は、返された応答オブジェクト に対して raise_for_status() を呼び出します。 このメソッドを使用してカスタム要求を送信する方法の詳細については、「」を参照してください https://aka.ms/azsdk/dpcodegen/python/send_request

send_request(request: HttpRequest, *, stream: bool = False, **kwargs) -> HttpResponse

パラメーター

request
HttpRequest
必須

作成するネットワーク要求。

stream
bool

応答ペイロードがストリーミングされるかどうか。 既定値は False です。

戻り値

ネットワーク呼び出しの応答。 応答でエラー処理を行いません。

の戻り値の型 :

例外