- 概述
- 文档处理合同
- 发行说明
- 关于文档处理合同
- Box 类
- IPersistedActivity 接口
- PrettyBoxConverter 类
- IClassifierActivity 接口
- IClassifierCapabilitiesProvider 接口
- 分类器文档类型类
- 分类器结果类
- 分类器代码活动类
- 分类器原生活动类
- 分类器异步代码活动类
- 分类器文档类型功能类
- ContentValidationData Class
- EvaluatedBusinessRulesForFieldValue Class
- EvaluatedBusinessRuleDetails Class
- 提取程序异步代码活动类
- 提取程序代码活动类
- 提取程序文档类型类
- 提取程序文档类型功能类
- 提取程序字段功能类
- 提取程序原生活动类
- 提取程序结果类
- FieldValue Class
- FieldValueResult Class
- ICapabilitiesProvider 接口
- IExtractorActivity 接口
- 提取程序有效负载类
- 文档操作优先级枚举
- 文档操作数据类
- 文档操作状态枚举
- 文档操作类型枚举
- 文档分类操作数据类
- 文档验证操作数据类
- 用户数据类
- 文档类
- 文档拆分结果类
- DomExtensions 类
- 页类
- 页面分区类
- 多边形类
- 多边形转换器类
- 元数据类
- 词组类
- 词类
- 处理源枚举
- 结果表格单元类
- 结果表值类
- 结果表列信息类
- 结果表类
- 旋转枚举
- Rule Class
- RuleResult Class
- RuleSet Class
- RuleSetResult Class
- 分区类型枚举
- 词组类型枚举
- IDocumentTextProjection 接口
- 分类结果类
- 提取结果类
- 结果文档类
- 结果文档范围类
- 结果数据点类
- 结果值类
- 结果内容引用类
- 结果值令牌类
- 结果派生字段类
- 结果数据源枚举
- 结果常量类
- 简单字段值类
- 表字段值类
- 文档组类
- 文档分类类
- 文档类型类
- 字段类
- 字段类型枚举
- FieldValueDetails Class
- 语言信息类
- 元数据输入类
- 文本类型枚举
- 类型字段类
- ITrackingActivity 接口
- ITrainableActivity 接口
- ITrainableClassifierActivity 接口
- ITrainableExtractorActivity 接口
- 可训练的分类器异步代码活动类
- 可训练的分类器代码活动类
- 可训练的分类器原生活动类
- 可训练的提取程序异步代码活动类
- 可训练的提取程序代码活动类
- 可训练的提取程序原生活动类
- 基本数据点类 - 预览
- 提取结果处理程序类 - 预览
- Document Understanding ML
- Document Understanding OCR 本地服务器
- Document Understanding
- 智能 OCR
- 发行说明
- 关于“智能 OCR”活动包
- 项目兼容性
- 加载分类
- 将文档数字化
- 分类文档作用域
- 基于关键词的分类器
- Document Understanding 项目分类器
- 智能关键词分类器
- 创建文档分类操作
- 创建文档验证工件
- 检索文档验证工件
- 等待文档分类操作然后继续
- 训练分类器范围
- 基于关键词的分类训练器
- 智能关键词分类训练器
- 数据提取作用域
- Document Understanding 项目提取程序
- Document Understanding 项目提取程序训练器
- 基于正则表达式的提取程序
- 表单提取程序
- 智能表单提取程序
- 文档脱敏
- 创建文档验证操作
- 等待文档验证操作然后继续
- 训练提取程序范围
- 导出提取结果
- 机器学习提取程序
- 机器学习提取程序训练器
- 机器学习分类器
- 机器学习分类训练器
- 生成分类器
- 生成式提取程序
- 配置身份验证
- 使用应用程序操作验证文档
- 手动验证数字化文档
- 使用智能表单提取程序提取基于锚点的数据
- 验证站点
- 生成式活动 - 良好实践
- 生成式提取程序 - 良好做法
- 生成式分类器 - 良好做法
- ML 服务
- OCR
- OCR 合同
- OmniPage
- PDF
- [未公开] Abbyy
- [未列出] Abbyy 嵌入式

Document Understanding 活动
使用智能表单提取程序提取基于锚点的数据
以下示例说明了如何从可能还包含手写文本的表单中提取数据。 以下用例场景说明了如何从采购订单中提取数据。
It presents activities such as Digitize Document, Data Extraction Scope, or Intelligent Form Extractor. You can find these activities in the UiPath.IntelligentOCR.Activities package.
创建工作流
在创建以下工作流之前,需要安装以下包:
- UiPath.DocumentProcessing.Contracts.Activities
- UiPath.Intelligent OCR.Activities
- UiPath.OCR.Activities
- UiPath.OCR.Contracts
- UiPath.WebAPI.Activities
Steps:
-
打开 Studio ,创建一个新“流程”。
-
Add a Sequence container in the Workflow Designer, name it Sequence1, and create the variables shown in the following table:
Table 1. Variables to be created
变量类型 默认值 item字符串 不适用 classificationResultClassificationResult[] 不适用 outputFileName泛型值 不适用 -
Add another Sequence container in the Workflow Designer, after the first one, name it Sequence2, and create the variables shown in the following table:
Table 2. Variables to be created
变量类型 默认值 text字符串 不适用 taxonomyDocumentTaxonomy 不适用 dom文档 不适用 documentPath字符串 不适用 classificationResult2ClassificationResult[] 不适用 outputFileName2泛型值 不适用 -
Add a Message Box activity inside the sequence.
- In the Properties panel, select the Ok option from the Buttons dropdown. Add the following message in the Text field: "Select a PDF file".
-
选中“排名最前”选项的复选框。这会将消息框置于前台。
-
Add a Select File activity after the Message Box activity.
- In the Properties panel, add the following text in the Filter field:
Pdf files (*.pdf)|*.pdf - Add the
documentPathvariable in the SelectedFile field.
- In the Properties panel, add the following text in the Filter field:
-
Add an Assign activity after the Select File activity.
- Add the
outputFileName2variable in the To field. - 在“值”字段添加表达式
".temp/" + Path.GetFileName(documentPath)。
- Add the
-
Add a Deserialize JSON activity after the Assign activity.
- Add the expression
File.ReadAllText("DocumentProcessing axonomy.json")in the JSON String field. - In the Properties panel, select the UiPath.DocumentProcessing.Contracts.Taxonomy.DocumentTaxonomy option from the TypeArgument dropdown list.
- Add the
taxonomyvariable in the JsonObject field.
- Add the expression
-
Add a Digitize Document activity after the Deserialize JSON activity.
- In the Properties panel, add the value
1in the DegreeOfParallelism field. - Add the
documentPathvariable in the DocumentPath field. - Add the
domvariable in the DocumentObjectModel field. - Add the
textvariable in the DocumentText field. - Add the UiPath® Document OCR engine inside the activity.
- Add your API Key inside the ApiKey field.
- Add the
"https://du.uipath.com/ocr"expression in the Endpoint field.
- In the Properties panel, add the value
-
Add a Write Text File activity after the Digitize Document activity.
- Add the
JsonConvert.SerializeObject(dom)expression in the Text field. - Add the
outputFileName2 + ".dom.json"expression in the FileName field.
- Add the
-
Add another Write Text File activity after the Write Text File activity.
- Add the
textvariable in the Text field. - Add the
outputFileName2 + ".text.txt"expression in the FileName field.
- Add the
-
Drag another Sequence container in the Workflow Designer, name it Sequence3, and create the variables shown in the following table:
Table 3. Variables to be created
变量类型 默认值 extractionResult提取结果 不适用 validatedResults提取结果 不适用 doubleValidatedResults提取结果 不适用 dataset数据集 不适用 iInt32 不适用 -
Add a Data Extraction Scope activity inside the Sequence3.
- In the Properties panel, add the
domvariable in the DocumentObjectModel field. - Add the
documentPathvariable in the DocumentPath field. - Add the
textvariable in the DocumentText field. - Add the
"All.Benchmarks.Invoice"expression in the DocumentTypeId field. - Add the
taxonomyvariable in the Taxonomy field. - Add the
extractionResultvariable in the ExtractionResults field.
- In the Properties panel, add the
-
Add an Intelligent Form Extractor activity inside the Data Extraction Scope activity.
- Add your API Key in the ApiKey field.
-
Add a Write Text File activity after the Data Extraction Scope activity.
- Add the
JsonConvert.SerializeObject(extractionResult)expression in the Text field. - Add the
outputFileName2 + ".results.json"expression in the FileName field.
- Add the
-
Add a Present Validation Station activity after the Write Text File activity.
- Add the
extractionResultvariable in the AutomaticExtractionResults field. - Add the
domvariable in the DocumentObjectModel field. - Add the
documentPathvariable in the DocumentPath field. - Add the
textvariable in the DocumentText field. - Add the
taxonomyvariable in the Taxonomy field. - Add the
validatedResultsvariable in the ValidatedExtractionResults field.
- Add the
-
Add a Write Text File activity after the Present Validation Station activity.
- Add the
JsonConvert.SerializeObject(validatedResults)expression in the Text field. - Add the
outputFileName2 + ".savedinVS.results.json"expression in the FileName field.
- Add the
-
Add another Write Text File activity after the Write Text File activity.
- Add the
JsonConvert.SerializeObject(doubleValidatedResults)expression in the Text field. - Add the
outputFileName2 + ".doubleSavedinVS.results.json"expression in the FileName field.
- Add the
-
运行流程。 自动化流程应打开验证站点,提取数据并进行验证,并将其存储在“输出”文件夹中。
Visit the following link to download the example in a ZIP format: Example.
定义分类
You have created your workflow, defined all variables, and customized all activities. Now it's time to define your taxonomy. Visit Load Taxonomy to learn about defining your own taxonomy.
Create your taxonomy to be able to extract information from an invoice. You should be focused on creating an Invoice document type, with the fields shown in the following table:
Table 4. Invoice document type fields
| 字段类型 | |
|---|---|
| 发票编号 | Text |
| 小计 | Number |
| 销售税 | Number |
| 总计 | Number |
Figure 1. Overview of the finished taxonomy with the previously mentioned fields

创建模板
It is now time to create the template for the extraction process. Visit Load Taxonomy to learn how to create a template.
对于本示例,使用以下值配置模板:
- Document Type: Invoice.
- Template Name: Invoice-example.
- Template Document: Select the target file.
- OCR Engine: Microsoft OCR.
- Languages: en.
- Profile: Scan.
- Scale: 1.
Figure 2. Animated image example showing the configuration of the template

在模板中设置锚点
当您需要从文档中提取精确信息时,锚点是一项非常特殊且有用的功能。 通过使用锚点定义提取区域,您可以期望数据提取具有较高的准确性。
定义分类并创建模板后,您可以使用锚点开始配置模板,这意味着在框中定义提取区域,并且使用锚点定义框位置。
在开始将锚点添加到模板之前,请查看以下列表,以获取一些建议:
- 锚框应尽可能大(高度、宽度),以覆盖任何类型的发票编号(长、短、大字体等)。
- 一个提取区域可以根据需要具有任意数量的锚点,但只能将一个锚点定义为主锚点(第一个)。
- 使用由多个并排单词组成的锚点。
- 主锚点应尽可能靠近提取区域。
- 提取区域和主锚点的位置在模板中是固定的,即使应用于不同的文档也是如此。 唯一可以改变的是主锚点和次要锚点之间的距离。
让我们继续配置模板,看看如何使用锚点提取数据。
- 设置提取区域:
-
In the right area of the Validation Station, select Selection modes.
-
Select Anchor.
-
开始选择所需的区域。
备注:主锚点应包含两个或三个单词,以便在提取过程中获得更高的准确性和更好的结果。
标记锚点时,通过按 CTRL 键并选择所需字词来选择多个字词。
-
- 设置主锚点:
- While still in the Anchor selection mode, select the desired area as your main anchor.
- Select Extract value for the desired field.
- 设置次要锚点:
- Ensure you're still in the Anchor selection mode, and with the main anchor selections activated.
- 为次要锚点选择新区域。
- Select Options for the desired field, and then select Change extracted value.
重复此过程,直到完成所有提取区域的定义并添加所有锚点。 完成后,保存模板。