跳到主要内容

对文档进行分类 Make

本模块的功能

PDF4me文档分类 读到 PDF 并返回一个 类名 它用于识别文档类型,例如发票、合同、收据或您定义的任何自定义类别。分类规则(正则表达式或 JavaScript 表达式)只需在您的系统中设置一次。 PDF4me 在 dev.pdf4me.com 上注册一个帐户。当 PDF 通过模块 Make将其与这些规则进行匹配,并返回获胜的类别标签。将该标签输入到 Make 路由器可以将文档发送到正确的文件夹,选择正确的解析模板,或触发特定类型的下游操作,所有这些都无需任何手动排序。

相关博客文章(1)

验证您的身份 API 要求

每一个 PDF4me 模块 Make 需要有效 联系创建或选择一个可以容纳您的 PDF4me API 关键在于确保场景能够安全地验证分类请求。

您不容错过的重要事实

请先在您的帐户中定义类,而不是在 Make 中定义。
分类规则存在于您的 PDF4me 仪表盘 dev.pdf4me.com → 文档分类添加类名(例如: pdf4me_invoice)和正则表达式或 JavaScript 表达式(例如 发票(。*)),然后单击“保存更改”。 Make 该模块没有用于定义规则的字段,它只会应用您在帐户中保存的规则。
该模块仅返回类名,不返回其他信息。 PDF
文档分类输出两个字段: 类名 (匹配的标签) 追踪 ID (用于调试)。它不会返回或修改。 PDF 文件。如果您需要传递 PDF 将其映射到下游模块、上传、解析或通过电子邮件发送,映射来自以下位置的文档输出: 事先的 下载或触发步骤,而不是从本模块下载或触发。
每次分类运行消耗一个积分
每次执行“分类文档”模块都会使用一个 PDF4me 无论是否找到匹配的课程,都会计算学分。对于处理大量文档(数百或数千份)的场景, PDFs 每天),规划你的信用分配 PDF4me 在大规模启用该方案之前,请先配置仪表盘。添加一个路由回退分支,用于处理未匹配的文档,以避免出现静默故障。
PDF4me 文档分类模块显示“连接”设置为“我的 PDF4me 连接”,“文件名”映射自步骤 1 中的文件名,“文档”映射自步骤 1 中的数据。

该模块只需要您之前下载步骤中的文件名和文档。分类规则将从您的文件中读取。 PDF4me 账户自动创建,内部无任何规则配置 Make

参数

先决条件: 至少创建一个文档类 dev.pdf4me.com → 文档分类 使用此模块前,请参阅相关说明。 设置文档分类 完整攻略请见下文。

范围必需的它的作用例子
ConnectionYesPDF4me API connection. Click Add and paste your API key if connecting for the first time.My PDF4me connection
File NameYesFilename of the PDF to classify including .pdf extension. Map from the prior module's file name output.document.pdf
DocumentYesBinary content of the PDF to classify. Map from the prior module's data output: Dropbox, Google Drive, HTTP, or email attachment.1. Data

输出字段

场地描述
类名匹配的类别标签(例如, pdf4me_invoiceContract)在路由器设置或重命名步骤中使用此方法。
追踪 ID本次分类运行的唯一标识符,可用于调试或审计日志记录。

快速设置

  1. 前往 dev.pdf4me.com → 文档分类, 点击 编辑添加类名(例如: pdf4me_invoice) 使用正则表达式(例如 invoice(.*)),然后点击 保存更改
  2. 在你的 Make 场景,添加 PDF4me分类文件 文件下载步骤之后。
  3. 选择 联系 (或点击) 添加 用你的 PDF4me API 钥匙)。
  4. 地图 文件名文档 来自先前的下载或触发模块。
  5. 点击 节省 并运行该场景。 类名 输出包含匹配的文档类型:将其连接到 路由器 按类型进行分支,上传模块保存到特定类型的文件夹,或者重命名步骤在文件名前加上类名。

工作流程示例

工作流程示例Common Make scenario patterns using Classify Document.
将发票、合同和收据分别放入不同的文件夹。
  1. Dropbox 监视文件夹会在新文件夹创建时触发。 PDF 邮件落入“收件箱”文件夹。
  2. Dropbox 下载文件会检索该文件 PDF 二进制。
  3. 对文档进行分类会返回类名,例如: pdf4me_invoicepdf4me_合同, 或者 pdf4me_receipt
  4. 路由分支基于类名:发票 → /会计/发票/合同 → /法律/合同/收据 → 财务/收据/
  5. 每个分支上传 PDF (从下载步骤,而非分类步骤)保存到目标文件夹。Slack 会通知相关团队。
使用正确的模板进行分类和解析
  1. 当电子邮件监控功能触发时, PDF 附件已送达账户收件箱。
  2. 对文档进行分类,以确定它是发票、采购订单还是送货单。
  3. 路由器根据类名进行分支,并运行匹配的解析文档模块、发票模板和采购订单模板。
  4. 提取的数据(总计、供应商、日期)会写入 Google 表格中每个文档类型的一行。
  5. 一种方案可以处理任何文档类型,处理前无需手动排序。
文件到达时自动按文档类型重命名文件
  1. Google 云端硬盘监视文件功能会在新文件上传时触发。 PDF 已上传至共享的“文档”文件夹。
  2. Google 云端硬盘的“获取文件”功能会下载二进制文件。
  3. 对文档进行分类会返回类名,例如: pdf4me_合同
  4. Google 云端硬盘上传文件会重新保存文件。 PDF 文件名带有前缀:类名 + 下划线 + 原始名称(例如: pdf4me_contract_NDA_2025.pdf)。
  5. 原始的未命名文件已移至存档子文件夹以供参考。

常见问题解答

Where do I create and manage classification rules?+
Rules are created at dev.pdf4me.com under the Classify Document section: not inside Make. Click Edit, add a Class Name and an expression (Regular Expression or JavaScript), then click Save Changes. The Make module automatically reads all saved classes from your account each time it runs. See the Set Up Classify Document guide for screenshots and full walkthrough.
What expression types are supported for defining a class?+
Two types: Regular Expression and JavaScript. Regex expressions match text patterns found anywhere in the PDF text content: for example, invoice(.*) matches any document containing the word "invoice". JavaScript expressions let you write more complex logic: multiple conditions, scored matching, or length-based rules, for documents where a single regex is insufficient.
What does the module output: does it return the PDF?+
No. The module outputs two text fields: Class Name (the matched class label, e.g. pdf4me_invoice) and Trace Id (a unique run identifier for debugging). The PDF itself is not returned. To pass the document to a downstream upload, email, or parse module, map the Document field from the prior download or trigger step: not from Classify Document.
What happens when no class expression matches the document?+
When no expression matches, the Class Name output is empty or contains an unmatched indicator. Add a fallback branch to your Router that handles empty Class Names: for example, route unclassified documents to a "Manual Review" folder and send a Slack alert. This prevents unmatched PDFs from being silently dropped or misrouted.
How many credits does each classification use?+
One credit per module execution, regardless of whether a match is found. For high-volume scenarios: processing hundreds of PDFs daily, estimate your monthly credit consumption before enabling at scale. Use the PDF4me dashboard to monitor usage and set up credit alerts if needed.

相关模块

获取帮助