我正在使用相關的認知形式識別器庫在 Databricks 上執行以下 Python:
from azure.ai.formrecognizer import FormRecognizerClient
from azure.core.credentials import AzureKeyCredential
from azure.core.credentials import AzureKeyCredential
from azure.ai.formrecognizer import FormRecognizerClient
credential = AzureKeyCredential("aaa6123af5b843a38044538d95584c3d")
endpoint= "https://myformrecognizr.cognitiveservices.azure.com/"
form_recognizer_client = FormRecognizerClient(endpoint, credential)
with open("/dbfs/mnt/lake/RAW/export/Picturehouse.pdf", "rb") as fd:
form = fd.read()
poller = form_recognizer_client.begin_recognize_content(form)
form_pages = poller.result()
for content in form_pages:
for table in content.tables:
print("Table found on page {}:".format(table.page_number))
print("Table location {}:".format(table.bounding_box))
for cell in table.cells:
print("Cell text: {}".format(cell.text))
print("Location: {}".format(cell.bounding_box))
print("Confidence score: {}\n".format(cell.confidence))
if content.selection_marks:
print("Selection marks found on page {}:".format(content.page_number))
for selection_mark in content.selection_marks:
print("Selection mark is '{}' within bounding box '{}' and has a confidence of {}".format(
selection_mark.state,
selection_mark.bounding_box,
selection_mark.confidence
))
pdf 表單如下所示:

圖書館識別單元格文本:專案單元格文本:數量單元格文本:座位分配單元格文本:小計單元格文本:成人單元格文本:1 單元格文本:D-11 單元格文本:14.50
但它無法識別 pdf 中的以下文本:
您可以通過向引座員出示您的電子票直接進入螢屏。或者,您可以在電影或活動的廣告開始時間前至少 15 分鐘在票房取票。您需要您的預訂參考和/或支付卡來幫助我們找到您的預訂。您可以通過單擊上面的“列印此頁”鏈接列印此頁。
這是設計使然嗎?或者我在我的代碼中遺漏了什么?
uj5u.com熱心網友回復:
不幸的是,設計就是這樣。表單識別器正在處理預訓練模型,可以識別檔案中的鍵值對、文本和表格,以及作為輸入上傳的檔案中的表格內容。即使檔案包含大量的段落文本和中間或任何地方的表格內容,它也會被識別。
要了解更多詳細資訊,請參閱此鏈接:
https://www.drware.com/extract-data-from-pdfs-using-form-recognizer-with-code-or-without/
https://www.youtube.com/watch?v=iBQO4QdUp6A&t=10s
https://github.com/tomweinandy/form_recognizer_demo
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/479941.html
標籤:阿帕奇火花 pyspark 天蓝色数据块 天蓝色认知服务
上一篇:如何將application.conf檔案讀入資料塊?
下一篇:無法從視窗函式中獲取結果
