Document Models - Analyze Document
使用檔模型分析檔。
POST {endpoint}/formrecognizer/documentModels/{modelId}:analyze?api-version=2023-07-31
POST {endpoint}/formrecognizer/documentModels/{modelId}:analyze?pages={pages}&locale={locale}&stringIndexType={stringIndexType}&api-version=2023-07-31&features={features}
URI 參數
名稱 | 位於 | 必要 | 類型 | Description |
---|---|---|---|---|
endpoint
|
path | True |
string url |
支援的認知服務端點 (通訊協定和主機名,例如: https://westus2.api.cognitive.microsoft.com) 。 |
model
|
path | True |
string |
唯一的檔模型名稱。 Regex pattern: |
api-version
|
query | True |
string |
要求的 API 版本。 |
features
|
query |
選擇性分析功能的清單。 |
||
locale
|
query |
string |
文字辨識和檔分析的地區設定提示。 值只能包含語言代碼 (例如「en」、「fr」) 或 BCP 47 語言標記 (例如「en-US」)。 |
|
pages
|
query |
string |
要分析的 1 頁碼清單。 例如 "1-3,5,7-9" Regex pattern: |
|
string
|
query |
用來計算字串位移和長度的方法。 |
要求標頭
Media Types: "application/json", "application/octet-stream", "application/pdf", "image/jpeg", "image/png", "image/tiff", "image/bmp", "image/heif", "text/html", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "application/vnd.openxmlformats-officedocument.presentationml.presentation"
名稱 | 必要 | 類型 | Description |
---|---|---|---|
Ocp-Apim-Subscription-Key | True |
string |
Azure 認知服務訂用帳戶的秘密密鑰。 |
要求本文
Media Types: "application/json", "application/octet-stream", "application/pdf", "image/jpeg", "image/png", "image/tiff", "image/bmp", "image/heif", "text/html", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "application/vnd.openxmlformats-officedocument.presentationml.presentation"
名稱 | 類型 | Description |
---|---|---|
base64Source |
string |
要分析的檔Base64編碼。 必須指定urlSource或base64Source。 |
urlSource |
string |
要分析的檔URL。 必須指定urlSource或base64Source。 |
回應
名稱 | 類型 | Description |
---|---|---|
202 Accepted |
要求已順利排入佇列。 Headers Operation-Location: string |
|
Other Status Codes |
發生錯誤。 |
安全性
Ocp-Apim-Subscription-Key
Azure 認知服務訂用帳戶的秘密密鑰。
Type:
apiKey
In:
header
範例
Analyze Document from Base64 |
Analyze Document from Url |
Analyze Document from Base64
Sample Request
POST https://myendpoint.cognitiveservices.azure.com/formrecognizer/documentModels/prebuilt-layout:analyze?pages=1-2,4&locale=en-US&stringIndexType=textElements&api-version=2023-07-31
{
"base64Source": "e2Jhc2U2NEVuY29kZWRQZGZ9"
}
Sample Response
Operation-Location: https://myendpoint.cognitiveservices.azure.com/formrecognizer/documentModels/prebuilt-layout/analyzeResults/3b31320d-8bab-4f88-b19c-2322a7f11034?api-version=2023-07-31
Analyze Document from Url
Sample Request
POST https://myendpoint.cognitiveservices.azure.com/formrecognizer/documentModels/customModel:analyze?pages=1-2,4&locale=en-US&stringIndexType=textElements&api-version=2023-07-31
{
"urlSource": "http://host.com/doc.pdf"
}
Sample Response
Operation-Location: https://myendpoint.cognitiveservices.azure.com/formrecognizer/documentModels/customModel/analyzeResults/3b31320d-8bab-4f88-b19c-2322a7f11034?api-version=2023-07-31
定義
名稱 | Description |
---|---|
Analyze |
檔分析參數。 |
Document |
選擇性分析功能的清單。 |
Error |
錯誤資訊。 |
Error |
錯誤回應物件。 |
Inner |
詳細的錯誤。 |
String |
用來計算字串位移和長度的方法。 |
AnalyzeDocumentRequest
檔分析參數。
名稱 | 類型 | Description |
---|---|---|
base64Source |
string |
要分析的檔Base64編碼。 必須指定urlSource或base64Source。 |
urlSource |
string |
要分析的檔URL。 必須指定urlSource或base64Source。 |
DocumentAnalysisFeature
選擇性分析功能的清單。
名稱 | 類型 | Description |
---|---|---|
barcodes |
string |
啟用文件中條碼的偵測。 |
formulas |
string |
啟用檔中數學表達式的偵測。 |
keyValuePairs |
string |
啟用一般索引鍵值組的偵測, (檔中的表單域) 。 |
languages |
string |
啟用文字內容語言的偵測。 |
ocrHighResolution |
string |
以較高的解析度執行 OCR,以處理具有精細列印的檔。 |
styleFont |
string |
啟用各種字型樣式的辨識。 |
Error
錯誤資訊。
名稱 | 類型 | Description |
---|---|---|
code |
string |
錯誤碼。 |
details |
Error[] |
詳細錯誤清單。 |
innererror |
詳細的錯誤。 |
|
message |
string |
錯誤訊息。 |
target |
string |
錯誤的目標。 |
ErrorResponse
錯誤回應物件。
名稱 | 類型 | Description |
---|---|---|
error |
錯誤資訊。 |
InnerError
詳細的錯誤。
名稱 | 類型 | Description |
---|---|---|
code |
string |
錯誤碼。 |
innererror |
詳細的錯誤。 |
|
message |
string |
錯誤訊息。 |
StringIndexType
用來計算字串位移和長度的方法。
名稱 | 類型 | Description |
---|---|---|
textElements |
string |
使用者感知的顯示字元或 grapheme 叢集,如 Unicode 8.0.0 所定義。 |
unicodeCodePoint |
string |
以單一 Unicode 字碼指標表示的字元單位。 由 Python 3 使用。 |
utf16CodeUnit |
string |
以16位Unicode字碼單位表示的字元單位。 由 JavaScript、Java 和 .NET 使用。 |