跳到主要内容

文件分类 Zapier

分类文件 是一个 Zapier 采取行动 PDF4me 匹配 PDF 针对正则表达式的内容或 JavaScript 您可以在 dev.pdf4me.com 上定义规则,并返回匹配的类名。使用此功能可将发票、合同和收据路由到正确的文件夹或工作流分支,无需机器学习或训练数据。

相关博客文章(1)

此操作的作用

PDF4me 分类文件 需要一 PDF 并返回 类名 与您预先在 Zap 中创建的规则相匹配。定义如下类: pdf4me_invoice 使用类似这样的正则表达式 发票(。*)PDF4me 仪表板,然后在仪表板中使用返回的类名 筛选、路径、上传文件、Google 表格或 Airtable 无需编写或训练分类器即可按类型对文档进行排序的步骤。

验证您的身份 API 要求

要访问 PDF4me 网站 API 通过 Zapier每个请求都必须包含正确的身份验证凭据。

您不容错过的重要事实

课程内容托管在 dev.pdf4me.com 上,而不是在…… Zapier
创建和编辑类(类名加上正则表达式或 JavaScript 图案)在 文档分类仪表板 首先。 Zapier 操作仅评估 PDF 针对您账户中已存在的任何类别。
基于规则而非机器学习
与需要带标签的训练数据和固定分类法的机器学习分类器不同,此操作将内容与正则表达式或 JavaScript 您编写的表达式。无需训练,无需调整置信度阈值,您可以精确控制用于标识每个类别的文本。
仅需文件
文件名是可选的,仅用于标识。此操作不会返回或更改文件内容。 PDF 本身,在任何下游步骤中,请继续使用触发器中的原始文件引用。
Zapier 文档分类操作配置面板,显示从触发器映射的文件和由文件名和文件扩展名构建的文件名。

设置操作面板:文件为必填项,文件名为可选,由触发器的文件名和扩展名生成。

参数

必需 Zapier UI 文件。文件名是可选的。

范围必需的它的作用例子
FileRequiredThe PDF file to classify. Map from your trigger (for example File from New File in Folder) or a previous step.1. File
File NameOptionalName of the PDF for identification in the response. Typically built from the trigger's File Name plus File Ext.document.pdf
创建类
文档分类仪表板点击“编辑”,添加类名(例如) pdf4me_invoice),选择正则表达式或 JavaScript并输入类似这样的模式: 发票(。*)测试前,请点击“保存更改”。 Zapier

输出

场地类型它包含什么
Trace IdStringUnique identifier for the request, useful for support and debugging.
Class NamesStringThe matched class (for example pdf4me_invoice or Invoice). Empty or unmatched if no saved class matched the content. Use in a Filter, Paths, or file-naming step.

如何在文档中设置分类? Zapier

  1. dev.pdf4me.com, 打开 分类文件 并添加一个类(类名加上正则表达式或 JavaScript (图案),然后点击 保存更改
  2. 在您的 Zap 中添加 PDF4me 作为操作应用程序并选择 分类文件
  3. 连接您的 PDF4me 创建一个帐户或选择现有连接。
  4. 地图 文件 从触发器或上一步开始。(可选)映射 文件名
  5. 测试该步骤并确认 类名 返回你期望的类。
  6. 使用 类名筛选 或者 路径 步骤 1 分支你的 Zap,或在 上传文件 按文档类型命名输出。

何时应该使用基于规则的分类而不是机器学习分类器?

如果您的文档类型可以通过一致的短语、标题或 ID 模式(例如发票编号格式、固定的合同标题、已知的表单代码)来识别,并且您希望立即获得结果而无需训练阶段,请选择“文档分类”。如果类别模糊、内容措辞差异很大,或者您已经拥有用于训练的已标注数据集,请选择机器学习分类器,例如 Google Cloud Natural Language 或 Amazon Comprehend。

典型配置

工作流程示例Common Zapier patterns using Classify Document.
将发票和合同分别归档到不同的文件夹
  1. 文件夹中的新文件触发(Dropbox、Google Drive、 SharePoint)在新 PDF
  2. 对文档进行分类,映射文件和文件名,返回类名。
  3. 路径步骤按类名分支:发票走一条路,合同走另一条路。
  4. 上传文件会将每个分支保存到各自的文件夹中(会计/发票、法律/合同)。
先进行分类,然后使用匹配的模板进行解析
  1. 当传入新文件时,会触发“文件夹中的新文件”触发器。 PDF
  2. 对文档进行分类,返回文档的类名。
  3. “路径”步骤在“类名称”为“发票”时使用发票模板运行“解析文档”,在“类名称”为“收据”时使用收据模板运行“解析文档”。
  4. 每条路径都将提取的字段映射到其自身的下游步骤。
在文件名前加上检测到的类名。
  1. 当传入新文件时,会触发“文件夹中的新文件”触发器。 PDF
  2. 对文档进行分类,返回文档的类名。
  3. 上传文件使用触发器中的原始文件,并将“指定文件名”设置为“类名”加上下划线加上原始文件名。

实用技巧

Test your regex on dev.pdf4me.com before wiring the Zap
Save Changes only commits a class once its pattern actually matches sample content. Confirm the class works in the dashboard test panel first, then map File in Zapier.
Always handle the unmatched case
Class Names comes back empty or unmatched when no saved class fits, this is not an error. Add a default Paths branch or a catch-all Filter so unclassified documents still land somewhere reviewable.
Keep patterns specific to avoid false matches
A broad regex like invoice(.*) can also match a contract that happens to mention the word invoice. Anchor patterns to consistent headers, ID formats, or fixed phrases unique to each document type.
The action does not return the PDF itself
Only Class Names and Trace Id come back. Keep referencing the original File from your trigger for any follow-up step like Upload File or Parse Document.
JavaScript expressions unlock logic regex cannot
For classification rules that need more than pattern matching, for example combining two conditions, use a JavaScript expression class instead of a Regular Expression class.

速查表

场地价值
ActionClassify Document
Classes defined atdev.pdf4me.com Classify Document dashboard
FileRequired, from trigger or previous step
File NameOptional
OutputTrace Id, Class Names
Unmatched resultEmpty/unmatched Class Names, not an error
Credits1 credit per classification run

常见问题

How is this different from AI or machine-learning document classification?+
Services like <a href="https://cloud.google.com/natural-language/docs/classifying-text" target="_blank" rel="noopener noreferrer">Google Cloud Natural Language</a> and <a href="https://docs.aws.amazon.com/comprehend/latest/APIReference/API_ClassifyDocument.html" target="_blank" rel="noopener noreferrer">Amazon Comprehend</a> classify text with trained machine-learning models and a predefined category taxonomy. PDF4me Classify Document instead matches PDF content against a regex or JavaScript rule you write and store on dev.pdf4me.com. There is no model training, no taxonomy to adopt, and no confidence score to tune, you decide exactly what pattern identifies each document type.
Where do I create document classes?+
Classes are created and stored in your PDF4me account, not inside Zapier. Open the Classify Document dashboard on dev.pdf4me.com, add a Class Name with a Regular Expression or JavaScript pattern, and click Save Changes. The Zapier action only evaluates a PDF against classes that already exist in your account.
What does the action return if no class matches?+
Class Names comes back empty or unmatched rather than throwing an error when the PDF content does not match any saved expression. Route this case through a Filter or a default Paths branch so unclassified documents still land somewhere reviewable instead of silently disappearing from the workflow.
Can I classify a document without sending the PDF content again in the next step?+
Yes. Classify Document returns only Class Names and Trace Id, it does not return or modify the PDF file itself. Keep referencing the File field from your trigger or an earlier step for any follow-up action such as Upload File, Parse Document, or an email attachment.

相关操作

行业应用案例及应用

  • 发票路由将发票按类别(例如,使用正则表达式匹配“发票”)路由到应付账款工作流程。
  • 收据处理:使用表达式模式识别费用管理的收据
  • 文档排序:使用您的分类规则按类型整理财务文件

获取帮助