Document Models - Analyze Document
使用文档模型分析文档。
POST {endpoint}/documentintelligence/documentModels/{modelId}:analyze?_overload=analyzeDocument&api-version=2024-11-30
POST {endpoint}/documentintelligence/documentModels/{modelId}:analyze?_overload=analyzeDocument&api-version=2024-11-30&pages={pages}&locale={locale}&stringIndexType={stringIndexType}&features={features}&queryFields={queryFields}&outputContentFormat={outputContentFormat}&output={output}
URI 参数
| 名称 | 在 | 必需 | 类型 | 说明 |
|---|---|---|---|---|
|
endpoint
|
path | True |
string (uri) |
文档智能服务终结点。 |
|
model
|
path | True |
string maxLength: 64pattern: ^[a-zA-Z0-9][a-zA-Z0-9._~-]{1,63}$ |
唯一的文档模型名称。 |
|
api-version
|
query | True |
string minLength: 1 |
用于此操作的 API 版本。 |
|
features
|
query |
可选分析功能列表。 |
||
|
locale
|
query |
string |
文本识别和文档分析的区域设置提示。 值只能包含语言代码(例如“en”、“fr”)或 BCP 47 语言标记(例如“en-US”)。 |
|
|
output
|
query |
在分析期间要生成的其他输出。 |
||
|
output
|
query |
分析结果顶级内容的格式。 |
||
|
pages
|
query |
string pattern: ^(\d+(-\d+)?)(,\s*(\d+(-\d+)?))*$ |
要分析的基于 1 的页码。 前任。 "1-3,5,7-9" |
|
|
query
|
query |
string[] |
要提取的其他字段的列表。 前任。 “NumberOfGuests,StoreNumber” |
|
|
string
|
query |
用于计算字符串偏移量和长度的方法。 |
请求正文
| 名称 | 类型 | 说明 |
|---|---|---|
| base64Source |
string (byte) |
要分析的文档的 Base64 编码。 必须指定 urlSource 或 base64Source。 |
| urlSource |
string (uri) |
要分析的文档 URL。 必须指定 urlSource 或 base64Source。 |
响应
| 名称 | 类型 | 说明 |
|---|---|---|
| 202 Accepted |
已接受请求进行处理,但尚未完成处理。 标头
|
|
| Other Status Codes |
意外的错误响应。 |
安全性
Ocp-Apim-Subscription-Key
类型:
apiKey
在:
header
OAuth2Auth
类型:
oauth2
流向:
accessCode
授权 URL:
https://login.microsoftonline.com/common/oauth2/authorize
令牌 URL:
https://login.microsoftonline.com/common/oauth2/token
作用域
| 名称 | 说明 |
|---|---|
| https://cognitiveservices.azure.com/.default |
示例
| Analyze Document from Base64 |
| Analyze Document from Url |
Analyze Document from Base64
示例请求
POST https://myendpoint.cognitiveservices.azure.com/documentintelligence/documentModels/prebuilt-layout:analyze?_overload=analyzeDocument&api-version=2024-11-30&pages=1-2,4&locale=en-US&stringIndexType=textElements
{
"base64Source": "e2Jhc2U2NEVuY29kZWRQZGZ9"
}
示例响应
Operation-Location: https://myendpoint.cognitiveservices.azure.com/documentintelligence/documentModels/prebuilt-layout/analyzeResults/3b31320d-8bab-4f88-b19c-2322a7f11034?api-version=2024-11-30
Analyze Document from Url
示例请求
POST https://myendpoint.cognitiveservices.azure.com/documentintelligence/documentModels/customModel:analyze?_overload=analyzeDocument&api-version=2024-11-30&pages=1-2,4&locale=en-US&stringIndexType=textElements
{
"urlSource": "http://host.com/doc.pdf"
}
示例响应
Operation-Location: https://myendpoint.cognitiveservices.azure.com/documentintelligence/documentModels/customModel/analyzeResults/3b31320d-8bab-4f88-b19c-2322a7f11034?api-version=2024-11-30
定义
| 名称 | 说明 |
|---|---|
|
Analyze |
文档分析参数。 |
|
Analyze |
在分析期间要生成的其他输出。 |
|
Document |
要启用的文档分析功能。 |
|
Document |
分析结果中内容的格式。 |
|
Document |
错误对象。 |
|
Document |
错误响应对象。 |
|
Document |
包含有关错误的更具体信息的对象。 |
|
String |
用于计算字符串偏移量和长度的方法。 |
AnalyzeDocumentRequest
文档分析参数。
| 名称 | 类型 | 说明 |
|---|---|---|
| base64Source |
string (byte) |
要分析的文档的 Base64 编码。 必须指定 urlSource 或 base64Source。 |
| urlSource |
string (uri) |
要分析的文档 URL。 必须指定 urlSource 或 base64Source。 |
AnalyzeOutputOption
在分析期间要生成的其他输出。
| 值 | 说明 |
|---|---|
|
生成可搜索的 PDF 输出。 |
|
| figures |
生成检测到的图形的裁剪图像。 |
DocumentAnalysisFeature
要启用的文档分析功能。
| 值 | 说明 |
|---|---|
| ocrHighResolution |
以更高的分辨率执行 OCR 以处理带有精细打印的文档。 |
| languages |
启用文本内容语言检测。 |
| barcodes |
启用文档中条形码检测。 |
| formulas |
启用文档中数学表达式的检测。 |
| keyValuePairs |
启用文档中常规键值对(窗体字段)的检测。 |
| styleFont |
启用各种字体样式的识别。 |
| queryFields |
通过 queryFields 查询参数启用其他字段的提取。 |
DocumentContentFormat
分析结果中内容的格式。
| 值 | 说明 |
|---|---|
| text |
不带任何格式的文档内容的纯文本表示形式。 |
| markdown |
带有节标题、表格等的文档内容的 Markdown 表示形式。 |
DocumentIntelligenceError
错误对象。
| 名称 | 类型 | 说明 |
|---|---|---|
| code |
string |
服务器定义的错误代码集之一。 |
| details |
导致此报告错误的特定错误的详细信息数组。 |
|
| innererror |
包含与当前对象有关错误的更具体信息的对象。 |
|
| message |
string |
错误的人工可读表示形式。 |
| target |
string |
错误的目标。 |
DocumentIntelligenceErrorResponse
错误响应对象。
| 名称 | 类型 | 说明 |
|---|---|---|
| error |
错误信息。 |
DocumentIntelligenceInnerError
包含有关错误的更具体信息的对象。
| 名称 | 类型 | 说明 |
|---|---|---|
| code |
string |
服务器定义的错误代码集之一。 |
| innererror |
内部错误。 |
|
| message |
string |
错误的人工可读表示形式。 |
StringIndexType
用于计算字符串偏移量和长度的方法。
| 值 | 说明 |
|---|---|
| textElements |
由 Unicode 8.0.0 定义的用户感知显示字符或 grapheme 群集。 |
| unicodeCodePoint |
由单个 unicode 代码点表示的字符单元。 由 Python 3 使用。 |
| utf16CodeUnit |
由 16 位 Unicode 代码单元表示的字符单元。 由 JavaScript、Java 和 .NET 使用。 |