Document Models - Analyze Document
使用檔模型分析檔。
POST {endpoint}/documentintelligence/documentModels/{modelId}:analyze?_overload=analyzeDocument&api-version=2024-02-29-preview
POST {endpoint}/documentintelligence/documentModels/{modelId}:analyze?_overload=analyzeDocument&api-version=2024-02-29-preview&pages={pages}&locale={locale}&stringIndexType={stringIndexType}&features={features}&queryFields={queryFields}&outputContentFormat={outputContentFormat}
URI 參數
名稱 | 位於 | 必要 | 類型 | Description |
---|---|---|---|---|
endpoint
|
path | True |
string |
Document Intelligence 服務端點。 |
model
|
path | True |
string |
唯一的檔模型名稱。 Regex pattern: |
api-version
|
query | True |
string |
用於此作業的 API 版本。 |
features
|
query |
Document |
選擇性分析功能的清單。 |
|
locale
|
query |
string |
文字辨識和檔分析的地區設定提示。 值只能包含語言代碼 (例如「en」、「fr」) 或 BCP 47 語言標記 (例如「en-US」)。 |
|
output
|
query |
Content |
分析結果最上層內容的格式。 |
|
pages
|
query |
string |
要分析的 1 頁碼清單。 例如 "1-3,5,7-9" Regex pattern: |
|
query
|
query |
string[] |
要擷取的其他欄位清單。 例如 “NumberOfGuests,StoreNumber” |
|
string
|
query |
String |
用來計算字串位移和長度的方法。 |
要求本文
名稱 | 類型 | Description |
---|---|---|
base64Source |
string |
要分析的檔Base64編碼。 必須指定urlSource或base64Source。 |
urlSource |
string |
要分析的檔URL。 必須指定urlSource或base64Source。 |
回應
名稱 | 類型 | Description |
---|---|---|
202 Accepted |
要求已接受進行處理,但尚未完成處理。 Headers
|
|
Other Status Codes |
Error |
未預期的錯誤回應。 |
安全性
Ocp-Apim-Subscription-Key
Type:
apiKey
In:
header
OAuth2Auth
Type:
oauth2
Flow:
accessCode
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Token URL:
https://login.microsoftonline.com/common/oauth2/token
Scopes
名稱 | Description |
---|---|
https://cognitiveservices.azure.com/.default |
範例
Analyze Document from Base64 |
Analyze Document from Url |
Analyze Document from Base64
Sample Request
POST https://myendpoint.cognitiveservices.azure.com/documentintelligence/documentModels/prebuilt-layout:analyze?_overload=analyzeDocument&api-version=2024-02-29-preview&pages=1-2,4&locale=en-US&stringIndexType=textElements
{
"base64Source": "e2Jhc2U2NEVuY29kZWRQZGZ9"
}
Sample Response
Operation-Location: https://myendpoint.cognitiveservices.azure.com/documentintelligence/documentModels/prebuilt-layout/analyzeResults/3b31320d-8bab-4f88-b19c-2322a7f11034?api-version=2024-02-29-preview
Analyze Document from Url
Sample Request
POST https://myendpoint.cognitiveservices.azure.com/documentintelligence/documentModels/customModel:analyze?_overload=analyzeDocument&api-version=2024-02-29-preview&pages=1-2,4&locale=en-US&stringIndexType=textElements
{
"urlSource": "http://host.com/doc.pdf"
}
Sample Response
Operation-Location: https://myendpoint.cognitiveservices.azure.com/documentintelligence/documentModels/customModel/analyzeResults/3b31320d-8bab-4f88-b19c-2322a7f11034?api-version=2024-02-29-preview
定義
名稱 | Description |
---|---|
Analyze |
檔分析參數。 |
Content |
分析結果中的內容格式。 |
Document |
選擇性分析功能的清單。 |
Error |
錯誤物件。 |
Error |
錯誤回應物件。 |
Inner |
物件,包含有關錯誤的更特定資訊。 |
String |
用來計算字串位移和長度的方法。 |
AnalyzeDocumentRequest
檔分析參數。
名稱 | 類型 | Description |
---|---|---|
base64Source |
string |
要分析的檔Base64編碼。 必須指定urlSource或base64Source。 |
urlSource |
string |
要分析的檔URL。 必須指定urlSource或base64Source。 |
ContentFormat
分析結果中的內容格式。
名稱 | 類型 | Description |
---|---|---|
markdown |
string |
具有區段標題、表格等的文件內容的 Markdown 表示法。 |
text |
string |
文件內容的純文本表示,不含任何格式設定。 |
DocumentAnalysisFeature
選擇性分析功能的清單。
名稱 | 類型 | Description |
---|---|---|
barcodes |
string |
啟用文件中條碼的偵測。 |
formulas |
string |
啟用檔中數學表達式的偵測。 |
keyValuePairs |
string |
啟用一般索引鍵值組的偵測, (檔中的表單域) 。 |
languages |
string |
啟用文字內容語言的偵測。 |
ocrHighResolution |
string |
以較高的解析度執行 OCR,以處理具有精細列印的檔。 |
queryFields |
string |
透過 queryFields 查詢參數啟用其他欄位的擷取。 |
styleFont |
string |
啟用各種字型樣式的辨識。 |
Error
錯誤物件。
名稱 | 類型 | Description |
---|---|---|
code |
string |
其中一組伺服器定義的錯誤碼。 |
details |
Error[] |
導致此錯誤之特定錯誤的詳細數據陣列。 |
innererror |
Inner |
物件,包含比目前對象有關錯誤的更特定資訊。 |
message |
string |
人類看得懂的錯誤表示法。 |
target |
string |
錯誤的目標。 |
ErrorResponse
錯誤回應物件。
名稱 | 類型 | Description |
---|---|---|
error |
錯誤資訊。 |
InnerError
物件,包含有關錯誤的更特定資訊。
名稱 | 類型 | Description |
---|---|---|
code |
string |
其中一組伺服器定義的錯誤碼。 |
innererror |
Inner |
內部錯誤。 |
message |
string |
人類看得懂的錯誤表示法。 |
StringIndexType
用來計算字串位移和長度的方法。
名稱 | 類型 | Description |
---|---|---|
textElements |
string |
使用者感知的顯示字元或 grapheme 叢集,如 Unicode 8.0.0 所定義。 |
unicodeCodePoint |
string |
以單一 Unicode 字碼指標表示的字元單位。 由 Python 3 使用。 |
utf16CodeUnit |
string |
以16位Unicode字碼單位表示的字元單位。 由 JavaScript、Java 和 .NET 使用。 |